@luckystack/server 0.1.9 → 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.
- package/CHANGELOG.md +35 -35
- package/CLAUDE.md +85 -83
- package/LICENSE +21 -21
- package/README.md +198 -198
- package/dist/chunk-X3OSC5W3.js +44 -0
- package/dist/chunk-X3OSC5W3.js.map +1 -0
- package/dist/index.d.ts +43 -40
- package/dist/index.js +837 -420
- package/dist/index.js.map +1 -1
- package/dist/parseArgv.js +3 -34
- package/dist/parseArgv.js.map +1 -1
- package/docs/argv-parsing.md +256 -256
- package/docs/create-server.md +295 -295
- package/docs/http-routes.md +309 -309
- package/docs/request-pipeline.md +198 -198
- package/docs/runtime-maps.md +206 -206
- package/docs/security-defaults.md +236 -236
- package/package.json +21 -11
package/README.md
CHANGED
|
@@ -1,198 +1,198 @@
|
|
|
1
|
-
# @luckystack/server
|
|
2
|
-
|
|
3
|
-
> One-call server bootstrap for [LuckyStack](https://github.com/ItsLucky23/LuckyStack-v2). HTTP + Socket.io + framework routes (`/api/*`, `/sync/*`, `/_health`, `/_test/reset`, `/auth/*`, `/uploads/*`) wired together. Your `server.ts` shrinks to ~20 lines.
|
|
4
|
-
|
|
5
|
-
## Install
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm install @luckystack/server @luckystack/core @luckystack/api @luckystack/login @luckystack/sync @luckystack/presence socket.io
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Quickstart — recommended (`bootstrapLuckyStack`)
|
|
12
|
-
|
|
13
|
-
`bootstrapLuckyStack` is a thin wrapper around `createLuckyStackServer` that auto-imports your `luckystack/<pkg>/*.ts` overlay files in topological order before listening, so registries (DI, hooks, providers) are populated by the time the HTTP server boots. This is what `create-luckystack-app` scaffolds.
|
|
14
|
-
|
|
15
|
-
```ts
|
|
16
|
-
import 'dotenv/config';
|
|
17
|
-
import '../config'; // your registerProjectConfig(...)
|
|
18
|
-
import '../deploy.config'; // your registerDeployConfig(...)
|
|
19
|
-
import '../services.config'; // your registerServicesConfig(...)
|
|
20
|
-
|
|
21
|
-
import { bootstrapLuckyStack } from '@luckystack/server';
|
|
22
|
-
import { serveFile, serveFavicon } from './prod/serveFile';
|
|
23
|
-
|
|
24
|
-
const server = await bootstrapLuckyStack({
|
|
25
|
-
serveFile,
|
|
26
|
-
serveFavicon,
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
await server.listen();
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
The bootstrap call runs (in order):
|
|
33
|
-
|
|
34
|
-
1. Auto-imports `luckystack/core/*.ts`, `luckystack/deploy/*.ts`, `luckystack/login/*.ts`, `luckystack/sentry/*.ts`, `luckystack/presence/*.ts`, `luckystack/docs-ui/*.ts`, `luckystack/server/*.ts` (topologically sorted, then alphabetically inside each folder).
|
|
35
|
-
2. Hands off to `createLuckyStackServer(options)`.
|
|
36
|
-
|
|
37
|
-
Set `skipOverlayLoad: true` to handle every registration yourself, or `overlayRoot: 'custom-folder'` to load from somewhere other than `./luckystack`.
|
|
38
|
-
|
|
39
|
-
### Pre-flight check — `verifyBootstrap`
|
|
40
|
-
|
|
41
|
-
Call `verifyBootstrap` **after** the overlay loads (or after your manual registrations) and **before** `server.listen()` if you want to fail fast on missing registrations instead of silent runtime crashes:
|
|
42
|
-
|
|
43
|
-
```ts
|
|
44
|
-
import { bootstrapLuckyStack, verifyBootstrap } from '@luckystack/server';
|
|
45
|
-
|
|
46
|
-
const server = await bootstrapLuckyStack({ serveFile, serveFavicon });
|
|
47
|
-
|
|
48
|
-
await verifyBootstrap({
|
|
49
|
-
requireDeployConfig: true, // single-instance deploys can omit this
|
|
50
|
-
requireServicesConfig: true, // only true when the router will run
|
|
51
|
-
requireOAuthProviders: true, // false if you only use credentials login
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
await server.listen();
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
`verifyBootstrap` throws a single descriptive `Error` listing every missing registration. The full check covers:
|
|
58
|
-
|
|
59
|
-
- `ProjectConfig` — always required.
|
|
60
|
-
- `DeployConfig` — when `requireDeployConfig: true`.
|
|
61
|
-
- `ServicesConfig` — when `requireServicesConfig: true`.
|
|
62
|
-
- OAuth providers — when `requireOAuthProviders: true` and only the default `credentials` entry has been registered.
|
|
63
|
-
- `RuntimeMapsProvider` — hard-fails in production; loud-warns in dev because devkit hot-reload normally registers one. Without it, every API/sync request silently resolves to `notFound`.
|
|
64
|
-
- `LocalizedNormalizer` — hard-fails in production; warns in dev. Without it, error responses degrade to `errorCode`-as-message (no i18n).
|
|
65
|
-
|
|
66
|
-
## Lower-level entry — `createLuckyStackServer`
|
|
67
|
-
|
|
68
|
-
Use this directly when you want to control the order of imports yourself or skip the overlay convention:
|
|
69
|
-
|
|
70
|
-
```ts
|
|
71
|
-
import { initializeSentry } from '@luckystack/error-tracking';
|
|
72
|
-
import { registerPresenceHooks } from '@luckystack/presence';
|
|
73
|
-
import { createLuckyStackServer } from '@luckystack/server';
|
|
74
|
-
|
|
75
|
-
initializeSentry();
|
|
76
|
-
registerPresenceHooks();
|
|
77
|
-
|
|
78
|
-
const server = await createLuckyStackServer({
|
|
79
|
-
serveFile,
|
|
80
|
-
serveFavicon,
|
|
81
|
-
});
|
|
82
|
-
await server.listen();
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
Both entries handle devkit hot reload + console init in dev mode automatically — opt out with `enableDevTools: false` if you have your own.
|
|
86
|
-
|
|
87
|
-
## Options
|
|
88
|
-
|
|
89
|
-
```ts
|
|
90
|
-
interface CreateLuckyStackServerOptions {
|
|
91
|
-
port?: number | string; // default: process.env.SERVER_PORT ?? 80
|
|
92
|
-
ip?: string; // default: process.env.SERVER_IP ?? '127.0.0.1'
|
|
93
|
-
serveFile?: StaticFileHandler; // catch-all for non-framework GETs (Vite output, SPA fallback)
|
|
94
|
-
serveFavicon?: FaviconHandler; // /favicon.ico
|
|
95
|
-
customRoutes?: CustomRouteHandler; // pre-fallback hook; return true to mark handled
|
|
96
|
-
enableDevTools?: boolean; // default: NODE_ENV !== 'production'
|
|
97
|
-
maxHttpBufferSize?: number; // default: 5 MB
|
|
98
|
-
}
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
`customRoutes` runs before the static file serving, so you can add project-specific HTTP endpoints (webhooks, OG image generation, etc.) without forking the package. Return `true` if you ended the response.
|
|
102
|
-
|
|
103
|
-
You can also register custom routes globally via `registerCustomRoute(handler)` — the bootstrap call composes every registered handler into the running server. This is what `@luckystack/docs-ui` uses to mount `/_docs`.
|
|
104
|
-
|
|
105
|
-
```ts
|
|
106
|
-
import { registerCustomRoute } from '@luckystack/server';
|
|
107
|
-
|
|
108
|
-
registerCustomRoute(async (req, res) => {
|
|
109
|
-
if (req.url !== '/healthz') return false;
|
|
110
|
-
res.statusCode = 200;
|
|
111
|
-
res.end('ok');
|
|
112
|
-
return true;
|
|
113
|
-
});
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
## What it wires
|
|
117
|
-
|
|
118
|
-
- **HTTP server** with CORS + security headers, OPTIONS preflight, method validation, cookie sliding, CSRF middleware.
|
|
119
|
-
- **Socket.io server** attached to the HTTP server, with optional Redis adapter when configured in deploy config.
|
|
120
|
-
- **Framework routes:** `/_health`, `/livez`, `/readyz`, `/_test/reset` (dev/test only), `/api/*` and `/sync/*` (with SSE streaming), `/auth/api`, `/auth/callback/*`, `/uploads/*`, `/assets/*`, `/csrf-token`.
|
|
121
|
-
- **Presence broadcasting** (when enabled in project config): connect / disconnect / reconnect, location updates, peer notifications.
|
|
122
|
-
- **Boot UUID** written on startup so the load-balancer (`@luckystack/router`) can detect rolling restarts.
|
|
123
|
-
- **Dev tools** in non-production: devkit hot reload, console initializer.
|
|
124
|
-
|
|
125
|
-
### HTTP route handler layout
|
|
126
|
-
|
|
127
|
-
`handleHttpRequest` is now a thin (~190-line) orchestrator that sets up CORS / origin / security headers, runs the CSRF middleware, then dispatches a route-handler table. Each handler matches its own route path and returns `boolean` (handled or not). The handlers live in `packages/server/src/httpRoutes/`:
|
|
128
|
-
|
|
129
|
-
| File | Routes |
|
|
130
|
-
| --- | --- |
|
|
131
|
-
| `csrfMiddleware.ts` + `csrfRoute.ts` | CSRF guard on writes + `GET /csrf-token` |
|
|
132
|
-
| `healthRoutes.ts` | `/livez`, `/readyz`, `/_health` |
|
|
133
|
-
| `testResetRoute.ts` | `/_test/reset` (dev/test only — see Security below) |
|
|
134
|
-
| `faviconRoute.ts` | `/favicon.ico` |
|
|
135
|
-
| `uploadsRoute.ts` | `/uploads/*` (avatar serving via `serveAvatar`) |
|
|
136
|
-
| `authApiRoute.ts` | `/auth/api/*` |
|
|
137
|
-
| `authCallbackRoute.ts` | `/auth/callback/*` |
|
|
138
|
-
| `apiRoute.ts` | `/api/*` (delegates to `@luckystack/api`'s `handleHttpApiRequest`) |
|
|
139
|
-
| `syncRoute.ts` | `/sync/*` (delegates to `@luckystack/sync`'s `handleHttpSyncRequest`) |
|
|
140
|
-
| `customRoutes.ts` | Calls every handler registered via `registerCustomRoute(...)` and the inline `customRoutes` option |
|
|
141
|
-
| `staticRoutes.ts` | Final fallback to the consumer's `serveFile(...)` (Vite SPA, etc.) |
|
|
142
|
-
|
|
143
|
-
Top-level `handleHttpRequest` + `dispatchRoutes(handlers, ctx)` are the only orchestration; everything else is a flat list of single-purpose handlers. SSE handling, error fall-through, and dispatch order are preserved.
|
|
144
|
-
|
|
145
|
-
### Security defaults that may surprise you
|
|
146
|
-
|
|
147
|
-
- **CORS fail-closed.** If neither `Origin` nor `Referer` is present, only read-only methods (GET, HEAD, OPTIONS) are allowed; state-changing methods are rejected with 403. Earlier builds fell back to `Host`, which silently bypassed CORS for non-browser callers (`curl`, server-to-server). When you `curl` a write endpoint, set `-H 'Origin: https://your-allowed-origin'`.
|
|
148
|
-
- **`/_test/reset` is fail-closed.** It requires both `NODE_ENV` to be exactly `development` or `test` AND a non-empty `TEST_RESET_TOKEN` env var. Any other state returns 403 (no silent allow-list). Wire `TEST_RESET_TOKEN` in your dev/test `.env.local` and pass it as the `x-test-reset-token: ${TOKEN}` header on the reset call. `@luckystack/test-runner`'s `resetServerState` reads the same env var.
|
|
149
|
-
- **CSRF middleware.** Writes to `/api/*` and `/sync/*` require an `x-csrf-token` header that matches the value minted on the session record (mirrored via `GET /auth/csrf`). The `apiRequest` helper in `@luckystack/core/client` attaches it automatically. Rejections dispatch the `csrfMismatch` hook before returning 403; the payload contains presence-only token info, never the value. The header name, token length, and cookie options are customisable via `registerCsrfConfig({ headerName, tokenLength, cookieOptions })` from `@luckystack/core` — see `packages/core/docs/csrf-config.md`.
|
|
150
|
-
|
|
151
|
-
## Public API
|
|
152
|
-
|
|
153
|
-
| Export | Purpose |
|
|
154
|
-
| --- | --- |
|
|
155
|
-
| `bootstrapLuckyStack(options)` | High-level entry: verifies config, auto-imports overlay, then calls `createLuckyStackServer`. |
|
|
156
|
-
| `createLuckyStackServer(options)` | Lower-level factory that returns `{ httpServer, ioServer, listen }`. |
|
|
157
|
-
| `verifyBootstrap(requirements?)` | Pre-flight check for project/deploy/services config and required env keys. |
|
|
158
|
-
| `registerCustomRoute(handler)` / `getCustomRoutes()` / `clearCustomRoutes()` | Global custom-route registry composed by `bootstrapLuckyStack`. |
|
|
159
|
-
| Hook payload types: `OnSocketConnectPayload`, `OnSocketDisconnectPayload`, `PreRoomJoinPayload`, `PostRoomJoinPayload`, `PreRoomLeavePayload`, `PostRoomLeavePayload`, `OnLocationUpdatePayload` | For socket-lifecycle hook handlers. |
|
|
160
|
-
| Types: `CreateLuckyStackServerOptions`, `BootstrapLuckyStackOptions`, `BootstrapRequirements`, `RunningLuckyStackServer`, `RouteContext`, `StaticFileHandler`, `FaviconHandler`, `CustomRouteHandler` | Handler typing. |
|
|
161
|
-
|
|
162
|
-
## Dependencies
|
|
163
|
-
|
|
164
|
-
- Runtime: `@luckystack/api`, `@luckystack/core`, `@luckystack/login`, `@luckystack/presence`, `@luckystack/sync`
|
|
165
|
-
- Peer (canonical ranges, standardized 2026-05-07):
|
|
166
|
-
- `@prisma/client@^6.19.0` (transitively required via `@luckystack/core`)
|
|
167
|
-
- `socket.io@^4.8.0`
|
|
168
|
-
- Optional peer: `@luckystack/error-tracking`, `@luckystack/email`, `@luckystack/docs-ui` — bootstrap auto-detects them but does not require them.
|
|
169
|
-
|
|
170
|
-
## Selecting bundles + port at runtime
|
|
171
|
-
|
|
172
|
-
`@luckystack/server/parseArgv` is a side-effect-only entrypoint. Import it as the **first line** of your `server.ts` so positional CLI args are parsed before any module that reads `process.env.SERVER_PORT` at load time (notably your project's `config.ts`).
|
|
173
|
-
|
|
174
|
-
```ts
|
|
175
|
-
// server.ts
|
|
176
|
-
import '@luckystack/server/parseArgv';
|
|
177
|
-
// ...rest of your bootstrap
|
|
178
|
-
```
|
|
179
|
-
|
|
180
|
-
Argv shape: `<bundle[,bundle...]> [port]`
|
|
181
|
-
|
|
182
|
-
```bash
|
|
183
|
-
npm run server # default preset, port 80
|
|
184
|
-
npm run server -- billing # one bundle, port 80
|
|
185
|
-
npm run server -- billing,vehicles 4001 # merge bundles, listen on 4001
|
|
186
|
-
```
|
|
187
|
-
|
|
188
|
-
When multiple presets are passed, the framework loads each preset's generated route map and shallow-merges `apis` / `syncs` / `functions`. Key collisions across presets throw at boot (services must own exactly one preset).
|
|
189
|
-
|
|
190
|
-
## Related architecture docs
|
|
191
|
-
|
|
192
|
-
- [`docs/ARCHITECTURE_PACKAGING.md`](../../docs/ARCHITECTURE_PACKAGING.md) — package split, multi-service builds, preset bundles.
|
|
193
|
-
- [`docs/ARCHITECTURE_SOCKET.md`](../../docs/ARCHITECTURE_SOCKET.md) — Socket.io setup, Redis adapter, room model.
|
|
194
|
-
- [`docs/HOSTING.md`](../../docs/HOSTING.md) — multi-instance deployment, `@luckystack/router`, health probes.
|
|
195
|
-
|
|
196
|
-
## License
|
|
197
|
-
|
|
198
|
-
MIT — see [LICENSE](../../LICENSE).
|
|
1
|
+
# @luckystack/server
|
|
2
|
+
|
|
3
|
+
> One-call server bootstrap for [LuckyStack](https://github.com/ItsLucky23/LuckyStack-v2). HTTP + Socket.io + framework routes (`/api/*`, `/sync/*`, `/_health`, `/_test/reset`, `/auth/*`, `/uploads/*`) wired together. Your `server.ts` shrinks to ~20 lines.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @luckystack/server @luckystack/core @luckystack/api @luckystack/login @luckystack/sync @luckystack/presence socket.io
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quickstart — recommended (`bootstrapLuckyStack`)
|
|
12
|
+
|
|
13
|
+
`bootstrapLuckyStack` is a thin wrapper around `createLuckyStackServer` that auto-imports your `luckystack/<pkg>/*.ts` overlay files in topological order before listening, so registries (DI, hooks, providers) are populated by the time the HTTP server boots. This is what `create-luckystack-app` scaffolds.
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import 'dotenv/config';
|
|
17
|
+
import '../config'; // your registerProjectConfig(...)
|
|
18
|
+
import '../deploy.config'; // your registerDeployConfig(...)
|
|
19
|
+
import '../services.config'; // your registerServicesConfig(...)
|
|
20
|
+
|
|
21
|
+
import { bootstrapLuckyStack } from '@luckystack/server';
|
|
22
|
+
import { serveFile, serveFavicon } from './prod/serveFile';
|
|
23
|
+
|
|
24
|
+
const server = await bootstrapLuckyStack({
|
|
25
|
+
serveFile,
|
|
26
|
+
serveFavicon,
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
await server.listen();
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
The bootstrap call runs (in order):
|
|
33
|
+
|
|
34
|
+
1. Auto-imports `luckystack/core/*.ts`, `luckystack/deploy/*.ts`, `luckystack/login/*.ts`, `luckystack/sentry/*.ts`, `luckystack/presence/*.ts`, `luckystack/docs-ui/*.ts`, `luckystack/server/*.ts` (topologically sorted, then alphabetically inside each folder).
|
|
35
|
+
2. Hands off to `createLuckyStackServer(options)`.
|
|
36
|
+
|
|
37
|
+
Set `skipOverlayLoad: true` to handle every registration yourself, or `overlayRoot: 'custom-folder'` to load from somewhere other than `./luckystack`.
|
|
38
|
+
|
|
39
|
+
### Pre-flight check — `verifyBootstrap`
|
|
40
|
+
|
|
41
|
+
Call `verifyBootstrap` **after** the overlay loads (or after your manual registrations) and **before** `server.listen()` if you want to fail fast on missing registrations instead of silent runtime crashes:
|
|
42
|
+
|
|
43
|
+
```ts
|
|
44
|
+
import { bootstrapLuckyStack, verifyBootstrap } from '@luckystack/server';
|
|
45
|
+
|
|
46
|
+
const server = await bootstrapLuckyStack({ serveFile, serveFavicon });
|
|
47
|
+
|
|
48
|
+
await verifyBootstrap({
|
|
49
|
+
requireDeployConfig: true, // single-instance deploys can omit this
|
|
50
|
+
requireServicesConfig: true, // only true when the router will run
|
|
51
|
+
requireOAuthProviders: true, // false if you only use credentials login
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
await server.listen();
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
`verifyBootstrap` throws a single descriptive `Error` listing every missing registration. The full check covers:
|
|
58
|
+
|
|
59
|
+
- `ProjectConfig` — always required.
|
|
60
|
+
- `DeployConfig` — when `requireDeployConfig: true`.
|
|
61
|
+
- `ServicesConfig` — when `requireServicesConfig: true`.
|
|
62
|
+
- OAuth providers — when `requireOAuthProviders: true` and only the default `credentials` entry has been registered.
|
|
63
|
+
- `RuntimeMapsProvider` — hard-fails in production; loud-warns in dev because devkit hot-reload normally registers one. Without it, every API/sync request silently resolves to `notFound`.
|
|
64
|
+
- `LocalizedNormalizer` — hard-fails in production; warns in dev. Without it, error responses degrade to `errorCode`-as-message (no i18n).
|
|
65
|
+
|
|
66
|
+
## Lower-level entry — `createLuckyStackServer`
|
|
67
|
+
|
|
68
|
+
Use this directly when you want to control the order of imports yourself or skip the overlay convention:
|
|
69
|
+
|
|
70
|
+
```ts
|
|
71
|
+
import { initializeSentry } from '@luckystack/error-tracking';
|
|
72
|
+
import { registerPresenceHooks } from '@luckystack/presence';
|
|
73
|
+
import { createLuckyStackServer } from '@luckystack/server';
|
|
74
|
+
|
|
75
|
+
initializeSentry();
|
|
76
|
+
registerPresenceHooks();
|
|
77
|
+
|
|
78
|
+
const server = await createLuckyStackServer({
|
|
79
|
+
serveFile,
|
|
80
|
+
serveFavicon,
|
|
81
|
+
});
|
|
82
|
+
await server.listen();
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Both entries handle devkit hot reload + console init in dev mode automatically — opt out with `enableDevTools: false` if you have your own.
|
|
86
|
+
|
|
87
|
+
## Options
|
|
88
|
+
|
|
89
|
+
```ts
|
|
90
|
+
interface CreateLuckyStackServerOptions {
|
|
91
|
+
port?: number | string; // default: process.env.SERVER_PORT ?? 80
|
|
92
|
+
ip?: string; // default: process.env.SERVER_IP ?? '127.0.0.1'
|
|
93
|
+
serveFile?: StaticFileHandler; // catch-all for non-framework GETs (Vite output, SPA fallback)
|
|
94
|
+
serveFavicon?: FaviconHandler; // /favicon.ico
|
|
95
|
+
customRoutes?: CustomRouteHandler; // pre-fallback hook; return true to mark handled
|
|
96
|
+
enableDevTools?: boolean; // default: NODE_ENV !== 'production'
|
|
97
|
+
maxHttpBufferSize?: number; // default: 5 MB
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
`customRoutes` runs before the static file serving, so you can add project-specific HTTP endpoints (webhooks, OG image generation, etc.) without forking the package. Return `true` if you ended the response.
|
|
102
|
+
|
|
103
|
+
You can also register custom routes globally via `registerCustomRoute(handler)` — the bootstrap call composes every registered handler into the running server. This is what `@luckystack/docs-ui` uses to mount `/_docs`.
|
|
104
|
+
|
|
105
|
+
```ts
|
|
106
|
+
import { registerCustomRoute } from '@luckystack/server';
|
|
107
|
+
|
|
108
|
+
registerCustomRoute(async (req, res) => {
|
|
109
|
+
if (req.url !== '/healthz') return false;
|
|
110
|
+
res.statusCode = 200;
|
|
111
|
+
res.end('ok');
|
|
112
|
+
return true;
|
|
113
|
+
});
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## What it wires
|
|
117
|
+
|
|
118
|
+
- **HTTP server** with CORS + security headers, OPTIONS preflight, method validation, cookie sliding, CSRF middleware.
|
|
119
|
+
- **Socket.io server** attached to the HTTP server, with optional Redis adapter when configured in deploy config.
|
|
120
|
+
- **Framework routes:** `/_health`, `/livez`, `/readyz`, `/_test/reset` (dev/test only), `/api/*` and `/sync/*` (with SSE streaming), `/auth/api`, `/auth/callback/*`, `/uploads/*`, `/assets/*`, `/csrf-token`.
|
|
121
|
+
- **Presence broadcasting** (when enabled in project config): connect / disconnect / reconnect, location updates, peer notifications.
|
|
122
|
+
- **Boot UUID** written on startup so the load-balancer (`@luckystack/router`) can detect rolling restarts.
|
|
123
|
+
- **Dev tools** in non-production: devkit hot reload, console initializer.
|
|
124
|
+
|
|
125
|
+
### HTTP route handler layout
|
|
126
|
+
|
|
127
|
+
`handleHttpRequest` is now a thin (~190-line) orchestrator that sets up CORS / origin / security headers, runs the CSRF middleware, then dispatches a route-handler table. Each handler matches its own route path and returns `boolean` (handled or not). The handlers live in `packages/server/src/httpRoutes/`:
|
|
128
|
+
|
|
129
|
+
| File | Routes |
|
|
130
|
+
| --- | --- |
|
|
131
|
+
| `csrfMiddleware.ts` + `csrfRoute.ts` | CSRF guard on writes + `GET /csrf-token` |
|
|
132
|
+
| `healthRoutes.ts` | `/livez`, `/readyz`, `/_health` |
|
|
133
|
+
| `testResetRoute.ts` | `/_test/reset` (dev/test only — see Security below) |
|
|
134
|
+
| `faviconRoute.ts` | `/favicon.ico` |
|
|
135
|
+
| `uploadsRoute.ts` | `/uploads/*` (avatar serving via `serveAvatar`) |
|
|
136
|
+
| `authApiRoute.ts` | `/auth/api/*` |
|
|
137
|
+
| `authCallbackRoute.ts` | `/auth/callback/*` |
|
|
138
|
+
| `apiRoute.ts` | `/api/*` (delegates to `@luckystack/api`'s `handleHttpApiRequest`) |
|
|
139
|
+
| `syncRoute.ts` | `/sync/*` (delegates to `@luckystack/sync`'s `handleHttpSyncRequest`) |
|
|
140
|
+
| `customRoutes.ts` | Calls every handler registered via `registerCustomRoute(...)` and the inline `customRoutes` option |
|
|
141
|
+
| `staticRoutes.ts` | Final fallback to the consumer's `serveFile(...)` (Vite SPA, etc.) |
|
|
142
|
+
|
|
143
|
+
Top-level `handleHttpRequest` + `dispatchRoutes(handlers, ctx)` are the only orchestration; everything else is a flat list of single-purpose handlers. SSE handling, error fall-through, and dispatch order are preserved.
|
|
144
|
+
|
|
145
|
+
### Security defaults that may surprise you
|
|
146
|
+
|
|
147
|
+
- **CORS fail-closed.** If neither `Origin` nor `Referer` is present, only read-only methods (GET, HEAD, OPTIONS) are allowed; state-changing methods are rejected with 403. Earlier builds fell back to `Host`, which silently bypassed CORS for non-browser callers (`curl`, server-to-server). When you `curl` a write endpoint, set `-H 'Origin: https://your-allowed-origin'`.
|
|
148
|
+
- **`/_test/reset` is fail-closed.** It requires both `NODE_ENV` to be exactly `development` or `test` AND a non-empty `TEST_RESET_TOKEN` env var. Any other state returns 403 (no silent allow-list). Wire `TEST_RESET_TOKEN` in your dev/test `.env.local` and pass it as the `x-test-reset-token: ${TOKEN}` header on the reset call. `@luckystack/test-runner`'s `resetServerState` reads the same env var.
|
|
149
|
+
- **CSRF middleware.** Writes to `/api/*` and `/sync/*` require an `x-csrf-token` header that matches the value minted on the session record (mirrored via `GET /auth/csrf`). The `apiRequest` helper in `@luckystack/core/client` attaches it automatically. Rejections dispatch the `csrfMismatch` hook before returning 403; the payload contains presence-only token info, never the value. The header name, token length, and cookie options are customisable via `registerCsrfConfig({ headerName, tokenLength, cookieOptions })` from `@luckystack/core` — see `packages/core/docs/csrf-config.md`.
|
|
150
|
+
|
|
151
|
+
## Public API
|
|
152
|
+
|
|
153
|
+
| Export | Purpose |
|
|
154
|
+
| --- | --- |
|
|
155
|
+
| `bootstrapLuckyStack(options)` | High-level entry: verifies config, auto-imports overlay, then calls `createLuckyStackServer`. |
|
|
156
|
+
| `createLuckyStackServer(options)` | Lower-level factory that returns `{ httpServer, ioServer, listen }`. |
|
|
157
|
+
| `verifyBootstrap(requirements?)` | Pre-flight check for project/deploy/services config and required env keys. |
|
|
158
|
+
| `registerCustomRoute(handler)` / `getCustomRoutes()` / `clearCustomRoutes()` | Global custom-route registry composed by `bootstrapLuckyStack`. |
|
|
159
|
+
| Hook payload types: `OnSocketConnectPayload`, `OnSocketDisconnectPayload`, `PreRoomJoinPayload`, `PostRoomJoinPayload`, `PreRoomLeavePayload`, `PostRoomLeavePayload`, `OnLocationUpdatePayload` | For socket-lifecycle hook handlers. |
|
|
160
|
+
| Types: `CreateLuckyStackServerOptions`, `BootstrapLuckyStackOptions`, `BootstrapRequirements`, `RunningLuckyStackServer`, `RouteContext`, `StaticFileHandler`, `FaviconHandler`, `CustomRouteHandler` | Handler typing. |
|
|
161
|
+
|
|
162
|
+
## Dependencies
|
|
163
|
+
|
|
164
|
+
- Runtime: `@luckystack/api`, `@luckystack/core`, `@luckystack/login`, `@luckystack/presence`, `@luckystack/sync`
|
|
165
|
+
- Peer (canonical ranges, standardized 2026-05-07):
|
|
166
|
+
- `@prisma/client@^6.19.0` (transitively required via `@luckystack/core`)
|
|
167
|
+
- `socket.io@^4.8.0`
|
|
168
|
+
- Optional peer: `@luckystack/error-tracking`, `@luckystack/email`, `@luckystack/docs-ui` — bootstrap auto-detects them but does not require them.
|
|
169
|
+
|
|
170
|
+
## Selecting bundles + port at runtime
|
|
171
|
+
|
|
172
|
+
`@luckystack/server/parseArgv` is a side-effect-only entrypoint. Import it as the **first line** of your `server.ts` so positional CLI args are parsed before any module that reads `process.env.SERVER_PORT` at load time (notably your project's `config.ts`).
|
|
173
|
+
|
|
174
|
+
```ts
|
|
175
|
+
// server.ts
|
|
176
|
+
import '@luckystack/server/parseArgv';
|
|
177
|
+
// ...rest of your bootstrap
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
Argv shape: `<bundle[,bundle...]> [port]`
|
|
181
|
+
|
|
182
|
+
```bash
|
|
183
|
+
npm run server # default preset, port 80
|
|
184
|
+
npm run server -- billing # one bundle, port 80
|
|
185
|
+
npm run server -- billing,vehicles 4001 # merge bundles, listen on 4001
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
When multiple presets are passed, the framework loads each preset's generated route map and shallow-merges `apis` / `syncs` / `functions`. Key collisions across presets throw at boot (services must own exactly one preset).
|
|
189
|
+
|
|
190
|
+
## Related architecture docs
|
|
191
|
+
|
|
192
|
+
- [`docs/ARCHITECTURE_PACKAGING.md`](../../docs/ARCHITECTURE_PACKAGING.md) — package split, multi-service builds, preset bundles.
|
|
193
|
+
- [`docs/ARCHITECTURE_SOCKET.md`](../../docs/ARCHITECTURE_SOCKET.md) — Socket.io setup, Redis adapter, room model.
|
|
194
|
+
- [`docs/HOSTING.md`](../../docs/HOSTING.md) — multi-instance deployment, `@luckystack/router`, health probes.
|
|
195
|
+
|
|
196
|
+
## License
|
|
197
|
+
|
|
198
|
+
MIT — see [LICENSE](../../LICENSE).
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// src/argv.ts
|
|
2
|
+
var parsedBundles = [];
|
|
3
|
+
var parsedPort = null;
|
|
4
|
+
var hasRun = false;
|
|
5
|
+
var PORT_PATTERN = /^\d+$/;
|
|
6
|
+
var parseServerArgv = (argv) => {
|
|
7
|
+
if (argv.length > 2) {
|
|
8
|
+
throw new Error(
|
|
9
|
+
`[luckystack:argv] unexpected positional argument(s): "${argv.slice(2).join(" ")}". Usage: npm run server -- <bundle[,bundle...]> [port]`
|
|
10
|
+
);
|
|
11
|
+
}
|
|
12
|
+
const bundles = argv[0] && argv[0].length > 0 ? [...new Set(argv[0].split(",").map((s) => s.trim()).filter(Boolean))] : [];
|
|
13
|
+
let port = null;
|
|
14
|
+
const portArg = argv[1];
|
|
15
|
+
if (portArg !== void 0) {
|
|
16
|
+
if (!PORT_PATTERN.test(portArg)) {
|
|
17
|
+
throw new Error(
|
|
18
|
+
`[luckystack:argv] port argument must be numeric, got: "${portArg}". Usage: npm run server -- <bundle[,bundle...]> [port]`
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
port = Number.parseInt(portArg, 10);
|
|
22
|
+
}
|
|
23
|
+
return { bundles, port };
|
|
24
|
+
};
|
|
25
|
+
var applyServerArgv = () => {
|
|
26
|
+
if (hasRun) return;
|
|
27
|
+
hasRun = true;
|
|
28
|
+
const result = parseServerArgv(process.argv.slice(2));
|
|
29
|
+
parsedBundles = result.bundles;
|
|
30
|
+
parsedPort = result.port;
|
|
31
|
+
if (parsedPort !== null) {
|
|
32
|
+
process.env.SERVER_PORT = String(parsedPort);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
var getParsedBundles = () => parsedBundles;
|
|
36
|
+
var getParsedPort = () => parsedPort;
|
|
37
|
+
|
|
38
|
+
export {
|
|
39
|
+
parseServerArgv,
|
|
40
|
+
applyServerArgv,
|
|
41
|
+
getParsedBundles,
|
|
42
|
+
getParsedPort
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=chunk-X3OSC5W3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/argv.ts"],"sourcesContent":["//? Positional argv parser for the LuckyStack server boot. Replaces\n//? `LUCKYSTACK_BUNDLE` + `SERVER_PORT` env-var reads with a single shape:\n//?\n//? npm run server -- billing,vehicles 4001\n//?\n//? Arg 0 = comma-separated preset list (runtime maps merged across them).\n//? Arg 1 = listen port (numeric).\n//?\n//? `applyServerArgv()` is called by the side-effect module\n//? `@luckystack/server/parseArgv`, which consumers import as the FIRST line\n//? of their `server.ts` so the parsed port lands in `process.env.SERVER_PORT`\n//? before `config.ts` (top-level `backendUrl` const) is evaluated.\n\nexport interface ParsedServerArgv {\n bundles: string[];\n port: number | null;\n}\n\nlet parsedBundles: string[] = [];\nlet parsedPort: number | null = null;\nlet hasRun = false;\n\nconst PORT_PATTERN = /^\\d+$/;\n\nexport const parseServerArgv = (argv: string[]): ParsedServerArgv => {\n if (argv.length > 2) {\n throw new Error(\n `[luckystack:argv] unexpected positional argument(s): \"${argv.slice(2).join(' ')}\". ` +\n `Usage: npm run server -- <bundle[,bundle...]> [port]`,\n );\n }\n\n const bundles = argv[0] && argv[0].length > 0\n ? [...new Set(argv[0].split(',').map((s) => s.trim()).filter(Boolean))]\n : [];\n\n let port: number | null = null;\n const portArg = argv[1];\n if (portArg !== undefined) {\n if (!PORT_PATTERN.test(portArg)) {\n throw new Error(\n `[luckystack:argv] port argument must be numeric, got: \"${portArg}\". ` +\n `Usage: npm run server -- <bundle[,bundle...]> [port]`,\n );\n }\n port = Number.parseInt(portArg, 10);\n }\n\n return { bundles, port };\n};\n\nexport const applyServerArgv = (): void => {\n if (hasRun) return;\n hasRun = true;\n\n const result = parseServerArgv(process.argv.slice(2));\n parsedBundles = result.bundles;\n parsedPort = result.port;\n\n //? Writeback so the downstream env-readers (`core/env.ts` Zod schema,\n //? `core/bindAddress.ts` fallback, consumer `config.ts` backendUrl,\n //? `oauthProviders.ts` callback URL) see the resolved port without us\n //? having to refactor those four call sites. This is a deliberate\n //? implementation detail — argv is the public source of truth.\n if (parsedPort !== null) {\n process.env.SERVER_PORT = String(parsedPort);\n }\n};\n\nexport const getParsedBundles = (): string[] => parsedBundles;\nexport const getParsedPort = (): number | null => parsedPort;\n"],"mappings":";AAkBA,IAAI,gBAA0B,CAAC;AAC/B,IAAI,aAA4B;AAChC,IAAI,SAAS;AAEb,IAAM,eAAe;AAEd,IAAM,kBAAkB,CAAC,SAAqC;AACnE,MAAI,KAAK,SAAS,GAAG;AACnB,UAAM,IAAI;AAAA,MACR,yDAAyD,KAAK,MAAM,CAAC,EAAE,KAAK,GAAG,CAAC;AAAA,IAElF;AAAA,EACF;AAEA,QAAM,UAAU,KAAK,CAAC,KAAK,KAAK,CAAC,EAAE,SAAS,IACxC,CAAC,GAAG,IAAI,IAAI,KAAK,CAAC,EAAE,MAAM,GAAG,EAAE,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,OAAO,CAAC,CAAC,IACpE,CAAC;AAEL,MAAI,OAAsB;AAC1B,QAAM,UAAU,KAAK,CAAC;AACtB,MAAI,YAAY,QAAW;AACzB,QAAI,CAAC,aAAa,KAAK,OAAO,GAAG;AAC/B,YAAM,IAAI;AAAA,QACR,0DAA0D,OAAO;AAAA,MAEnE;AAAA,IACF;AACA,WAAO,OAAO,SAAS,SAAS,EAAE;AAAA,EACpC;AAEA,SAAO,EAAE,SAAS,KAAK;AACzB;AAEO,IAAM,kBAAkB,MAAY;AACzC,MAAI,OAAQ;AACZ,WAAS;AAET,QAAM,SAAS,gBAAgB,QAAQ,KAAK,MAAM,CAAC,CAAC;AACpD,kBAAgB,OAAO;AACvB,eAAa,OAAO;AAOpB,MAAI,eAAe,MAAM;AACvB,YAAQ,IAAI,cAAc,OAAO,UAAU;AAAA,EAC7C;AACF;AAEO,IAAM,mBAAmB,MAAgB;AACzC,IAAM,gBAAgB,MAAqB;","names":[]}
|
package/dist/index.d.ts
CHANGED
|
@@ -134,6 +134,21 @@ interface CreateLuckyStackServerOptions {
|
|
|
134
134
|
*/
|
|
135
135
|
runtimeMapsPreset?: string | string[];
|
|
136
136
|
}
|
|
137
|
+
interface StopLuckyStackServerOptions {
|
|
138
|
+
/**
|
|
139
|
+
* Why the server is stopping — threaded into the `preServerStop` hook payload.
|
|
140
|
+
* Defaults to `'manual'` for a programmatic `stop()`; the signal handlers pass
|
|
141
|
+
* the received signal name.
|
|
142
|
+
*/
|
|
143
|
+
reason?: 'SIGTERM' | 'SIGINT' | 'SIGHUP' | 'manual';
|
|
144
|
+
/**
|
|
145
|
+
* Soft budget (ms) for the whole shutdown sequence — the `preServerStop` hook
|
|
146
|
+
* fan-out, the bounded `flushErrorTrackers()` race, and closing the
|
|
147
|
+
* http/io/redis-adapter handles. Each step is wrapped so a single hanging step
|
|
148
|
+
* cannot stall the others past this deadline. Defaults to `10000`.
|
|
149
|
+
*/
|
|
150
|
+
timeoutMs?: number;
|
|
151
|
+
}
|
|
137
152
|
interface RunningLuckyStackServer {
|
|
138
153
|
httpServer: Server;
|
|
139
154
|
ioServer: Server$1;
|
|
@@ -142,46 +157,20 @@ interface RunningLuckyStackServer {
|
|
|
142
157
|
* URL on success.
|
|
143
158
|
*/
|
|
144
159
|
listen: (callback?: () => void) => Promise<Server>;
|
|
160
|
+
/**
|
|
161
|
+
* Graceful shutdown (MIS-016). Stops accepting new connections, dispatches the
|
|
162
|
+
* core `preServerStop` hook, flushes error-trackers (bounded by a timeout
|
|
163
|
+
* race), and closes the Socket.io server, the HTTP server, and the
|
|
164
|
+
* Redis-adapter pub/sub clients. Every step is isolated + time-bounded so one
|
|
165
|
+
* failing/hanging step cannot hang the whole shutdown. Idempotent — a second
|
|
166
|
+
* call returns the in-flight shutdown promise. Resolves once shutdown
|
|
167
|
+
* completes (or the timeout forces it to finish).
|
|
168
|
+
*/
|
|
169
|
+
stop: (options?: StopLuckyStackServerOptions) => Promise<void>;
|
|
170
|
+
/** Alias of {@link stop} matching the `net.Server`-style `close({ timeoutMs })` API. */
|
|
171
|
+
close: (options?: StopLuckyStackServerOptions) => Promise<void>;
|
|
145
172
|
}
|
|
146
173
|
|
|
147
|
-
/**
|
|
148
|
-
* One-call server bootstrap for a LuckyStack project.
|
|
149
|
-
*
|
|
150
|
-
* Wires together:
|
|
151
|
-
* - HTTP server with framework routes (`/api/*`, `/sync/*`, `/_health`,
|
|
152
|
-
* `/_test/reset`, `/uploads/*`, `/auth/api`, `/auth/callback`)
|
|
153
|
-
* - Socket.io server with the Redis adapter, room handlers, presence
|
|
154
|
-
* integration, location sync
|
|
155
|
-
* - Boot-UUID write so the router's handshake can verify topology
|
|
156
|
-
* - Optional dev-mode tooling (devkit hot reload + REPL)
|
|
157
|
-
*
|
|
158
|
-
* Project responsibilities (passed in as options):
|
|
159
|
-
* - `serveFile` / `serveFavicon` — your project's static file handlers
|
|
160
|
-
* - `customRoutes` — any additional HTTP routes your app needs
|
|
161
|
-
*
|
|
162
|
-
* Pre-conditions:
|
|
163
|
-
* - `registerProjectConfig(...)` must have run (side-effect import of your
|
|
164
|
-
* `config.ts` does this).
|
|
165
|
-
* - `registerDeployConfig(...)` must have run (side-effect import of your
|
|
166
|
-
* `deploy.config.ts`).
|
|
167
|
-
* - `registerRuntimeMapsProvider(...)` must have run (side-effect import of
|
|
168
|
-
* your `server/prod/runtimeMaps.ts`).
|
|
169
|
-
* - `registerLocalizedNormalizer(...)` must have run (side-effect import of
|
|
170
|
-
* your `server/utils/responseNormalizer.ts`).
|
|
171
|
-
*
|
|
172
|
-
* @example
|
|
173
|
-
* ```ts
|
|
174
|
-
* import './config';
|
|
175
|
-
* import './deploy.config';
|
|
176
|
-
* import './prod/runtimeMaps';
|
|
177
|
-
* import './utils/responseNormalizer';
|
|
178
|
-
* import { createLuckyStackServer } from '@luckystack/server';
|
|
179
|
-
* import { serveFile, serveFavicon } from './prod/serveFile';
|
|
180
|
-
*
|
|
181
|
-
* const server = await createLuckyStackServer({ serveFile, serveFavicon });
|
|
182
|
-
* await server.listen();
|
|
183
|
-
* ```
|
|
184
|
-
*/
|
|
185
174
|
declare const createLuckyStackServer: (options?: CreateLuckyStackServerOptions) => Promise<RunningLuckyStackServer>;
|
|
186
175
|
|
|
187
176
|
interface BootstrapLuckyStackOptions extends CreateLuckyStackServerOptions {
|
|
@@ -218,13 +207,27 @@ interface BootstrapRequirements {
|
|
|
218
207
|
}
|
|
219
208
|
declare const verifyBootstrap: (requirements?: BootstrapRequirements) => Promise<void>;
|
|
220
209
|
|
|
210
|
+
type RuntimeMapRecord = Record<string, unknown>;
|
|
211
|
+
/**
|
|
212
|
+
* The shape that the generated maps module must export. `scripts/generateServerRequests.ts`
|
|
213
|
+
* emits exactly this shape: `{ apis, syncs, functions }` where each value is a
|
|
214
|
+
* `Record<string, Handler>`. Consumers can import this type to validate their
|
|
215
|
+
* generated file in CI or type-check the `loadGenerated` callback return.
|
|
216
|
+
*/
|
|
217
|
+
interface GeneratedRuntimeMapsModule {
|
|
218
|
+
apis: RuntimeMapRecord;
|
|
219
|
+
syncs: RuntimeMapRecord;
|
|
220
|
+
functions: RuntimeMapRecord;
|
|
221
|
+
}
|
|
221
222
|
interface ProdRuntimeMapsLoaderOptions {
|
|
222
223
|
/**
|
|
223
224
|
* Dynamic-import callback for the generated maps module of a given preset.
|
|
224
225
|
* Called once per preset per process lifetime; the result is cached.
|
|
225
226
|
*
|
|
226
227
|
* The resolved module must have shape `{ apis, syncs, functions }` (the
|
|
227
|
-
* shape `scripts/generateServerRequests.ts` emits
|
|
228
|
+
* shape `scripts/generateServerRequests.ts` emits — see
|
|
229
|
+
* {@link GeneratedRuntimeMapsModule}). A mis-shaped module logs a warning
|
|
230
|
+
* and results in every route for that preset returning `notFound`.
|
|
228
231
|
*
|
|
229
232
|
* Pass a function that calls `import()` with a path relative to YOUR
|
|
230
233
|
* server-side module — the framework cannot resolve a relative path on
|
|
@@ -289,4 +292,4 @@ declare const registerSecurityHeaders: (builder: SecurityHeadersBuilder | null)
|
|
|
289
292
|
/** Read the active builder (or null). */
|
|
290
293
|
declare const getSecurityHeadersBuilder: () => SecurityHeadersBuilder | null;
|
|
291
294
|
|
|
292
|
-
export { type BootstrapLuckyStackOptions, type BootstrapRequirements, type CreateLuckyStackServerOptions, type CustomRouteHandler, type CustomRoutePhase, type FaviconHandler, type OnLocationUpdatePayload, type OnSocketConnectPayload, type OnSocketDisconnectPayload, type OriginExemptMatcher, type ParsedServerArgv, type PostRoomJoinPayload, type PostRoomLeavePayload, type PreRoomJoinPayload, type PreRoomLeavePayload, type ProdRuntimeMapsLoaderOptions, type RegisterCustomRouteOptions, type RouteContext, type RunningLuckyStackServer, type SecurityHeadersBuilder, type StaticFileHandler, applyServerArgv, bootstrapLuckyStack, clearCustomRoutes, clearOriginExemptPaths, createLuckyStackServer, createProdRuntimeMapsProvider, getCustomRoutes, getOriginExemptPaths, getParsedBundles, getParsedPort, getPreParamsCustomRoutes, getSecurityHeadersBuilder, isOriginExemptPath, parseServerArgv, registerCustomRoute, registerOriginExemptPath, registerProdRuntimeMapsProvider, registerSecurityHeaders, verifyBootstrap };
|
|
295
|
+
export { type BootstrapLuckyStackOptions, type BootstrapRequirements, type CreateLuckyStackServerOptions, type CustomRouteHandler, type CustomRoutePhase, type FaviconHandler, type GeneratedRuntimeMapsModule, type OnLocationUpdatePayload, type OnSocketConnectPayload, type OnSocketDisconnectPayload, type OriginExemptMatcher, type ParsedServerArgv, type PostRoomJoinPayload, type PostRoomLeavePayload, type PreRoomJoinPayload, type PreRoomLeavePayload, type ProdRuntimeMapsLoaderOptions, type RegisterCustomRouteOptions, type RouteContext, type RunningLuckyStackServer, type SecurityHeadersBuilder, type StaticFileHandler, type StopLuckyStackServerOptions, applyServerArgv, bootstrapLuckyStack, clearCustomRoutes, clearOriginExemptPaths, createLuckyStackServer, createProdRuntimeMapsProvider, getCustomRoutes, getOriginExemptPaths, getParsedBundles, getParsedPort, getPreParamsCustomRoutes, getSecurityHeadersBuilder, isOriginExemptPath, parseServerArgv, registerCustomRoute, registerOriginExemptPath, registerProdRuntimeMapsProvider, registerSecurityHeaders, verifyBootstrap };
|