stitchkit 0.0.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +376 -4
  3. package/dist/browser/client.d.ts +30 -0
  4. package/dist/browser/client.d.ts.map +1 -0
  5. package/dist/browser/http.d.ts +77 -0
  6. package/dist/browser/http.d.ts.map +1 -0
  7. package/dist/browser/socket-io.d.ts +69 -0
  8. package/dist/browser/socket-io.d.ts.map +1 -0
  9. package/dist/browser/stream.d.ts +2 -0
  10. package/dist/browser/stream.d.ts.map +1 -0
  11. package/dist/contract/define.d.ts +94 -0
  12. package/dist/contract/define.d.ts.map +1 -0
  13. package/dist/contract/errors.d.ts +47 -0
  14. package/dist/contract/errors.d.ts.map +1 -0
  15. package/dist/contract/index.d.ts +4 -0
  16. package/dist/contract/index.d.ts.map +1 -0
  17. package/dist/contract/index.js +26 -0
  18. package/dist/contract/pagination.d.ts +19 -0
  19. package/dist/contract/pagination.d.ts.map +1 -0
  20. package/dist/index-5sxnvwb1.js +368 -0
  21. package/dist/index-809wc1tt.js +18 -0
  22. package/dist/index-a35v22fh.js +29 -0
  23. package/dist/index-kckky6zw.js +96 -0
  24. package/dist/index-ke4mx4ea.js +38 -0
  25. package/dist/index-n7bmdwmz.js +68 -0
  26. package/dist/index-v2z2v3mq.js +587 -0
  27. package/dist/index.d.ts +7 -0
  28. package/dist/index.d.ts.map +1 -0
  29. package/dist/index.js +111 -0
  30. package/dist/internal/errors.d.ts +5 -0
  31. package/dist/internal/errors.d.ts.map +1 -0
  32. package/dist/internal/typed.d.ts +9 -0
  33. package/dist/internal/typed.d.ts.map +1 -0
  34. package/dist/node.d.ts +4 -0
  35. package/dist/node.d.ts.map +1 -0
  36. package/dist/node.js +26 -0
  37. package/dist/observability/audit.d.ts +32 -0
  38. package/dist/observability/audit.d.ts.map +1 -0
  39. package/dist/observability/context.d.ts +60 -0
  40. package/dist/observability/context.d.ts.map +1 -0
  41. package/dist/observability/event.d.ts +49 -0
  42. package/dist/observability/event.d.ts.map +1 -0
  43. package/dist/observability/index.d.ts +14 -0
  44. package/dist/observability/index.d.ts.map +1 -0
  45. package/dist/observability/index.js +266 -0
  46. package/dist/observability/sanitize.d.ts +42 -0
  47. package/dist/observability/sanitize.d.ts.map +1 -0
  48. package/dist/observability/trace.d.ts +42 -0
  49. package/dist/observability/trace.d.ts.map +1 -0
  50. package/dist/react/cache-bridge.d.ts +53 -0
  51. package/dist/react/cache-bridge.d.ts.map +1 -0
  52. package/dist/react/cursor-query.d.ts +37 -0
  53. package/dist/react/cursor-query.d.ts.map +1 -0
  54. package/dist/react.d.ts +3 -0
  55. package/dist/react.d.ts.map +1 -0
  56. package/dist/react.js +52 -0
  57. package/dist/server/cache.d.ts +15 -0
  58. package/dist/server/cache.d.ts.map +1 -0
  59. package/dist/server/context.d.ts +9 -0
  60. package/dist/server/context.d.ts.map +1 -0
  61. package/dist/server/create.d.ts +4 -0
  62. package/dist/server/create.d.ts.map +1 -0
  63. package/dist/server/event-bus.d.ts +24 -0
  64. package/dist/server/event-bus.d.ts.map +1 -0
  65. package/dist/server/implement.d.ts +16 -0
  66. package/dist/server/implement.d.ts.map +1 -0
  67. package/dist/server/index.d.ts +17 -0
  68. package/dist/server/index.d.ts.map +1 -0
  69. package/dist/server/index.js +399 -0
  70. package/dist/server/logger.d.ts +21 -0
  71. package/dist/server/logger.d.ts.map +1 -0
  72. package/dist/server/middleware/auth.d.ts +50 -0
  73. package/dist/server/middleware/auth.d.ts.map +1 -0
  74. package/dist/server/middleware/cookies.d.ts +34 -0
  75. package/dist/server/middleware/cookies.d.ts.map +1 -0
  76. package/dist/server/middleware/cors.d.ts +9 -0
  77. package/dist/server/middleware/cors.d.ts.map +1 -0
  78. package/dist/server/multipart.d.ts +14 -0
  79. package/dist/server/multipart.d.ts.map +1 -0
  80. package/dist/server/node.d.ts +12 -0
  81. package/dist/server/node.d.ts.map +1 -0
  82. package/dist/server/rate-limit.d.ts +17 -0
  83. package/dist/server/rate-limit.d.ts.map +1 -0
  84. package/dist/server/request.d.ts +22 -0
  85. package/dist/server/request.d.ts.map +1 -0
  86. package/dist/server/router.d.ts +42 -0
  87. package/dist/server/router.d.ts.map +1 -0
  88. package/dist/server/socket-io.d.ts +42 -0
  89. package/dist/server/socket-io.d.ts.map +1 -0
  90. package/dist/server/stream.d.ts +18 -0
  91. package/dist/server/stream.d.ts.map +1 -0
  92. package/dist/server/swept-map.d.ts +22 -0
  93. package/dist/server/swept-map.d.ts.map +1 -0
  94. package/dist/server/types.d.ts +127 -0
  95. package/dist/server/types.d.ts.map +1 -0
  96. package/dist/tools/agent.d.ts +27 -0
  97. package/dist/tools/agent.d.ts.map +1 -0
  98. package/dist/tools/coerce.d.ts +8 -0
  99. package/dist/tools/coerce.d.ts.map +1 -0
  100. package/dist/tools/execute.d.ts +45 -0
  101. package/dist/tools/execute.d.ts.map +1 -0
  102. package/dist/tools/flatten.d.ts +15 -0
  103. package/dist/tools/flatten.d.ts.map +1 -0
  104. package/dist/tools/json-schema.d.ts +18 -0
  105. package/dist/tools/json-schema.d.ts.map +1 -0
  106. package/dist/tools/manifest.d.ts +13 -0
  107. package/dist/tools/manifest.d.ts.map +1 -0
  108. package/dist/tools/mcp-handler.d.ts +21 -0
  109. package/dist/tools/mcp-handler.d.ts.map +1 -0
  110. package/dist/tools/mcp-stdio.d.ts +25 -0
  111. package/dist/tools/mcp-stdio.d.ts.map +1 -0
  112. package/dist/tools/mcp.d.ts +92 -0
  113. package/dist/tools/mcp.d.ts.map +1 -0
  114. package/dist/tools/mount.d.ts +73 -0
  115. package/dist/tools/mount.d.ts.map +1 -0
  116. package/dist/tools/names.d.ts +2 -0
  117. package/dist/tools/names.d.ts.map +1 -0
  118. package/dist/tools/remote.d.ts +22 -0
  119. package/dist/tools/remote.d.ts.map +1 -0
  120. package/dist/tools/schema.d.ts +21 -0
  121. package/dist/tools/schema.d.ts.map +1 -0
  122. package/dist/tools/view-file.d.ts +57 -0
  123. package/dist/tools/view-file.d.ts.map +1 -0
  124. package/dist/tools.d.ts +12 -0
  125. package/dist/tools.d.ts.map +1 -0
  126. package/dist/tools.js +837 -0
  127. package/package.json +147 -4
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Max Listov
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,7 +1,379 @@
1
- # StitchKit
1
+ <p align="center">
2
+ <strong>Contract-first backend framework for Bun and Node.</strong><br/>
3
+ Define your API once — get an HTTP API, MCP tools, AI-agent tools and a typed client.
4
+ </p>
2
5
 
