Welcome to Nebutra Sailor Docs 🎉
ChangelogIntroductionLicensing
Help Center (External) ↗

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.x
npm install -g pnpm@latest

# Verify
pnpm --version   # 11.28.x or higher
git clone https://github.com/nebutra/nebutra-sailor.git
cd nebutra-sailor
pnpm install

This installs all workspace dependencies across apps and packages. It may take 2–3 minutes on first run.

pnpm infra:up

This 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.local

Then open each .env.local and fill in your secrets. See the Environment variables section below for a full reference.

pnpm db:generate

This runs prisma generate using the schema at packages/platform/db/prisma/schema.prisma.

pnpm db:migrate

This applies all pending Prisma migrations to your local PostgreSQL instance.

pnpm db:seed

Seeds the database with a test organization, users, and sample data so you can log in immediately.

pnpm dev

Starts 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:all

Starts every app, Storybook, and the docs site in parallel using Turborepo (turbo run dev --concurrency=64).

pnpm dev:dashboard

Starts apps/web, apps/admin, and backends/gateway.

pnpm dev:marketing

Starts 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

ServiceURLNotes
Landing pagehttp://localhost:300034 locales (script-split zh-Hans/zh-Hant), default is /en
SaaS dashboardhttp://localhost:3001Requires Better Auth
API gatewayhttp://localhost:3002REST API + OpenAPI docs at /doc
Sailor docs (this site)http://localhost:3004apps/sailor-docs
Internal design docshttp://localhost:3109apps/design, internal only
Storybookhttp://localhost:6006Component library
Sanity Studiohttp://localhost:3333Content management
PostgreSQLlocalhost:5432Database
Redislocalhost:6379Cache and queue
ClickHouselocalhost:8123Usage metering

Environment variables

backends/gateway

VariableRequiredDescription
DATABASE_URLYesPostgreSQL connection string, e.g. postgresql://postgres:postgres@localhost:5432/nebutra
REDIS_URLYesRedis connection string, e.g. redis://localhost:6379
AUTH_PROVIDERNoAuth provider: better-auth (the only real option) or dev (local fallback)
NEXT_PUBLIC_AUTH_PROVIDERNoClient-visible auth provider; keep aligned with AUTH_PROVIDER
CREEM_API_KEYFor Creem checkoutCreem API key — the current card rail (merchant of record)
CREEM_PRODUCT_IDFor Creem checkoutThe one-time Creem product every checkout opens against
CREEM_WEBHOOK_SECRETFor Creem webhook verificationSigns creem-signature on Creem webhook deliveries
STRIPE_SECRET_KEYFor subscriptions (legacy)Stripe secret key
STRIPE_WEBHOOK_SECRETFor subscriptions (legacy)Stripe webhook signing secret
CLICKHOUSE_URLYesClickHouse HTTP interface URL
QUEUE_PROVIDERNoqstash or memory (auto-detected; no self-hosted alternative)

apps/web

VariableRequiredDescription
AUTH_PROVIDERNoAuth provider selected for server routes
NEXT_PUBLIC_AUTH_PROVIDERNoAuth provider selected for client code and landing One Tap
BETTER_AUTH_SECRETFor a live auth backendSelf-hosted Better Auth signing secret
GOOGLE_CLIENT_IDIf using Google OAuthGoogle OAuth web client id
GOOGLE_CLIENT_SECRETIf using Google OAuthGoogle OAuth web client secret
NEXT_PUBLIC_API_URLYesBase URL of the API gateway, e.g. http://localhost:3002
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEYFor subscriptions (legacy)Stripe publishable key for client-side billing
DATABASE_URLYesPostgreSQL connection string (for Server Actions)

apps/landing

VariableRequiredDescription
NEXT_PUBLIC_SANITY_PROJECT_IDYesSanity project ID
NEXT_PUBLIC_SANITY_DATASETYesSanity dataset name, e.g. production
NEXT_PUBLIC_AUTH_PROVIDERNoAuth provider used to choose landing One Tap behavior
NEXT_PUBLIC_GOOGLE_CLIENT_IDIf Google One Tap is enabledPublic Google OAuth web client id
SANITY_API_TOKENNoSanity 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@latest

Running 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

Editor Setup

Recommended extensions and formatter configuration.

Project Structure

Directory layout and where to put new code.

How is this guide?

Edit on GitHub

Last updated on

On this page

Prerequisites
Step-by-step setup
Port map
Environment variables
backends/gateway
apps/web
apps/landing
Common first-run issues
"Cannot find module '@prisma/client'"
"Error: connect ECONNREFUSED 127.0.0.1:5432"
"Error: connect ECONNREFUSED 127.0.0.1:6379"
Port already in use
pnpm version mismatch
Running individual commands
Related