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 enable is 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:

ServicePort(s)Purpose
PostgreSQL 185432Primary database
Redis 86379Session store and rate-limit counters for better-auth
Mailpit1025 (SMTP), 8025 (UI)Catches all outgoing email — open http://localhost:8025 to read it
MinIO9000 (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:

CommandWhat it does
pnpm devDev server with hot reload
pnpm typechecktsc --noEmit — run before every commit
pnpm lintESLint (flat config, Next.js + TypeScript rules)
pnpm buildProduction build — the final arbiter
pnpm db:generateGenerate a migration from schema changes
pnpm db:migrateApply pending migrations
pnpm auth:schemaRegenerate 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 to minimumReleaseAgeExclude in pnpm-workspace.yaml.
  • Type errors in .next/types — run pnpm dev or pnpm build once; Next.js generates route types during compilation.