3
- Contract-first fullstack framework for Bun.
6
+ <p align="center">
7
+ <a href="https://www.npmjs.com/package/stitchkit"><img src="https://img.shields.io/npm/v/stitchkit?color=2563eb" alt="npm version" /></a>
8
+ <a href="https://github.com/max-listov/stitchkit/actions/workflows/ci.yml"><img src="https://github.com/max-listov/stitchkit/actions/workflows/ci.yml/badge.svg" alt="CI" /></a>
9
+ <a href="./LICENSE"><img src="https://img.shields.io/npm/l/stitchkit?color=2563eb" alt="MIT license" /></a>
10
+ <img src="https://img.shields.io/badge/runtime-Bun-fbf0df?logo=bun&logoColor=000" alt="Bun" />
11
+ <img src="https://img.shields.io/badge/runtime-Node%20%E2%89%A522-339933?logo=nodedotjs&logoColor=fff" alt="Node >= 22" />
12
+ </p>
4
13
 
5
- One `defineContract()` → HTTP API + MCP tools + Agent tools + typed client + React Query hooks.
14
+ <p align="center">
15
+ <img src="https://raw.githubusercontent.com/max-listov/stitchkit/master/assets/infographic-hero.jpg" alt="One contract becomes an HTTP API, MCP tools, AI-agent tools and a typed client" width="100%" />
16
+ </p>
6
17
 
