mirror of
https://github.com/stack-auth/stack.git
synced 2026-06-04 21:04:37 +08:00
Replace the Next.js dev/start runtime with a standalone Elysia app running under Bun. The route file layout (apps/backend/src/app/api/...) is preserved; modules are loaded by a sorted dispatcher so static routes win over dynamic and catch-all. - elysia-app.ts: Elysia app, route loader, @elysia/opentelemetry - elysia-server.ts: Bun listener entrypoint - next-compat.ts: headers/cookies/redirect/nextUrl shims and StackRedirectError so existing route code keeps working - otel-init.ts: NodeTracerProvider + AsyncLocalStorage context manager (Bun doesn't get OTel via Next.js anymore); optional JSONL span exporter gated on STACK_TRACE_LOG_FILE for profiling - proxy.tsx: fetch-compatible CORS preflight, dev rate limit, and API-version rewrite (preserves x-middleware-rewrite header) - smart-request/smart-response/smart-route-handler/redirect-handler: switch NextRequest -> StackNextRequest, normalize array catch-all params at the smart-request boundary, intercept StackRedirectError dev/start scripts now run `bun --watch src/elysia-server.ts` with NODE_ENV=development and BUN_RUNTIME_TRANSPILER_CACHE_PATH=0 (workaround for stale-edit issue with bun's transpiler cache). NODE_ENV is set explicitly because Next used to set it implicitly, and getNodeEnvironment()=="" was breaking the freestyle email renderer's "mock key in production" guard. Drops STACK_ARTIFICIAL_DEVELOPMENT_DELAY_MS to 0 in .env.development; the 500ms artificial delay was masking real perf and made tests unnecessarily slow on the new runtime. Adds perf tooling under scripts/: benchmark.ts, profile-endpoint.ts, profile-test.ts, analyze-endpoint.ts. They use the JSONL span exporter to break down time by span name across many requests. |
||
|---|---|---|
| .. | ||
| backend | ||
| dashboard | ||
| dev-launchpad | ||
| e2e | ||
| hosted-components | ||
| internal-tool | ||
| mock-oauth-server | ||
| oauth-mock-server | ||