Back to Community
about 1 year ago•Tips & Tricks

How I structure my Next.js projects

After building 20+ Next.js apps, here is my folder structure that works best: ``` app/ ├── (auth)/ ├── (dashboard)/ ├── api/ components/ ├── ui/ ├── feature/ lib/ actions/ ``` The key is to group by feature, not by file type. This makes it easy to find and maintain code.

nextjscodestructure
3 Comments

3 Comments

Dao Phommachanhabout 1 year ago

This is super helpful! I have been struggling with my project structure. Going to refactor my current project using this layout.

Maly Xaiyavongabout 1 year ago

I use a similar structure for WordPress projects too. Grouping by feature makes everything so much easier to maintain.

Phet Manivongabout 1 year ago

Love this! For the components folder, do you also separate client and server components?