Local Development
Complete step-by-step guide to running the Nebutra-Sailor monorepo on your local machine — from installing Node.js through seeding the database.
Prerequisites
Make sure the following are installed before you begin:
- Node.js 22+ — nodejs.org or use nvm
- pnpm 11.28.5+ —
npm install -g pnpm - Docker Desktop 24+ — docker.com/products/docker-desktop
- Git 2.40+ — git-scm.com
Step-by-step setup
# With nvm (recommended)
nvm install 22
nvm use 22
# Verify
node --version # v22.x.xnpm install -g pnpm@latest
# Verify
pnpm --version # 11.28.x or highergit clone https://github.com/nebutra/nebutra-sailor.git
cd nebutra-sailorpnpm installThis installs all workspace dependencies across apps and packages. It may take 2–3 minutes on first run.
pnpm infra:upThis runs docker-compose up -d against the root docker-compose.yml, which includes:
- PostgreSQL 16 (pgvector) on port
5432 - Redis 7 on port
6379 - ClickHouse 24 on port
8123
If you only need Postgres and Redis (no ClickHouse), run pnpm infra:lite instead — it uses docker-compose.lite.yml. Note that infra:lite still starts Redis; it only skips ClickHouse.
You don't strictly need any of this to start developing: with no DATABASE_URL set, @nebutra/db falls back to a zero-key PGlite (Postgres 17 in WASM) preview database automatically.
Copy the example files for each app you plan to run:
cp apps/web/.env.example apps/web/.env.local
cp backends/gateway/.env.example backends/gateway/.env.local
cp apps/landing/.env.example apps/landing/.env.localThen open each .env.local and fill in your secrets. See the Environment variables section below for a full reference.
pnpm db:generateThis runs prisma generate using the schema at packages/platform/db/prisma/schema.prisma.
pnpm db:migrateThis applies all pending Prisma migrations to your local PostgreSQL instance.
pnpm db:seedSeeds the database with a test organization, users, and sample data so you can log in immediately.
pnpm devStarts just the three core apps — apps/landing (site, port 3000), apps/web (app, port 3001), and backends/gateway (API, port 3002) — with no keys, no Docker, and no database setup required. Picks free ports automatically if those are taken.
pnpm dev:allStarts every app, Storybook, and the docs site in parallel using Turborepo (turbo run dev --concurrency=64).
pnpm dev:dashboardStarts apps/web, apps/admin, and backends/gateway.
pnpm dev:marketingStarts apps/landing, packages/commerce/blog, and apps/studio.
All apps support Hot Module Replacement (HMR). Changes to source files apply instantly without a full page reload.
Port map
| Service | URL | Notes |
|---|---|---|
| Landing page | http://localhost:3000 | 34 locales (script-split zh-Hans/zh-Hant), default is /en |
| SaaS dashboard | http://localhost:3001 | Requires Better Auth |
| API gateway | http://localhost:3002 | REST API + OpenAPI docs at /doc |
| Sailor docs (this site) | http://localhost:3004 | apps/sailor-docs |
| Internal design docs | http://localhost:3109 | apps/design, internal only |
| Storybook | http://localhost:6006 | Component library |
| Sanity Studio | http://localhost:3333 | Content management |
| PostgreSQL | localhost:5432 | Database |
| Redis | localhost:6379 | Cache and queue |
| ClickHouse | localhost:8123 | Usage metering |
Environment variables
backends/gateway
| Variable | Required | Description |
|---|---|---|
DATABASE_URL | Yes | PostgreSQL connection string, e.g. postgresql://postgres:postgres@localhost:5432/nebutra |
REDIS_URL | Yes | Redis connection string, e.g. redis://localhost:6379 |
AUTH_PROVIDER | No | Auth provider: better-auth (the only real option) or dev (local fallback) |
NEXT_PUBLIC_AUTH_PROVIDER | No | Client-visible auth provider; keep aligned with AUTH_PROVIDER |
CREEM_API_KEY | For Creem checkout | Creem API key — the current card rail (merchant of record) |
CREEM_PRODUCT_ID | For Creem checkout | The one-time Creem product every checkout opens against |
CREEM_WEBHOOK_SECRET | For Creem webhook verification | Signs creem-signature on Creem webhook deliveries |
STRIPE_SECRET_KEY | For subscriptions (legacy) | Stripe secret key |
STRIPE_WEBHOOK_SECRET | For subscriptions (legacy) | Stripe webhook signing secret |
CLICKHOUSE_URL | Yes | ClickHouse HTTP interface URL |
QUEUE_PROVIDER | No | qstash or memory (auto-detected; no self-hosted alternative) |
apps/web
| Variable | Required | Description |
|---|---|---|
AUTH_PROVIDER | No | Auth provider selected for server routes |
NEXT_PUBLIC_AUTH_PROVIDER | No | Auth provider selected for client code and landing One Tap |
BETTER_AUTH_SECRET | For a live auth backend | Self-hosted Better Auth signing secret |
GOOGLE_CLIENT_ID | If using Google OAuth | Google OAuth web client id |
GOOGLE_CLIENT_SECRET | If using Google OAuth | Google OAuth web client secret |
NEXT_PUBLIC_API_URL | Yes | Base URL of the API gateway, e.g. http://localhost:3002 |
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY | For subscriptions (legacy) | Stripe publishable key for client-side billing |
DATABASE_URL | Yes | PostgreSQL connection string (for Server Actions) |
apps/landing
| Variable | Required | Description |
|---|---|---|
NEXT_PUBLIC_SANITY_PROJECT_ID | Yes | Sanity project ID |
NEXT_PUBLIC_SANITY_DATASET | Yes | Sanity dataset name, e.g. production |
NEXT_PUBLIC_AUTH_PROVIDER | No | Auth provider used to choose landing One Tap behavior |
NEXT_PUBLIC_GOOGLE_CLIENT_ID | If Google One Tap is enabled | Public Google OAuth web client id |
SANITY_API_TOKEN | No | Sanity read token (required for draft previews) |
All environment variables are validated by @nebutra/config at startup. If a required variable is missing the process will crash immediately with a descriptive error message — there are no silent failures.
Common first-run issues
"Cannot find module '@prisma/client'"
You need to generate the Prisma client first:
pnpm db:generate"Error: connect ECONNREFUSED 127.0.0.1:5432"
PostgreSQL is not running. Start the infrastructure containers:
pnpm infra:up"Error: connect ECONNREFUSED 127.0.0.1:6379"
Redis is not running. Run pnpm infra:up or pnpm infra:lite — both start Redis; infra:lite only skips ClickHouse.
Port already in use
pnpm dev picks a free port automatically when the default is taken, but for the other dev commands you can free the port yourself:
lsof -ti:3000 | xargs kill # free port 3000 (landing)
lsof -ti:3001 | xargs kill # free port 3001 (web)
lsof -ti:3002 | xargs kill # free port 3002 (gateway)pnpm version mismatch
The repo requires pnpm 11.28.5+. Update:
npm install -g pnpm@latestRunning individual commands
pnpm typecheck # TypeScript check across all packages
pnpm lint # Biome lint
pnpm lint:fix # Biome lint with auto-fix
pnpm test # Vitest unit tests
pnpm test:coverage # Unit tests with coverage report
pnpm test:arch # Architecture boundary tests
pnpm e2e # Playwright E2E (headless)
pnpm e2e:ui # Playwright E2E with interactive UI
pnpm build # Production build (all apps)Related
How is this guide?
Last updated on