Discussion on Next Project Structure
Unanswered
Barbary Lion posted this in #help-forum
Barbary LionOP
Make your case for either:
1) src or no src directory
2) Store project files outside of app
3) Store project files inside of app
3) Store project files inside of app top level for global ui, and component level for component specific ui.
Obviously there is no right or wrong approach, but there are different approaches.... Which is unacceptable. (this is a joke)
What is your preferred style and why ?
Tailwinds Templates tend to be:
----src + store project files outside of app
Shad/cn
----no src ( i think ?) + store project files outside of app
Next themselves (via their learning template) tends to be:
----no src + store project files inside of app
Links for ref:
1. https://nextjs.org/docs/app/building-your-application/routing/colocation#src-directory
2.https://nextjs.org/docs/app/building-your-application/routing/colocation#store-project-files-outside-of-app
3.https://nextjs.org/docs/app/building-your-application/routing/colocation#store-project-files-in-top-level-folders-inside-of-app
4.https://nextjs.org/docs/app/building-your-application/routing/colocation#split-project-files-by-feature-or-route
1) src or no src directory
2) Store project files outside of app
3) Store project files inside of app
3) Store project files inside of app top level for global ui, and component level for component specific ui.
Obviously there is no right or wrong approach, but there are different approaches.... Which is unacceptable. (this is a joke)
What is your preferred style and why ?
Tailwinds Templates tend to be:
----src + store project files outside of app
Shad/cn
----no src ( i think ?) + store project files outside of app
Next themselves (via their learning template) tends to be:
----no src + store project files inside of app
Links for ref:
1. https://nextjs.org/docs/app/building-your-application/routing/colocation#src-directory
2.https://nextjs.org/docs/app/building-your-application/routing/colocation#store-project-files-outside-of-app
3.https://nextjs.org/docs/app/building-your-application/routing/colocation#store-project-files-in-top-level-folders-inside-of-app
4.https://nextjs.org/docs/app/building-your-application/routing/colocation#split-project-files-by-feature-or-route
5 Replies
src directory. So that I can store files not relevant inside the nextjs app in the repo too, e.g. static files, scripts, config files. The src dir makes it clear what are source files and what are not.
Store project files outside of app, except utilities and components used once in the same subdirectory.
Store project files outside of app, except utilities and components used once in the same subdirectory.
Barbary LionOP
That does seem to be the most common/standard approach. I wonder why Next chooses No src + store project files inside of app as the default when demonstrating a project in next (which should communicate the 'ideal')
i think it depends a lot on how big the app is. for a small app, having a src doesn't mean much when you have an "inner src" (the app directory)
most demonstrations are usually small apps
it's only in medium-sized projects or larger projects that i notice a non-negligible benefit of
src