remix-flat-routes vs @react-router/fs-routes vs config-based routing #962
Replies: 10 comments 12 replies
-
I vote to keep the same convention I tend to just use regular fs-routes on my stuff (don't care much for folders) but I can do that with remix-flat-routes too, and then I have the lever available if I want it |
Beta Was this translation helpful? Give feedback.
-
Personally I really like the remix-flat-routes because it's flexible enough to be used for simple things and scales up to large codebases as well with reasonable and convention based organization. Here's the problem I have with config-based routing. It makes it so that everybody has a different convention on where to put files, and it also means that any time you want to change a route you also have to change where the file is, or the file system and your route configuration get out of sync. This just means extra homework, and inevitably it means that you will have a file system and a route configuration that is out of sync and it doesn't follow any convention at all, which just breeds a lot of confusion. I understand people's arguments in favor of config-based routing talk about the benefits of not having to have weird characters and file names, and I understand that is useful, but for myself, I have learned to get over the weird characters in the file names in favor of having a single source of truth for both convention and configuration of my routes and files. |
Beta Was this translation helpful? Give feedback.
-
I also vote to keep the same convention—I appreciate the extras remix-flat-routes brings. Personally, I’m not a fan of config-based routes. The route code has to live somewhere anyway. It probably makes more sense for library development, but I wouldn’t enjoy it for web app development. |
Beta Was this translation helpful? Give feedback.
-
I think config is the only way to go for a large app with many teams contributing to many routes and features. First of all, the file based convention is hard to understand and on-board, when you’ve got a mix of senior and junior devs I think you want a convention that is easy to pick up on for juniors and new senior team members alike. Also the large app (at least the one I work on) likely has a fairly stable set of routes that don’t change frequently and has established conventions around where files go. I might also be biased because I have not worked enough in the file conventions to really learn them well and I find them difficult to understand. Whereas code is easy for me to read and follow. That all said I have experienced the pain in a greenfield, smaller app where my routes and file names are changing somewhat regularly of forgetting to update things on the config and having to do that extra step. I guess I prefer that trade-off to having to learn the file conventions. |
Beta Was this translation helpful? Give feedback.
-
As someone new to the stack I like the flat routes and everything I have learned so far. |
Beta Was this translation helpful? Give feedback.
-
I vote for keeping remix flat routes. Easy to understand. Easier to handle than others. Scalable. |
Beta Was this translation helpful? Give feedback.
-
I have been using remix-flat-routes for more than a year, but don't get autocompletion / typesafety from the new It seems that @AlemTuzlak 's stack https://github.com/forge-42/base-stack benefits from it (and it uses He has also just released a PR that improves i18n routes, that is the perfect use-case for this. I therefore consider switching over to fs-routes. But that would mean migrating a lot of route files, unless we can customize the conf to be similar to the Epic-stack's remix-flat-routes. |
Beta Was this translation helpful? Give feedback.
-
I prefer using remix-flat-routes, but I understand why some might opt for a config-based approach. For teams and larger projects, a central config file can provide a more accessible overview of all routes, making it easier to manage as the project scales. As my own project grows, I’ve started to feel some annoyance with the increasing filename bloat in a flat route structure. That said, I still stick with flat routes because I’m used to them, and they work well for my workflow. But if the target is a team or a bigger project, a config-based setup might be the better option. |
Beta Was this translation helpful? Give feedback.
-
The constant (imo unnecessary) changes on remix / react router has been annoying and has pretty much made me leave the RR ecosystem. Both at work and on my spare time. Even if the future flags are good and makes for an easy upgrade path I still don't understand certain moves, just like the router config. It took me more than one hour to port router changes to RR7 for an app I run and it gave me a worse DX in the end. So I am for flat routes. |
Beta Was this translation helpful? Give feedback.
-
We've done two Remix / RR7 apps now. The first used flat routes, which was fine. But in the second we started with flat routes and then decided to switch to config-based routing. Although the flat routes is fairly easy to follow once you're used to the conventions, it does strongly couple the routing structure to the directory structure. So if we decide to change the routing, it means changes to filenames and directories. If the changes are significant enough, that ripples through quite a bit. With config-based routing, that's relatively independent and the structure can be reworked and the changes confined only to Don't know about other folks' applications, but we find it's a challenge to nail down the routing / info architecture right out of the gate if we're doing incremental / evolutionary development. Keeping it flexible is more than just a nice-to-have, it's a desirable feature of the way we work. |
Beta Was this translation helpful? Give feedback.
-
I want to hear from users of the Epic Stack.
Do you prefer
remix-flat-routes
(what we use now),@react-router/fs-routes
, or config-based routes?51 votes ·
Beta Was this translation helpful? Give feedback.
All reactions