@canmi/seam-server
v0.5.31
Published
Framework-agnostic server core that defines procedures, subscriptions, pages, and the HTTP protocol layer used by all adapters.
Readme
@canmi/seam-server
Framework-agnostic server core that defines procedures, subscriptions, pages, and the HTTP protocol layer used by all adapters.
Structure
src/index.ts— Public API barrel exportsrc/http.ts—createHttpHandler, SSE helpers,serialize,toWebResponsesrc/proxy.ts—createDevProxy,createStaticHandlerfor dev and static file servingsrc/procedure.ts— Internal procedure typessrc/types/— JTD schema type system (t.string(),t.object(), etc.)src/router/—createRouterwiring procedures, subscriptions, and pages togethersrc/page/—definePage(), loader functions, route matchingsrc/manifest/—buildManifestgenerates manifest from definitionssrc/validation/— JTD input validation
Key Exports
| Export | Purpose |
| ------------------- | ------------------------------------------------------- |
| createRouter | Wire procedures, subscriptions, and pages into a router |
| createHttpHandler | Create HTTP request handler from a router |
| definePage | Define a page with loaders and route patterns |
| t | JTD schema builder (t.string(), t.object(), etc.) |
| toWebResponse | Convert internal response to Web Response |
| serialize | Serialize response body to JSON |
| loadBuildOutput | Load pre-built skeleton templates and per-page assets |
| PageAssets | Per-page CSS/JS/preload/prefetch references (type) |
Development
- Build:
just build-ts - Test:
just test-ts
Notes
- Adapters depend on this package; it has no framework-specific code
- SSE subscriptions use
text/event-streamwith JSON-encoded data fields - JTD validation runs at the protocol boundary before procedure handlers execute
