lukeed

File system routers are a mistake

A route table is a list: a pattern, a handler, and an order. That is all.

File system routing takes that list and spreads it across a directory tree. Now your URL design is coupled to your folder layout. Renaming a folder changes your public API. Dynamic segments become filenames full of brackets, parentheses, and plus signs that your shell, your editor, and your teammates all have to escape. And you still need ordering rules, so the framework invents precedence logic that you have to learn instead of read.

Put the list in one file. You can grep it, sort it, review it in a single diff, and see every route your app serves without running a build.

Convention is great until it becomes the only place your routes exist.

— lukeed,