Next.js Discord

Discord Forum

Project Structure Recommendations?

Answered
Cuban Crocodile posted this in #help-forum
Open in Discord
Cuban CrocodileOP
We are working on big project and we have multiple user types. Each user have different dashboard with unique features (there is some common things though for example layout and few components etc)

What would be the best way to organise the folder structure and best way to do routing for this keeping in mind that we have a small team of 8 people.

Currently, what we did is create a group route for each user role and kept components in app folder.

src
app
(role1)
dashboard
_components
sidebar
somesection
(role2)
dashboard
components
Button
Index.tsx
Storybook story
Table

I think i will end up with routing issues as there is no way i can have same /dashboard url for different user roles?

I even thought of doing Micro frontends for each role and keeping our atoms at root. Not sure how to do microfrontend in nextjs also.

Any suggestions are welcome! Fyi, this project is so close to me so thats why i wanna do best i can do at this stage of the project.

TIA
Answered by aardani
this is how i would do it.

1. reusable components goes in /src, same as /app
2. components thats specific to a page, can go inside a route
3. i usually separate client components on its own file
View full answer

5 Replies

Cuban CrocodileOP
I hope someone can help.
this is how i would do it.

1. reusable components goes in /src, same as /app
2. components thats specific to a page, can go inside a route
3. i usually separate client components on its own file
Answer
i dont think this is not a crucial problem as you can always reorganize later. I want to emphasize that the project structure should fits whats best according to you and your team
I think i will end up with routing issues as there is no way i can have same /dashboard url for different user roles?
yes, you can have same /dashboard url for different user roles.

One way to do them is to handle the page layout conditionally in /dashboard
Cuban CrocodileOP
thank you buddy for your help! Take care