feat(apps): bootstrap, env, i18n, providers, error pages and session proxy
- env validated with the env lib (NEXT_PUBLIC_API_ORIGIN, API_INTERNAL_ORIGIN,
site URL, support config); .env.example per app
- client bootstrap: API base under /v1, one shared session refresh, error
mapping; server bootstrap: cookie forwarding for server renders
- i18n instance for the server, bound to react-i18next on the client
- root layout, AppProviders, global-error, not-found and a page boundary in
every route group; instrumentation reports uncaught server errors
- proxy.ts refreshes an expired session before rendering
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 17:33:07 +00:00
|
|
|
/** Every gateway route except `/files/*` sits under this prefix. */
|
|
|
|
|
export const API_VERSION_PATH = '/v1';
|
2026-10-06 17:47:18 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Where the browser reaches the API: this site's own origin, under this path. next.config.ts
|
|
|
|
|
* rewrites it to the gateway (`API_INTERNAL_ORIGIN`), so no browser request is cross-origin and
|
|
|
|
|
* the session cookies belong to this site (0018). The server render calls the gateway directly.
|
|
|
|
|
*/
|
|
|
|
|
export const API_PROXY_PATH = '/api';
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* How long the `/api` proxy waits for the gateway. Next.js stops at 30 seconds by default; an
|
|
|
|
|
* upload (two 5 MB ID images, post media) on a slow connection takes longer, and the HTTP lib
|
|
|
|
|
* sets no timeout for uploads.
|
|
|
|
|
*/
|
|
|
|
|
export const API_PROXY_TIMEOUT_MS = 120_000;
|