7
- Coming soon.
18
+ <p align="center">
19
+ <em>One <code>defineContract()</code> → an HTTP API, MCP tools and AI-agent tools on the server — plus a fully-typed client to call them.</em>
20
+ </p>
21
+
22
+ ---
23
+
24
+ ## Why
25
+
26
+ - **One contract, four surfaces.** Define your API once — get HTTP routes, MCP tools (for Claude/Cursor), AI SDK tools (for agents), and a typed client.
27
+ - **Zero HTTP framework deps.** Built on `Bun.serve()` (Bun) or `srvx` (Node). No Hono, no Elysia, no Express.
28
+ - **Fullstack type safety.** Server handlers, client calls, MCP tools — all typed from the same contract.
29
+ - **Small.** ~4000 lines of source. No magic, no codegen, no build step.
30
+ - **Thin over what you already use.** WebSocket = Socket.IO (`createSocketIOClient` / `createSocketIOServer`). React data layer = `react-query-kit` (`createCursorQuery`). stitchkit owns the contract and the transport — not its own competing WebSocket or hook engine.
31
+
32
+ ### The problem it solves
33
+
34
+ A modern backend exposes the *same* operations three ways — an HTTP API for the
35
+ app, MCP tools for assistants like Claude and Cursor, and tool definitions for AI
36
+ agents. Written by hand, that is one surface described three times: three places
37
+ to drift, three places to keep in sync. stitchkit collapses them into a single
38
+ contract — change it once, every surface and the typed client move together.
39
+
40
+ <p align="center">
41
+ <img src="https://raw.githubusercontent.com/max-listov/stitchkit/master/assets/infographic-compare.jpg" alt="Without stitchkit: the same API hand-written three times. With stitchkit: one contract drives them all." width="100%" />
42
+ </p>
43
+
44
+ ## Status
45
+
46
+ Pre-1.0. The core is stable and covered by tests, but the public API may still
47
+ change between minor versions until 1.0. Bun is first-class; Node ≥ 22 is
48
+ supported via `stitchkit/node`.
49
+
50
+ ## Install
51
+
52
+ ```bash
53
+ bun add stitchkit # Bun
54
+ npm install stitchkit # Node
55
+ pnpm add stitchkit # pnpm
56
+ ```
57
+
58
+ ## Import policy
59
+
60
+ Browser code imports browser-safe entrypoints:
61
+
62
+ ```ts
63
+ import { defineContract, createClient, createHttpClient } from 'stitchkit'
64
+ import { createSocketIOClient } from 'stitchkit'
65
+ import { createCursorQuery, createCacheBridge } from 'stitchkit/react'
66
+ import { parseSSE } from 'stitchkit'
67
+ ```
68
+
69
+ Server code imports server entrypoints:
70
+
71
+ ```ts
72
+ import { createServer, createHandler, implement } from 'stitchkit/server'
73
+ import { createSocketIOServer, createAuthHook } from 'stitchkit/server'
74
+ import { createMcpHandler, mountAgent } from 'stitchkit/tools'
75
+ ```
76
+
77
+ The root `stitchkit` entrypoint is browser-safe. Server and tool code live behind `stitchkit/server` and `stitchkit/tools`.
78
+
79
+ ## Quick Start
80
+
81
+ ### 1. Define a contract
82
+
83
+ ```ts
84
+ // shared/contracts.ts
85
+ import { defineContract } from 'stitchkit'
86
+ import { z } from 'zod'
87
+
88
+ const UserSchema = z.object({ id: z.string(), name: z.string() })
89
+ const CreateUserSchema = z.object({ name: z.string() })
90
+ const IdSchema = z.object({ id: z.string() })
91
+
92
+ export const users = defineContract({ prefix: 'users' }, {
93
+ list: { method: 'GET', path: '/', desc: 'List all users', output: z.array(UserSchema) },
94
+ create: { method: 'POST', path: '/', desc: 'Create a user', input: CreateUserSchema, output: UserSchema },
95
+ get: { method: 'GET', path: '/:id', desc: 'Get user by ID', params: IdSchema, output: UserSchema },
96
+ delete: { method: 'DELETE', path: '/:id', desc: 'Delete a user', params: IdSchema },
97
+ })
98
+ ```
99
+
100
+ ### 2. Implement handlers
101
+
102
+ ```ts
103
+ // server/index.ts
104
+ import { implement, createServer } from 'stitchkit/server'
105
+ import { users } from '../shared/contracts'
106
+
107
+ const service = implement(users, {
108
+ list: (ctx) => db.users.findMany(),
109
+ create: (ctx) => db.users.create({ name: ctx.input.name }),
110
+ get: (ctx) => db.users.findById(ctx.params.id),
111
+ delete: (ctx) => db.users.delete(ctx.params.id),
112
+ })
113
+
114
+ createServer({ services: [service], port: 3000 })
115
+ ```
116
+
117
+ ### 3. Use from the client
118
+
119
+ ```ts
120
+ // client/api.ts
121
+ import { createClient, createHttpClient } from 'stitchkit'
122
+ import { users } from '../shared/contracts'
123
+
124
+ const http = createHttpClient({ baseUrl: '/api' })
125
+ export const api = createClient(users, http)
126
+
127
+ await api.list() // GET /users → User[]
128
+ await api.create({ name: 'Max' }) // POST /users → User
129
+ await api.get({ id: '123' }) // GET /users/123 → User
130
+ ```
131
+
132
+ For many contracts at once, use `createClients(contractRegistry, http)`.
133
+
134
+ ### 4. React data layer (react-query-kit)
135
+
136
+ stitchkit does not ship its own hook engine — pair the typed client with
137
+ [`react-query-kit`](https://github.com/liaoliao666/react-query-kit), wrapping
138
+ the client methods directly:
139
+
140
+ ```ts
141
+ import { createMutation, createQuery } from 'react-query-kit'
142
+ import { api } from './api'
143
+
144
+ export const useUsers = createQuery({ queryKey: ['users'], fetcher: () => api.list() })
145
+ export const useCreateUser = createMutation({ mutationFn: api.create })
146
+ ```
147
+
148
+ For cursor-paginated lists, `createCursorQuery` is the canonical helper:
149
+
150
+ ```ts
151
+ import { createCursorQuery } from 'stitchkit/react'
152
+ import { api } from './api'
153
+
154
+ export const useFeed = createCursorQuery({ queryKey: ['feed'], endpoint: api.feed.list })
155
+ ```
156
+
157
+ It injects `cursor` from the page param and bakes in `getNextPageParam`. Page
158
+ size is the server's call — the contract's `limit` default — never the client's.
159
+
160
+ ### 5. MCP tools (for Claude, Cursor, etc.)
161
+
162
+ ```ts
163
+ import { createMcpHandler } from 'stitchkit/tools'
164
+
165
+ const handleMcp = createMcpHandler({
166
+ serverInfo: { name: 'my-app', version: '1.0.0' },
167
+ auth: (req) => resolveApiKey(req), // → identity, or null for 401
168
+ services: [service], // contract endpoints with expose: ['MCP']
169
+ })
170
+ // mount `handleMcp` under /mcp — no @modelcontextprotocol/sdk import in your app
171
+ ```
172
+
173
+ ### 6. AI Agent tools
174
+
175
+ ```ts
176
+ import { mountAgent } from 'stitchkit/tools'
177
+ import { generateText } from 'ai'
178
+
179
+ const tools = mountAgent(service, { context: { userId: 'agent-1' } })
180
+ const result = await generateText({ model, tools, prompt: 'Create a user named Max' })
181
+ ```
182
+
183
+ ### 7. WebSocket (Socket.IO)
184
+
185
+ stitchkit's WebSocket layer is Socket.IO — `polling` fallback, heartbeat, acks,
186
+ a mature client. The wrappers cover the boilerplate.
187
+
188
+ ```ts
189
+ // Server
190
+ import { createServer, createSocketIOServer } from 'stitchkit/server'
191
+
192
+ const socket = createSocketIOServer<ServerToClientEvents, ClientToServerEvents>({
193
+ cors: { origin: 'https://app.example.com' },
194
+ })
195
+
196
+ socket.io.on('connection', (s) => { /* rooms, handshake auth — your domain logic */ })
197
+
198
+ createServer({
199
+ services: [service],
200
+ websocket: socket.websocket, // → Bun.serve
201
+ rawRoutes: [socket.route], // ready /socket.io/* route
202
+ })
203
+ ```
204
+
205
+ ```ts
206
+ // Client
207
+ import { createSocketIOClient } from 'stitchkit'
208
+
209
+ const socket = createSocketIOClient<ServerToClientEvents, ClientToServerEvents>({
210
+ url: 'https://api.example.com',
211
+ })
212
+ socket.connect()
213
+ socket.on('notification', (data) => console.log(data)) // typed
214
+ socket.emit('join', { room: 'r1' }) // typed
215
+ ```
216
+
217
+ ### 8. Cache Bridge
218
+
219
+ Sync Socket.IO events into the TanStack Query cache. Transport-agnostic — it
220
+ takes any emitter with `on(event, handler) => unsubscribe` (the
221
+ `createSocketIOClient` result qualifies).
222
+
223
+ ```ts
224
+ import { createCacheBridge } from 'stitchkit/react'
225
+
226
+ const bridge = createCacheBridge({
227
+ socket,
228
+ queryClient,
229
+ handlers: {
230
+ notification: (data, ctx) => {
231
+ if (ctx.isFresh(['notes'])) return // skip echo of own mutation
232
+ ctx.queryClient.setQueryData(['notes'], data)
233
+ },
234
+ },
235
+ })
236
+ bridge.connect()
237
+ // in a mutation: onSuccess: () => bridge.markFresh(['notes'])
238
+ ```
239
+
240
+ ### 9. SSE Streaming
241
+
242
+ ```ts
243
+ import { streamSSE } from 'stitchkit/server' // server: AsyncGenerator → SSE Response
244
+ import { parseSSE } from 'stitchkit' // client: Response → AsyncGenerator
245
+ ```
246
+
247
+ ## Features
248
+
249
+ | Feature | API |
250
+ |---------|-----|
251
+ | **Contract** | `defineContract()` — single source of truth for your API |
252
+ | **HTTP Server** | `createServer()` / `createHandler()` — Bun.serve, validation, hooks, raw routes |
253
+ | **MCP Tools** | `createMcpHandler()` / `mountMcp()` — MCP tools from contracts |
254
+ | **Agent Tools** | `mountAgent()` — Vercel AI SDK tools from contracts |
255
+ | **Typed Client** | `createClient()` / `createClients()` — typed fetch from contracts |
256
+ | **Cursor Pagination** | `createCursorQuery()` — `react-query-kit` infinite query from a contract method |
257
+ | **WebSocket** | `createSocketIOClient()` / `createSocketIOServer()` — typed Socket.IO wrappers |
258
+ | **Cache Bridge** | `createCacheBridge()` — socket events → TanStack Query cache |
259
+ | **Auth** | `createAuthHook()` / `createBearerResolver()` — scope-aware auth from `contract.scope` |
260
+ | **SSE Streaming** | `streamSSE()` / `parseSSE()` — async generator ↔ SSE |
261
+ | **Events** | `createEventBus<EventMap>()` — typed in-process pub/sub |
262
+ | **Multipart** | `parseMultipart()` — file upload with field validation |
263
+ | **Rate Limiting** | `createRateLimiter()` — token bucket, per-key |
264
+ | **Cache** | `createCache()` — in-memory with TTL + `cacheHeaders()` |
265
+ | **Errors** | `AppError`, `notFound()`, `badRequest()`, `unauthorized()` |
266
+
267
+ ## How it compares
268
+
269
+ A modern backend exposes the same operations as an HTTP API, as MCP tools and as
270
+ AI-agent tools. Most stacks make you describe each surface separately.
271
+
272
+ | | **Without stitchkit** | **With stitchkit** |
273
+ |--|----------------------|--------------------|
274
+ | Define an operation | once per surface — HTTP, MCP, agent (3×) | once — `defineContract()` |
275
+ | Keep the surfaces in sync | manual; they drift apart | cannot drift — one source |
276
+ | Typed client | hand-written, or a codegen step | inferred from the contract |
277
+ | Expose a new surface | re-describe every endpoint | flip `expose` — already typed |
278
+
279
+ Versus other typed-API tools:
280
+
281
+ | Capability | stitchkit | tRPC | ts-rest | Hono / Elysia |
282
+ |------------|:---:|:---:|:---:|:---:|
283
+ | Contract is plain data — no decorators, no codegen | ✅ | ⚠️ router type | ✅ | ❌ |
284
+ | Inferred typed client | ✅ | ✅ | ✅ | ⚠️ Eden / hc |
285
+ | Plain HTTP REST routes | ✅ | ⚠️ RPC-style | ✅ | ✅ |
286
+ | **MCP tools from the same contract** | ✅ | ❌ | ❌ | ❌ |
287
+ | **AI-agent tools from the same contract** | ✅ | ❌ | ❌ | ❌ |
288
+ | No HTTP-framework dependency | ✅ | ✅ | ✅ | — it is one |
289
+
290
+ The line no other tool draws: **the same contract becomes MCP tools and AI-agent
291
+ tools** — not just an HTTP API and a client. That is what stitchkit is for.
292
+
293
+ ## Lifecycle Hooks
294
+
295
+ ```ts
296
+ createServer({
297
+ services: [service],
298
+ hooks: {
299
+ onRequest(req) { }, // logging, rate limiting
300
+ beforeHandle(ctx, endpoint) { }, // auth, scope checks
301
+ afterHandle(ctx, result) { }, // transform, cache headers
302
+ onError(ctx, error) { }, // error formatting
303
+ },
304
+ })
305
+ ```
306
+
307
+ ## Auth & Scopes
308
+
309
+ Contracts carry a `scope`; `createAuthHook` enforces it on every transport from
310
+ one declarative `rules` map:
311
+
312
+ ```ts
313
+ import { createAuthHook, createBearerResolver } from 'stitchkit/server'
314
+
315
+ const authHook = createAuthHook<User>({
316
+ resolve: (ctx) => resolveSession(ctx),
317
+ rules: {
318
+ public: 'public',
319
+ user: 'authenticated',
320
+ admin: (user) => user.isAdmin,
321
+ },
322
+ })
323
+
324
+ createServer({ services, hooks: { beforeHandle: authHook } })
325
+ ```
326
+
327
+ ## Dependencies
328
+
329
+ stitchkit ships with **one runtime dependency**. Everything else is an optional
330
+ peer — an install pulls in only what the project actually uses.
331
+
332
+ | Dependency | Kind | Why this one |
333
+ |------------|------|--------------|
334
+ | `ky` | bundled, runtime | The HTTP client behind the typed client — ~13 KB, `fetch`-based, with retry, hooks and timeouts built in. The only thing stitchkit installs for you. |
335
+ | `zod` | peer, **required** | Schemas are the single source of truth. A peer so your app and stitchkit share **one** `zod` instance — `z.infer` types and `instanceof` checks break across two copies. |
336
+ | `@modelcontextprotocol/sdk` | peer, optional | Only `stitchkit/tools` — the MCP server. |
337
+ | `ai` | peer, optional | Only `stitchkit/tools` — agent tools (Vercel AI SDK). |
338
+ | `@tanstack/react-query` + `react-query-kit` | peer, optional | Only `stitchkit/react` — `createCursorQuery`, `createCacheBridge`. |
339
+ | `socket.io` / `@socket.io/bun-engine` / `socket.io-client` | peer, optional | Only the Socket.IO wrappers. |
340
+
341
+ **Why peers, not bundled.** A peer is resolved once, by your app — framework and
342
+ app code share a single instance. Bundled copies would double `zod`, split the
343
+ `react` hook runtime and break `instanceof`. Optional peers mean an app that
344
+ never touches MCP never installs the MCP SDK. → [ADR 0011](./docs/decisions/0011-bun-only-one-package.md)
345
+
346
+ The framework itself is small — ~4000 lines, no codegen, no build step in your app.
347
+
348
+ ## Example
349
+
350
+ A complete runnable app lives in [`packages/starter`](./packages/starter) — a
351
+ notes CRUD with a contract, a typed client, `react-query-kit` hooks and a
352
+ Socket.IO live-reload.
353
+
354
+ ## Documentation
355
+
356
+ This README is the quick start. The full guide and API reference are in
357
+ [`docs/`](./docs/README.md):
358
+
359
+ - **Guide** — [getting started](./docs/guide/getting-started.md) ·
360
+ [contracts](./docs/guide/contracts.md) ·
361
+ [HTTP server](./docs/guide/server.md) ·
362
+ [typed client](./docs/guide/client.md) ·
363
+ [MCP & agents](./docs/guide/mcp-and-agents.md) ·
364
+ [realtime](./docs/guide/realtime.md) ·
365
+ [auth & errors](./docs/guide/auth-and-errors.md) ·
366
+ [testing & deployment](./docs/guide/testing-and-deployment.md)
367
+ - **[API reference](./docs/api/reference.md)** — every export, by entrypoint.
368
+ - **[Roadmap](./ROADMAP.md)** — where stitchkit is going.
369
+ - **[Architecture decisions](./docs/decisions/)** — the *why* behind the design.
370
+
371
+ ## Contributing
372
+
373
+ Issues and PRs are welcome — see [CONTRIBUTING.md](./CONTRIBUTING.md). Released
374
+ changes are in [CHANGELOG.md](./CHANGELOG.md); security issues go through
375
+ [SECURITY.md](./SECURITY.md).
376
+
377
+ ## License
378
+
379
+ [MIT](./LICENSE) © Max Listov
@@ -0,0 +1,30 @@
1
+ import type { ContractDef, EndpointDef, TypedHttpClient } from '../contract';
2
+ import { type HttpClient as HttpAdapter } from './http';
3
+ /** Config for the built-in fetch client — used when no `HttpClient` is passed. */
4
+ export interface ClientConfig {
5
+ baseUrl: string;
6
+ headers?: Record<string, string> | (() => Record<string, string>);
7
+ credentials?: RequestCredentials;
8
+ onError?: (status: number, body: unknown) => void;
9
+ }
10
+ /** Per-contract client tweaks — a dynamic URL `pathPrefix` and the keys it consumes. */
11
+ export interface ContractClientConfig {
12
+ pathPrefix?: string | ((args: Record<string, unknown>) => string);
13
+ stripPrefixKeys?: string[];
14
+ }
15
+ /**
16
+ * Build a fully-typed client from a contract. Every endpoint becomes a typed
17
+ * method — arguments and result inferred from its schemas. Pass an `HttpClient`
18
+ * (from `createHttpClient`) for cookie auth, SSR and retry, or a plain
19
+ * `ClientConfig` for a bare fetch client.
20
+ */
21
+ export declare function createClient<T extends Record<string, EndpointDef>>(contract: ContractDef<T, string>, configOrClient: ClientConfig | HttpAdapter, contractConfig?: ContractClientConfig): TypedHttpClient<T>;
22
+ /**
23
+ * Batch form of `createClient` — one fully-typed client per contract, built
24
+ * from a `name → contract` registry. Each key keeps its own client type, so
25
+ * the project lists its contracts once and gets the whole typed API.
26
+ */
27
+ export declare function createClients<T extends Record<string, ContractDef<Record<string, EndpointDef>, string>>>(contracts: T, http: HttpAdapter): {
28
+ [K in keyof T]: TypedHttpClient<T[K]['endpoints']>;
29
+ };
30
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/browser/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE7E,OAAO,EAEL,KAAK,UAAU,IAAI,WAAW,EAG/B,MAAM,QAAQ,CAAC;AA8ChB,kFAAkF;AAClF,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,MAAM,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAClE,WAAW,CAAC,EAAE,kBAAkB,CAAC;IACjC,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;CACnD;AAED,wFAAwF;AACxF,MAAM,WAAW,oBAAoB;IACnC,UAAU,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,MAAM,CAAC,CAAC;IAClE,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;CAC5B;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,EAChE,QAAQ,EAAE,WAAW,CAAC,CAAC,EAAE,MAAM,CAAC,EAChC,cAAc,EAAE,YAAY,GAAG,WAAW,EAC1C,cAAc,CAAC,EAAE,oBAAoB,GACpC,eAAe,CAAC,CAAC,CAAC,CAepB;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAC3B,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,CAAC,CAAC,EAC1E,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,WAAW,GAAG;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC;CAAE,CAKzF"}
@@ -0,0 +1,77 @@
1
+ import type { ErrorEnvelope } from '../contract';
2
+ export type ApiEvent = {
3
+ type: 'unauthorized';
4
+ } | {
5
+ type: 'network_error';
6
+ } | {
7
+ type: 'logout';
8
+ };
9
+ export type ApiEventListener = (event: ApiEvent) => void;
10
+ export declare class ApiError extends Error {
11
+ readonly code: string;
12
+ readonly status: number;
13
+ readonly details?: unknown | undefined;
14
+ readonly hint?: string | undefined;
15
+ constructor(code: string, status?: number, details?: unknown | undefined, message?: string, hint?: string | undefined);
16
+ static is(error: unknown): error is ApiError;
17
+ }
18
+ /**
19
+ * Parse a response body into an `ErrorEnvelope['error']` — the default
20
+ * `HttpClientConfig.parseError`. Returns `null` when the body is not a
21
+ * stitchkit error envelope. Shared by `createHttpClient` and `createClient`.
22
+ */
23
+ export declare function parseApiErrorBody(body: unknown): ErrorEnvelope['error'] | null;
24
+ export type HeaderProvider = Record<string, string> | (() => Record<string, string> | null | undefined);
25
+ /** Configuration for `createHttpClient`. */
26
+ export interface HttpClientConfig {
27
+ baseUrl: string;
28
+ timeout?: number;
29
+ credentials?: RequestCredentials;
30
+ /**
31
+ * Transport retry. Defaults: 2 attempts, GET only, network errors only
32
+ * (empty `statusCodes`). Retrying a server that *responded* (5xx) belongs
33
+ * in the data layer (e.g. TanStack Query), not the transport — keeping it
34
+ * here too would multiply attempts. Override per project if really needed.
35
+ */
36
+ retry?: {
37
+ limit?: number;
38
+ methods?: string[];
39
+ statusCodes?: number[];
40
+ };
41
+ parseError?: (body: unknown) => ErrorEnvelope['error'] | null;
42
+ authEndpoints?: string[];
43
+ /**
44
+ * Extra headers added to every request. A function is re-evaluated per
45
+ * request — use it for runtime tokens (e.g. a short-lived auth token).
46
+ */
47
+ headers?: HeaderProvider;
48
+ }
49
+ type ParamValue = string | number | boolean | undefined;
50
+ type ParamArrayValue = Array<string | number>;
51
+ export interface RequestOptions {
52
+ params?: Record<string, ParamValue | ParamArrayValue>;
53
+ timeout?: number;
54
+ responseType?: 'json' | 'blob';
55
+ }
56
+ /** The HTTP transport adapter `createClient` builds typed methods on. */
57
+ export interface HttpClient {
58
+ get<T>(url: string, options?: RequestOptions): Promise<T>;
59
+ post<T>(url: string, data?: unknown, options?: RequestOptions): Promise<T>;
60
+ put<T>(url: string, data?: unknown, options?: RequestOptions): Promise<T>;
61
+ patch<T>(url: string, data?: unknown, options?: RequestOptions): Promise<T>;
62
+ delete<T>(url: string, options?: RequestOptions): Promise<T>;
63
+ setServerContext(cookies: string): void;
64
+ subscribe(listener: ApiEventListener): () => void;
65
+ /** Mark the client as logged out — suppresses further `unauthorized` events. */
66
+ logout(): void;
67
+ /** Clear the logged-out flag — call after a successful re-login. */
68
+ resetLogoutState(): void;
69
+ }
70
+ /**
71
+ * Create a Ky-based `HttpClient` — the transport `createClient` builds on.
72
+ * Handles cookie auth, SSR cookie forwarding, error parsing into `ApiError`, a
73
+ * `401 → unauthorized` event stream, and safe transport retry.
74
+ */
75
+ export declare function createHttpClient(config: HttpClientConfig): HttpClient;
76
+ export {};
77
+ //# sourceMappingURL=http.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/browser/http.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAGjD,MAAM,MAAM,QAAQ,GAChB;IAAE,IAAI,EAAE,cAAc,CAAA;CAAE,GACxB;IAAE,IAAI,EAAE,eAAe,CAAA;CAAE,GACzB;I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,IAAI,CAAC;IACf,oEAAoE;IACpE,gBAAgB,IAAI,IAAI,CAAC;CAC1B;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,gBAAgB,GAAG,UAAU,CA4JrE"}
@@ -0,0 +1,69 @@
1
+ /**
2
+ * Typed Socket.IO client — the family WebSocket client.
3
+ *
4
+ * The whole family runs on Socket.IO (`polling` fallback, heartbeat, acks,
5
+ * mature reconnection) — not a hand-rolled WebSocket. Every project copied the
6
+ * same ~150-line client: `io()` config, connection-state machine, a typed
7
+ * `on/emit`, a connection-change subscription. `createSocketIOClient` is that
8
+ * shared kernel.
9
+ *
10
+ * Subscriptions are durable: `on()` registers a handler once and the client
11
+ * re-attaches it onto every socket it builds — so a handler survives an
12
+ * explicit `disconnect()` / `connect()` cycle, and (because re-attach happens
13
+ * before `socket.connect()`) no handshake-time event is ever missed. A thin
14
+ * per-project layer can therefore subscribe once at construction.
15
+ *
16
+ * Auth identity (`userId`, `clientId`) is project-specific — it arrives in an
17
+ * app `authenticated` event — so it stays in that per-project layer on top.
18
+ * This client owns only the transport: connection lifecycle + typed events.
19
+ *
20
+ * The returned client satisfies `CacheBridgeSocket` (`on()` returns an
21
+ * unsubscribe), so it plugs straight into `createCacheBridge`.
22
+ */
23
+ import type { EventsMap } from '@socket.io/component-emitter';
24
+ /**
25
+ * Socket.IO event map — `{ event: (...args) => void }`. Aliases Socket.IO's
26
+ * own `EventsMap` constraint, which intentionally maps to `any`: that is what
27
+ * lets a plain `interface ServerToClientEvents { … }` (no index signature) be
28
+ * passed as a type argument. Per-event typing is fully preserved on the
29
+ * public `on` / `emit` signatures.
30
+ */
31
+ export type SocketEventMap = EventsMap;
32
+ export interface SocketIOClientConfig {
33
+ /** Server origin, e.g. `https://api.example.com`. */
34
+ url: string;
35
+ /** Socket.IO endpoint path. Default `/socket.io/`. */
36
+ path?: string;
37
+ /** Send cookies on the handshake (cookie-based auth). Default `true`. */
38
+ withCredentials?: boolean;
39
+ /** Transports, in preference order. Default `['websocket', 'polling']`. */
40
+ transports?: Array<'websocket' | 'polling'>;
41
+ /** Reconnection attempts. Default `Infinity`. */
42
+ reconnectionAttempts?: number;
43
+ /** Initial reconnection delay (ms). Default `1000`. */
44
+ reconnectionDelay?: number;
45
+ /** Max reconnection delay (ms). Default `5000`. */
46
+ reconnectionDelayMax?: number;
47
+ /** Connection timeout (ms). Default `20000`. */
48
+ timeout?: number;
49
+ }
50
+ export interface SocketIOClient<TServerEvents extends SocketEventMap, TClientEvents extends SocketEventMap> {
51
+ /** Create the socket (if absent) and connect. Idempotent. */
52
+ connect(): void;
53
+ /** Disconnect and drop the socket instance. */
54
+ disconnect(): void;
55
+ /** True while the underlying socket is connected. */
56
+ readonly connected: boolean;
57
+ /**
58
+ * Subscribe to a server → client event. Returns an unsubscribe. The handler
59
+ * is durable — it is re-attached onto every socket the client builds, so it
60
+ * survives a `disconnect()` / `connect()` cycle.
61
+ */
62
+ on<E extends keyof TServerEvents & string>(event: E, handler: TServerEvents[E]): () => void;
63
+ /** Emit a client → server event. No-op while disconnected. */
64
+ emit<E extends keyof TClientEvents & string>(event: E, ...args: Parameters<TClientEvents[E]>): void;
65
+ /** Subscribe to connection up/down changes. Returns an unsubscribe. */
66
+ onConnectionChange(listener: (connected: boolean) => void): () => void;
67
+ }
68
+ export declare function createSocketIOClient<TServerEvents extends SocketEventMap, TClientEvents extends SocketEventMap>(config: SocketIOClientConfig): SocketIOClient<TServerEvents, TClientEvents>;
69
+ //# sourceMappingURL=socket-io.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"socket-io.d.ts","sourceRoot":"","sources":["../../src/browser/socket-io.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAM9D;;;;;;GAMG;AACH,MAAM,MAAM,cAAc,GAAG,SAAS,CAAC;AAEvC,MAAM,WAAW,oBAAoB;IACnC,qD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,EAAE,aAAa,CAAC,CAoF5E"}
@@ -0,0 +1,2 @@
1
+ export { type ParseSSEOptions, parseSSE } from '../server/stream';
2
+ //# sourceMappingURL=stream.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../../src/browser/stream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC"}