feat(frontend): scaffold Angular 21 project with FastAPI SPA serving#33
Merged
feat(frontend): scaffold Angular 21 project with FastAPI SPA serving#33
Conversation
…kets Update ROADMAP.md to reflect current version v2.0.0 with Phases 1 and 2 marked complete. Add 13 sprint tickets for Phase 3 frontend modernization (Angular + PrimeNG): 8 core tickets plus 5 SPIKEs.
Tests verify Angular SPA catch-all route serves index.html for client-side routing, serves static assets, and does not intercept reserved paths (/api/v3, /docs, /v3, /static).
SPIKE-FRONT-001: Node.js v24 available in both environments via shared NVM. Angular commands run on the host — no distrobox needed. Updated CLAUDE.md with Angular dev commands and workflow.
SPIKE-FRONT-002: Added fileReplacements to angular.json production config to swap environment.ts with environment.prod.ts at build time. Verified both production and development builds succeed.
SPIKE-FRONT-003: Created scripts/dev/run_frontend_dev.sh and make frontend-dev target. Starts both FastAPI (port 5000) and Angular dev server (port 4200) with proxy forwarding.
There was a problem hiding this comment.
Pull request overview
This PR introduces an Angular 21 frontend scaffold under frontend/ and wires the existing FastAPI app to serve the built SPA (static assets + index.html fallback) while preserving the current HTMX /v3 pages and /api/v3 endpoints during the migration.
Changes:
- Add an Angular 21 standalone-component project scaffold with ESLint, Prettier, proxy config, and env switching.
- Add FastAPI SPA catch-all serving from
frontend/dist/ledmatrix/browser/with static-file support and client-side-routing fallback. - Add a combined dev workflow (
scripts/dev/run_frontend_dev.sh+make frontend-dev) and update sprint/planning docs.
Reviewed changes
Copilot reviewed 45 out of 48 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
test/test_api_spa_mount.py |
Adds tests for FastAPI SPA catch-all behavior and non-interception of reserved routes. |
src/api/main.py |
Adds SPA serving logic (static asset serving + index.html fallback) to the FastAPI app factory. |
scripts/dev/run_frontend_dev.sh |
Convenience script to run FastAPI + Angular dev server together. |
Makefile |
Adds frontend-dev target to run the combined dev script. |
frontend/angular.json |
Angular workspace config including dev proxy usage and production file replacements. |
frontend/package.json |
Defines Angular dependencies, scripts, and ESLint/Vitest tooling. |
frontend/package-lock.json |
Locks frontend dependency graph for reproducible installs. |
frontend/proxy.conf.json |
Dev proxy to forward /api/v3 and /stream to FastAPI. |
frontend/eslint.config.js |
ESLint flat config with angular-eslint rules. |
frontend/.prettierrc |
Prettier config for consistent formatting. |
frontend/.editorconfig |
EditorConfig for consistent whitespace/quotes. |
frontend/.gitignore |
Ignores node_modules, build outputs, and tooling caches. |
frontend/README.md |
Documents Angular CLI usage for the new frontend project. |
frontend/tsconfig.json |
Base TypeScript compiler configuration for the Angular project. |
frontend/tsconfig.app.json |
App TS config (excludes specs). |
frontend/tsconfig.spec.json |
Spec TS config (includes vitest/globals types). |
frontend/src/main.ts |
Bootstraps the Angular standalone root component. |
frontend/src/index.html |
SPA HTML shell entrypoint. |
frontend/src/styles.scss |
Global SCSS entrypoint. |
frontend/src/environments/environment.ts |
Dev environment config (apiBase). |
frontend/src/environments/environment.prod.ts |
Prod environment config (apiBase). |
frontend/src/app/app.ts |
Root standalone component definition. |
frontend/src/app/app.html |
Root component template (router outlet only). |
frontend/src/app/app.scss |
Root component SCSS (currently empty). |
frontend/src/app/app.routes.ts |
Router config placeholder (currently empty routes). |
frontend/src/app/app.config.ts |
Application providers / router setup. |
frontend/src/app/app.spec.ts |
Angular unit tests scaffold for the root component. |
frontend/public/favicon.ico |
Frontend favicon asset (used by Angular build). |
.claude/CLAUDE.md |
Updates dev workflow docs for Angular commands and combined dev run. |
ROADMAP.md |
Updates roadmap metadata to mark phases complete / current version. |
docs/plans/2026-03-20-angular-project-scaffold.md |
Detailed implementation plan doc for the Angular scaffold + SPA serving. |
sprints/v3.0.0/README.md |
Adds sprint plan and dependency graph for frontend modernization. |
sprints/v3.0.0/FRONT-001-angular-project-scaffold.md |
Ticket doc for Angular scaffold + SPA serving. |
sprints/v3.0.0/SPIKE-FRONT-001-nodejs-in-distrobox.md |
Spike doc for Node availability in distrobox/host. |
sprints/v3.0.0/SPIKE-FRONT-002-angular-environment-switching.md |
Spike doc for Angular env switching approach. |
sprints/v3.0.0/SPIKE-FRONT-003-dev-server-proxy-verification.md |
Spike doc for proxy verification + dev convenience script. |
sprints/v3.0.0/SPIKE-001-angular-unit-test-setup.md |
Future ticket doc for Angular unit test infrastructure. |
sprints/v3.0.0/SPIKE-002-raw-json-editor.md |
Future ticket doc for raw JSON editor feature. |
sprints/v3.0.0/SPIKE-003-operation-history-view.md |
Future ticket doc for store operation history feature. |
sprints/v3.0.0/SPIKE-004-ci-angular-build.md |
Future ticket doc for adding frontend CI job. |
sprints/v3.0.0/SPIKE-005-starlark-config-ui.md |
Future ticket doc for Starlark UI feature. |
sprints/v3.0.0/FRONT-002-primeng-theme-layout.md |
Future ticket doc for PrimeNG + layout shell. |
sprints/v3.0.0/FRONT-003-api-service-layer.md |
Future ticket doc for typed API/SSE service layer. |
sprints/v3.0.0/FRONT-004-dashboard-module.md |
Future ticket doc for dashboard feature module. |
sprints/v3.0.0/FRONT-005-plugins-module.md |
Future ticket doc for plugins feature module. |
sprints/v3.0.0/FRONT-006-settings-module.md |
Future ticket doc for settings feature module. |
sprints/v3.0.0/FRONT-007-logs-store-modules.md |
Future ticket doc for logs/store feature modules. |
sprints/v3.0.0/FRONT-008-htmx-removal-cleanup.md |
Future ticket doc for removing HTMX legacy UI. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Owner
Author
|
@copilot open a new pull request to apply changes based on the comments in this thread |
…ts, and dev script Co-authored-by: Olino3 <119822419+Olino3@users.noreply.github.com> Agent-Logs-Url: https://github.com/Olino3/LEDMatrix/sessions/44266a2b-7656-48a9-a014-187d907fb629
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
frontend/with standalone components, SCSS, routing, and ESLintindex.htmlfor client-side routingproxy.conf.json) routing/api/v3and/streamto FastAPI at port 5000fileReplacementsinangular.json) for dev/prod buildsscripts/dev/run_frontend_dev.shandmake frontend-devto run both servers togetherCLAUDE.mdwith Angular dev commands and conventionsTickets closed
fileReplacements)Key decisions
StaticFilesmount — avoids Starlette mount/route precedence conflictsspa_dist_dircomputed insidecreate_app()— enables test patching viaPROJECT_ROOTTest plan
test/test_api_spa_mount.py— all passingng buildproduces production bundle atfrontend/dist/ledmatrix/browser/index.htmlstart,build,test,lint/v3/, API at/api/v3/, docs at/docsall preserved