feat(server): add Effect-first host routes and async factory - #72
Merged
Conversation
Contributor
TegamiThis repository uses Tegami to manage releases. When your changes affect published packages, add a changelog file under Create a changelog → · Changelog format No changelogs yetThis PR has no pending changelog files. If your changes require a release, add a changelog before merging. Run Managed by Tegami. |
aryasaatvik
marked this pull request as ready for review
August 31, 2026 12:23
Greptile SummaryThe PR adds the
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| packages/domainkit/src/server/index.ts | Implements host service contracts, route handling, error-status mapping, root-path normalization, async adapters, and managed Web-handler lifecycle; the previously reported defects are corrected. |
| packages/domainkit/tests/server/routes.test.ts | Covers authentication, tenant reuse denial, root mounting, continuation replay, callback validation, redirects, and unavailable pending-state storage. |
| packages/domainkit/src/server.ts | Defines the public server entry point through a named async factory and Effect-oriented namespace. |
| packages/domainkit/package.json | Publishes the new domainkit/server runtime and declaration artifacts. |
| apps/docs/content/reference/server.mdx | Documents async and Effect-native composition, mounting, host responsibilities, routes, lifecycle disposal, and failure behavior. |
Sequence Diagram
sequenceDiagram
participant Client
participant Handler as DomainKit Server
participant Host as Host Services
participant Provider
Client->>Handler: POST /connection/start
Handler->>Host: Authenticate and authorize reuse
Handler->>Provider: Create interactive flow
Handler->>Host: Persist one-time continuation
Handler-->>Client: Authorization URL
Client->>Provider: Complete provider consent
Provider->>Handler: GET /callback/:providerId
Handler->>Host: Load and consume continuation
Handler->>Provider: Exchange callback payload
Handler->>Host: Persist managed connection
Handler-->>Client: 303 same-origin redirect
Reviews (5): Last reviewed commit: "feat(server): add async host factory" | Re-trigger Greptile
aryasaatvik
force-pushed
the
feat/domainkit-server-dx
branch
from
August 31, 2026 12:36
10f6cda to
92c7db0
Compare
aryasaatvik
force-pushed
the
feat/domainkit-server-dx
branch
from
August 31, 2026 16:57
e7fec92 to
3c8563d
Compare
Expose one host-mounted start and callback handler while keeping identity, provider configuration, continuations, durable authorization storage, and policy in host-provided Layers.
aryasaatvik
force-pushed
the
feat/domainkit-server-dx
branch
from
August 31, 2026 19:58
3c8563d to
8d40abc
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Mount one secure provider-connection handler in either an Effect-native or conventional async host. Identity, tenancy, continuations, provider configuration, durable persistence, and policy remain host-owned.
Usage
Effect applications retain explicit composition through
Server.make,Server.layer, andServer.toWebHandler.Flow
Both entry styles run the same Effect route program. The async factory requires host Promise persistence; it does not choose a database, run migrations, dispose the host client, or add async CapsuleDB support.
Validation
bun run lintbun run format:checkbun run --cwd packages/domainkit release:check— 156 package tests and 7 packed-artifact tests, including Node, Bun, and workerd consumersgit diff --checkThe isolated Blume typecheck retains the pre-existing Astro/React/Bun typing baseline (70 errors on this branch; 75 on current
main).Follow-up scope
@domainkit/capsuledbremains an optional Effect-native persistence package in the existing follow-up PR. A later Samva PR will adopt the released API.