Why File-based Routing Sucks and Why You Should Use It
summary
Argues that file-based routing has persistent tradeoffs across Next.js and Remix but remains useful for automatic code-splitting. Demonstrates a JS config middle ground using routes.ts that composes existing FS routes, uses relative() to map nested team folders, adds a dev-only components page via process.env.NODE_ENV so it disappears from production builds, applies a prefix(lang?) helper for i18n, and a createCrud util (Rails-inspired) to emit standard CRUD routes — demos refresh and build as expected, showing the approach works.
AI-written summary · about
chapters (10)
- 0:00Introduction to file-based routing
- 1:23Why file-based routing exists
- 3:07Problems with file-based routing
- 6:33File names as an API
- 8:57Introducing config-based routing
- 11:22Composing file-based routes
- 13:48Conditional route inclusion
- 15:35Internationalization example
- 17:22CRUD route generation
- 19:05Why you should use config routing
related talks
17mRouting in React 18 and Beyond
15mRemix Flat Routes – An Evolution in Routing
54mExploring the World of Remix: A Guide to Building Resilient and Performant Web Apps
55mUse the Platform With Framework Agnostic Routing
28mWrite Once, Route Everywhere: File System-based Navigation for Native Apps
28mStop Breaking the Web
27mRouting and new features
26mBuilding Better Websites with Remix
