Next.js Discord

Discord Forum

Project Structure - Best Practices?

Unanswered
neurotech posted this in #help-forum
Open in Discord
Is it best practice to have my components sub-directory in app, as in, the same place as my routes? (i.e. apples, bananas)

.
├── app
│   ├── apples
│   │   └── add
│   │       └── page.tsx
│   ├── bananas
│   │   ├── list
│   │   │   └── page.tsx
│   │   └── new
│   │       └── page.tsx
│   ├── components
│   │   ├── header.tsx
│   │   ├── separator.tsx
│   │   └── sidebar.tsx
│   ├── favicon.ico
│   ├── globals.css
│   ├── layout.tsx
│   └── page.tsx
├── biome.json
├── components.json
├── LICENSE
├── next.config.ts
├── next-env.d.ts
├── package.json
├── package-lock.json
├── pnpm-lock.yaml
├── postcss.config.mjs
├── README.md
└── tsconfig.json

1 Reply

Chum salmon
I do that, yes. The reason being when yyou install component libraries and add components (like in shadecn iirc), it usually goes to root/components. So I create my personal custom components in app/
Not sure what others do though