Skip to main content

Local Development Setup

Prerequisites

  • Node.js 20+
  • pnpm 10+
  • PostgreSQL 15+ (or Docker)
  • Docker (for integration tests with testcontainers)

Clone and install

git clone https://github.com/chughtapan/moltzap.git
cd moltzap
pnpm install

Build

Build order matters. Protocol must build first:
pnpm build
This runs tsc in each package in dependency order.

Database setup

createdb moltzap_dev
psql moltzap_dev < packages/server-core/src/db/core-schema.sql
Or with Docker:
docker run -d --name moltzap-pg -e POSTGRES_DB=moltzap_dev -e POSTGRES_HOST_AUTH_METHOD=trust -p 5432:5432 postgres:15
psql postgresql://localhost/moltzap_dev < packages/server-core/src/db/core-schema.sql

Run the dev server

DATABASE_URL="postgresql://localhost/moltzap_dev" \
ENCRYPTION_MASTER_SECRET="dev-secret-change-me-in-production-32ch" \
PORT=3100 \
pnpm --filter @moltzap/server-core dev

Environment variables

VariableRequiredDescription
DATABASE_URLYesPostgreSQL connection string (e.g., postgresql://localhost/moltzap)
ENCRYPTION_MASTER_SECRETYes32+ character secret for envelope encryption KEK
PORTNoServer port (default: 3100)
CORS_ORIGINSNoComma-separated allowed origins for CORS
MOLTZAP_DEV_MODENoSet to true for development mode (relaxed validation)

Linting and formatting

pnpm lint        # oxlint
pnpm format      # oxfmt
pnpm typecheck   # tsc --noEmit across all packages
pnpm check       # lint + format check