Route Groups support front/back-end separation and don't break 404 handling #74486
danedwardsdeveloper
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Goals
Non-Goals
Background
Firstly, I love using Next.js. I'm convinced it's the best way to make a website that has ever existed and can't see that changing any time soon.
I would however, like to organise my code a little better. I have been using a workaround for about a week that I thought was working beautifully:
This was until I discovered that the
(front-end)
route group prevents thenot-found
handling from working properly. You get<html>
tags missing errors.Without these folders however, I find it confusing to find my files. The
/api
folder is fundamentally different from any of the other folders within/app
, so I think it's confusing being there. Also if you have an/admin
page folder or pretty much anything beginning witha
then your/api
folder will be in the middle of all your pages.Second, I would like to bundle all the top-level files such as /layout, /not-found, /error, /loading etc. together. I would use
/(home)
as I can't think of anything better, but I know that's not quite right. If you're working a lot with the/app
folder open, then these files take up a lot of space in the file explorer even though (I personally) tend to set and forget these.Proposal
Here's my dream file structure. I'm not too fussed about the names, but separating front- and back-ends would be lovely, as would bundling all the routing files.
Or this even more radical version:
I would love to contribute but I'm not sure I have the skills as I only know TypeScript.
Many thanks for reading this, and thank you so much for this amazing framework that I use for hours and hours literally every day!
Beta Was this translation helpful? Give feedback.
All reactions