Getting Started
This page takes you from a fresh clone to a running app with a working database, email capture, and object storage — all locally.
Prerequisites
- Node.js 20+ (the repo is developed against Node 24)
- pnpm — the only supported package manager (
corepack enableis the easiest way to get it) - Docker with Compose, for local infrastructure
1. Install dependencies
pnpm install
The workspace uses pnpm's supply-chain policies (minimumReleaseAge) and
an explicit build-script allowlist in pnpm-workspace.yaml. If a new
dependency needs a postinstall script, add it to allowBuilds there —
scripts are denied by default.
2. Start local services
docker-compose up -d
This brings up everything the app talks to:
| Service | Port(s) | Purpose |
|---|---|---|
| PostgreSQL 18 | 5432 | Primary database |
| Redis 8 | 6379 | Session store and rate-limit counters for better-auth |
| Mailpit | 1025 (SMTP), 8025 (UI) | Catches all outgoing email — open http://localhost:8025 to read it |
| MinIO | 9000 (API), 9001 (console) | S3-compatible storage for avatars and organization logos |
A one-shot minio-init container creates the bucket and sets a public
download policy, so uploads work with zero manual setup.
3. Configure the environment
Create a .env file at the repository root. The essentials:
DATABASE_URL=postgres://postgres:postgres@localhost:5432/postgres
REDIS_URL=redis://localhost:6379
BETTER_AUTH_SECRET=generate-a-long-random-string
BETTER_AUTH_URL=http://localhost:3000
Email and storage default to the Docker services (Mailpit on port 1025,
MinIO on port 9000), so in local development you usually do not need to
configure them at all. For production, point the SMTP and S3 variables
used in lib/email.ts and lib/storage.ts at real services, and add
OAuth credentials for any social providers you enable in lib/auth.ts.
4. Set up the database
Migrations are SQL files generated by Drizzle Kit and live in
db/migrations. Apply them:
pnpm db:migrate
To inspect data through a web UI:
pnpm db:studio
5. Run the app
pnpm dev
Open http://localhost:3000. Sign up with any email address — the verification email lands in Mailpit at http://localhost:8025.
Daily workflow
The scripts you will use constantly:
| Command | What it does |
|---|---|
pnpm dev | Dev server with hot reload |
pnpm typecheck | tsc --noEmit — run before every commit |
pnpm lint | ESLint (flat config, Next.js + TypeScript rules) |
pnpm build | Production build — the final arbiter |
pnpm db:generate | Generate a migration from schema changes |
pnpm db:migrate | Apply pending migrations |
pnpm auth:schema | Regenerate db/schema/auth-schema.ts from the better-auth config |
Two workflows deserve special mention because they generate code:
Changing a database schema. Edit the relevant
features/*/schema.ts, then run pnpm db:generate followed by
pnpm db:migrate. Never edit migration files or the database by hand —
the schema files are the source of truth. See Database.
Changing the auth configuration. Edit lib/auth.ts (adding a
plugin, for example), then run pnpm auth:schema to regenerate the auth
tables, then pnpm db:generate and pnpm db:migrate as usual.
db/schema/auth-schema.ts is generated output — never hand-edit it. See
Authentication.
Troubleshooting
- Emails not arriving — they never leave your machine; check the Mailpit UI on port 8025, not your inbox.
ERR_PNPM_MINIMUM_RELEASE_AGE_VIOLATION— a dependency version is younger than the supply-chain policy allows. Either wait, or add a scoped entry tominimumReleaseAgeExcludeinpnpm-workspace.yaml.- Type errors in
.next/types— runpnpm devorpnpm buildonce; Next.js generates route types during compilation.