server

6 modules

  • server/app_backend.ts

    App backend types and factory — database initialization + auth migrations + deps.

    Provides AppBackend, CreateAppBackendOptions, and create_app_backend().

    Vocabulary: - AppDeps — stateless capabilities: injectable, swappable per environment - *Options — static values set at startup, per-factory configuration - Runtime state — mutable values (e.g., bootstrap_status) — NOT in deps or options

  • server/app_server.ts

    Server assembly factory.

    create_app_server() eliminates the ~100 lines of duplicated server assembly shared by tx, visiones, and mageguild. Consumers provide a pre-initialized AppBackend and options (session, origins, routes); the factory handles middleware, bootstrap status, surface generation, and Hono app assembly.

  • server/env.ts

    Base server environment schema and validation.

    Provides BaseServerEnv — a shared Zod schema for common server env vars that apps can use directly or extend with app-specific fields.

    Generic env loading lives in env/load.ts.

  • server/startup.ts

    Composable startup summary helpers.

    Logs a human-readable summary from an AppSurface.

  • server/static.ts

    Static file serving middleware for SvelteKit static builds.

    Provides multi-phase static serving: - Phase 1: Exact path match (handles /, assets, images) - Phase 2: .html fallback for clean URLs (/about/about.html) - Phase 3 (optional): SPA fallback for client-side routes

  • server/validate_nginx.ts

    String-based nginx config validator for fuz_app deploy configs.

    Checks consumer NGINX_CONFIG template strings for required security properties. This is pattern matching on template strings, not a real nginx parser — it catches common security omissions but won't catch all possible misconfigurations.