# Project Structure and Organization

> Understand the current monorepo layout, route tree, and key config locations.

*Canonical: https://makerkit.dev/docs/nextjs-drizzle/project-structure/overview*

---

The Next.js Drizzle SaaS Kit is organized as a pnpm + Turborepo monorepo.

## Top-Level Layout

```text
apps/                 # runnable apps
packages/             # shared packages
tooling/              # shared tooling and MCP server
turbo/                # code generators
docs/                 # documentation
```

## Apps

```text
apps/
├── web/              # main Next.js app
├── e2e/              # Playwright test app
└── dev-tool/         # internal dev utilities app
```

### `apps/web`

Key locations:

```text
apps/web/
├── app/
│   ├── [locale]/
│   │   ├── (internal)/
│   │   ├── (invitation)/
│   │   ├── (public)/
│   │   ├── admin/
│   │   ├── auth/
│   │   └── help/
│   └── api/
├── components/
├── config/
├── content/
├── i18n/
├── lib/
├── public/
└── styles/
```

Notes:

- app config files live in `apps/web/config/`
- internal sidebar config lives in `apps/web/app/[locale]/(internal)/_config/`
- Drizzle config does **not** live in `apps/web`; it lives in `packages/database/drizzle.config.mjs`

## Routing

The filesystem is organized under `app/[locale]/...`.

Main route groups:

- `(public)` - marketing pages
- `(internal)` - authenticated app pages
- `(invitation)` - invitation acceptance flow
- `auth` - sign-in, sign-up, password reset request, MFA verification
- `admin` - admin pages
- `help` - documentation/help pages

Localized URLs are handled by the i18n middleware and routing config. Keep filesystem path examples separate from runtime URL examples.

## Naming Conventions

- page components: `page.tsx`
- layouts: `layout.tsx`
- loaders: `*-page.loader.ts`
- server actions: `*-server-actions.ts`
- schemas: `*.schema.ts`
- components: `kebab-case.tsx`

## Package Layout

Most packages expose from `src/index.ts` and define additional exports in `package.json`.

Use `pnpm turbo gen package` if you need a new shared package.

---

**Next:** [Packages →](./package-architecture)
