User Avatar

Project Structure

StartStack is organized into a series of route groups, with their own layouts. This gives you lots of flexibility in how you design your app. Components are also organized based on their scope in the app. This makes it easy to find the components you need. It also keeps your main component directory from becoming too large and hard to maintain. Services and actions are also clearly defined and organized into their own directories, keeping the code organized and easy to maintain.

This structure is based on experience. I think you'll find that this structure will grow with you as your app evolves. However, you might have your own system that you'd like to use (I'd love to hear your thoughts!). If so, you can easily customize the project structure to fit your needs.

startstack/
├── actions/
│ └── [ server actions ]
├── app/
│ ├── (app)/ [ route group for the app, account, dashboard, etc. ]
│ │ ├── _components/
│ │ │ └── [ components shared across app route grp ]
│ │ └── account/
│ │   └── _components/
│ │     └── [ components scoped to account ]
│ │ └── api/
│ │   └── auth/
│ │     └── [...nextauth]
│ │       └── route.ts [ next-auth route handler ]
│ │   └── webhooks/
│ │     └── stripe/
│ │       └── route.ts [ stripe webhook route handler ]
│ │ └── [ additional routes ]
│ │ └── layout.tsx
│ ├── (auth)/ [ route group for authentication ]
│ │ └── sign-in/
│ │   └── page.tsx
│ │ └── layout.tsx
│ ├── (onboarding)/ [ route group for onboarding, add your custom onboarding routes here ]
│ │ └── sign-up/
│ │   └── page.tsx
│ │ └── layout.tsx
│ ├── (marketing)/ [ route group for the marketing site, home page, etc. ]
│ │ ├── _components/
│ │ │ └── [ components shared across marketing route grp ]
│ │ └── @comingSoon/ [ slot for the coming soon page ]
│ │   └── _components/
│ │   └── page.tsx [ this is the coming soon page that is shown when coming soon mode is true ]
│ │   └── layout.tsx
│ │ └── checkout/
│ │   └── page.tsx
│ │ └── layout.tsx
│ │ └── page.tsx [ this is the home page when coming soon mode is false ]
│ └── robots.ts
│ └── sitemap.ts
├── components/
│ ├── ui/
│ │ └── [ shadcn components ]
│ └── [ components shared globally ]
├── drizzle/
│ └── [ drizzle ORM schema, client, and migrations ]
├── lib/
│ └── [ utils, constants, 3rd party client libs ]
├── public/
│ └── [ static assets ]
├── services/
│ └── [ server side services, this is where the business logic is primarily implemented ]
├── types/
│ └── [ type definitions ]
├── .env
├── [ additional files]