Skip to main content

AEROSIM-TS-14

Project task

Bootstrap the typed Singularity Fastify service

Singularity starts as a production-buildable Fastify service with strict TypeScript and typed request, response, and error boundaries.

AEROSIM-TS-14Canonical ID TASK-0014
Verified flow state
Done
Owner
AeroSim Architecture and Delivery
Component
API Service — Fastify HTTP boundary
Repository
corp-v1-aerosim/corp-v1-aerosim

Delivery scope

Create the Singularity Fastify composition root, parse process configuration once, register JSON-schema serialization and RFC 9457 problem responses, and separate app construction from the listening process for injection tests and clean shutdown. Primary files: applications/api/package.json, applications/api/src/config.ts, applications/api/src/app.ts, applications/api/src/server.ts, applications/api/src/http/problem-details.ts, applications/api/tests/app-bootstrap.test.ts.

Implementation contract

Implementation artifacts

  • applications/api/package.json
  • applications/api/src/config.ts
  • applications/api/src/app.ts
  • applications/api/src/server.ts
  • applications/api/src/http/problem-details.ts
  • applications/api/tests/app-bootstrap.test.ts

Inputs

  • API_HOST, API_PORT, LOG_LEVEL, and DATABASE_URL process variables parsed by ApiConfigSchema
  • Fastify Request objects with JSON content negotiated through route schemas

Outputs

  • buildApp(config) FastifyInstance and startServer(config) listener
  • application/problem+json ErrorResponse containing type, title, status, detail, and requestId

Failure boundaries

  • Abort startup before listen when API_PORT is outside 1..65535, LOG_LEVEL is unknown, or DATABASE_URL is invalid.
  • Map unexpected handler exceptions to status 500 without returning stack traces or environment values.

Excluded scope

  • Business endpoints, Prisma models, Keycloak validation, and Socket.IO events are implemented by later tasks.

Verification steps

  • pnpm --filter @aerosim/api typecheck && pnpm --filter @aerosim/api test -- app-bootstrap.test.ts
  • API_PORT=70000 pnpm --filter @aerosim/api start; assert non-zero exit and no listening socket.

Traceability

Requirements

Dependencies

None

UI/UX applicability

non_visual

This Task owns technical or behavioral acceptance and does not claim direct visual conformance to the approved UI/UX package.

Acceptance evidence

Verified delivery: application PR #12 reviewed head a798eb333aa5008f654ebc7cc242f65105708b43, merged as 7d43415f042123871516df10ecc18cc1c4beb034; final Wave 1 integration head 7d43415f042123871516df10ecc18cc1c4beb034 passed Gitea Actions publish task 1735 and validate task 1736. Release completion verified on product 1.0.0.0 at GitOps revision 5d3712d89dfbf7dacd993348e55f497d126c7bf9 with Argo Synced/Healthy, exact image digests, authenticated API/database access, and three-world configured-flight acceptance.

Current evidence boundary

No current implementation, acceptance, release, or deployment evidence is claimed for this planned Task. Any prior implementation may be used only as prototype and discovery evidence.