Skip to content

TypeScript HTTP handlers#4931

Merged
JasonAtClockwork merged 14 commits into
phoebe/http-handlers-webhooksfrom
phoebe/http-handler/v8-host
May 22, 2026
Merged

TypeScript HTTP handlers#4931
JasonAtClockwork merged 14 commits into
phoebe/http-handlers-webhooksfrom
phoebe/http-handler/v8-host

Conversation

@gefjon
Copy link
Copy Markdown
Contributor

@gefjon gefjon commented May 1, 2026

Based on #4636 .

Description of Changes

This commit adds host support for registering HTTP handlers in V8 modules, and a minimal draft of TypeScript bindings support for the same. The TypeScript bindings support is fully vibe-coded and unreviewed, and is present only to allow a new smoketest, which is added to the http_routes suite. The host changes were also AI-assisted, but I reviewed and polished them.

API and ABI breaking changes

Adds new TypeScript "ABI." Also adds a new API, which I sure hope will be overwritten by @JasonAtClockwork .

Expected complexity level and risk

2: pretty simple extensions to TypeScript execution, which largely mirror existing call_procedure machinery.

Testing

  • New smoketest.

This commit adds host support for registering HTTP handlers in V8 modules,
and a minimal draft of TypeScript bindings support for the same.
The TypeScript bindings support is fully vibe-coded and unreviewed,
and is present only to allow a new smoketest, which is added to the `http_routes` suite.
The host changes were also AI-assisted, but I reviewed and polished them.
Copy link
Copy Markdown
Contributor

@coolreader18 coolreader18 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments, but overall LGTM

Comment thread crates/bindings-typescript/src/server/http_handlers.ts Outdated
Comment thread crates/bindings-typescript/src/server/http_handlers.ts Outdated
Comment thread crates/bindings-typescript/src/server/http_handlers.ts Outdated
Copy link
Copy Markdown
Contributor

@Centril Centril left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good; I have no comments beyond Noa's.

@gefjon
Copy link
Copy Markdown
Contributor Author

gefjon commented May 11, 2026

@coolreader18 @Centril to quote the PR description:

The TypeScript bindings support is fully vibe-coded and unreviewed, and is present only to allow a new smoketest, which is added to the http_routes suite.

gefjon and others added 4 commits May 12, 2026 11:26
…/v8-host

Resolved conflicts in:
	crates/core/src/host/module_host.rs
	crates/core/src/host/v8/mod.rs
It's unreachable now, as both host types are supported.
# Description of Changes

Cleaning up the TypeScript HTTP handler module bindings on top of the V8
host/module work from #4931.
- Consolidate the inbound handler API around http_handlers.ts
- keeps outbound procedure HTTP in http_internal.ts
- moves shared HTTP code into http_shared.ts to avoid dependency issues
- moves the inbound wire/runtime bridge into runtime.ts

# API and ABI breaking changes

Cleaning up the API layer:
  - spacetimedb.httpHandler(...)
  - spacetimedb.httpRouter(...)
  - Router
  - handler-side Request

# Expected complexity level and risk

2 - I needed to move code out of http_internal.ts to have it shareable
for http_handler.ts adding more churn than I'd like.

# Testing

- [x] Expanded the smoketests
- [x] Expanded unit test coverage
- [x] Local throwaway test suite
@JasonAtClockwork JasonAtClockwork merged commit 7f37ff6 into phoebe/http-handlers-webhooks May 22, 2026
43 of 46 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants