ADR-003-b — Frontend Production Stack
ADR-003-b — Frontend Production Stack
Sección titulada «ADR-003-b — Frontend Production Stack»Accepted
Context
Sección titulada «Context»The Angular frontend (CSR) is deployed on AWS Amplify. Being a SPA, Amplify must redirect all routes to index.html.
Decision
Sección titulada «Decision»The frontend is hosted on AWS Amplify with a provider-agnostic auth interceptor. Amplify builds automatically from the main branch using npx ng build --configuration production, outputs to dist/frontend/browser, and serves all SPA routes via a rewrite rule to index.html. Environment variables are injected via the Amplify Console — none are stored in the repository. Auth is provider-agnostic; details are decided in [[adr-008-authentication|ADR-008]].
| Component | Decision |
|---|---|
| Hosting | AWS Amplify — automatic build from main branch |
| Build command | bun run build (local) / npx ng build --configuration production (Amplify) |
| Output directory | dist/frontend/browser |
| SPA routing | Rewrite rule: `</^[^.]+$ |
| Auth | Provider-agnostic — see [[adr-008-authentication |
| Environment variables | AMPLIFY_* in Console, not in the repository |
The MVP must respect two Amplify constraints from day one. environment.prod.ts does not hardcode URLs — it uses variables injected by Amplify. The auth interceptor is JWT provider-agnostic — it handles httpOnly cookies regardless of the issuer; auth details are decided in [[adr-008-authentication|ADR-008]].
Consequences
Sección titulada «Consequences»- The rewrite rule is mandatory; without it, any refresh on a route other than
/returns 404. - Cognito issues standard JWT tokens — the Angular interceptor does not change between dev and prod.