Skip to content

Generate typed frontend route table from the Phoenix router#15

Merged
andreogle merged 1 commit into
mainfrom
frontend-route-table
Jun 19, 2026
Merged

Generate typed frontend route table from the Phoenix router#15
andreogle merged 1 commit into
mainfrom
frontend-route-table

Conversation

@andreogle

Copy link
Copy Markdown
Owner

Add mix routes.gen, which introspects ElixirReactStarterWeb.Router and writes assets/js/routes.ts — a typed path-builder module that is the frontend counterpart to the server's ~p sigil, so the two can't drift.

  • routes.gen runs in assets.build/assets.deploy and a dev watcher (build/watch-routes.js); routes.gen --check in precommit fails on drift
  • Browser-facing routes only (JSON-only controllers and /dev excluded)
  • Convert all frontend call sites from hardcoded path strings to routes.*()
  • biome ignores js/routes.ts (formatter), matching the other generated files

Add `mix routes.gen`, which introspects ElixirReactStarterWeb.Router and
writes assets/js/routes.ts — a typed path-builder module that is the
frontend counterpart to the server's ~p sigil, so the two can't drift.

- routes.gen runs in assets.build/assets.deploy and a dev watcher
  (build/watch-routes.js); routes.gen --check in precommit fails on drift
- Browser-facing routes only (JSON-only controllers and /dev excluded)
- Convert all frontend call sites from hardcoded path strings to routes.*()
- biome ignores js/routes.ts (formatter), matching the other generated files
@andreogle andreogle self-assigned this Jun 19, 2026
@andreogle andreogle merged commit 41b9b9d into main Jun 19, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant