Skip to content

Platform Bootstrap ​

platform-bootstrap composes common NestJS startup concerns as ordered use* steps while keeping application creation and infrastructure choices visible in the consuming entrypoint.

mermaid
flowchart LR
  App["NestJS application"] --> Builder["PlatformApplication"]
  Builder --> Api["useApi"]
  Api --> Server["useExpressServer"]
  Server --> Security["useSecurity"]
  Security --> Session["useSession"]
  Session --> OpenApi["useOpenApi"]

Process Guard ​

PlatformProcessGuard.install() restores fail-fast semantics for fatal errors and keeps closed standard streams from turning into a logging loop. It is installed once in the entrypoint, before the application is created, and is independent of the step pipeline.

SituationBehavior
Uncaught exceptionReported once, bounded flush of stdout and stderr, exit code 1
Unhandled promise rejectionSame as an uncaught exception by default; 'log' keeps the process alive
Closed stdout or stderrEPIPE and ERR_STREAM_DESTROYED are ignored; the output is discarded
Other stdout or stderr failureFatal
terminate(error, origin)Same fatal path for errors the application catches, such as startup

See the application bootstrap guide for installation and the choice between the rejection modes.

Session Bootstrap ​

useSession() registers express-session from typed Archipel configuration. Applications can set rolling: true to renew the configured cookie maximum age on every handled response. Rolling remains opt-in and does not define which requests count as human activity; that policy belongs to the application.

Configuration keyResponsibility
AUTH_SESSION_SECRETSession cookie signing secret
AUTH_SESSION_SECURESecure-cookie enforcement
AUTH_SESSION_MAX_AGESession cookie maximum age

See the application bootstrap guide for composition order, configuration registration, and rolling-session setup.

Released under the MIT License.