Local Development
Local Development
This guide explains how to set up and run applications locally with automatic database setup.
Quick Start
For any project with a backend, use the dev:*:full command:
pnpm dev:chat:full # Start chat with auth + database setuppnpm dev:zitare:full # Start zitare with auth + database setuppnpm dev:contacts:full # Start contacts with auth + database setupThese commands automatically:
- Create the database if it doesn’t exist
- Push the latest schema (Drizzle
db:push) - Start the auth service (mana-core-auth)
- Start the backend and web app with colored output
Available Full Dev Commands
| Command | Database | Backend Port | Web Port |
|---|---|---|---|
pnpm dev:chat:full | chat | 3002 | 5173 |
pnpm dev:zitare:full | zitare | 3007 | 5177 |
pnpm dev:contacts:full | contacts | 3015 | 5184 |
pnpm dev:calendar:full | calendar | 3014 | 5179 |
pnpm dev:clock:full | clock | 3017 | 5187 |
pnpm dev:todo:full | todo | 3018 | 5188 |
pnpm dev:picture:full | picture | 3006 | 5175 |
Prerequisites
Before running any dev:*:full command:
-
Start Docker infrastructure
This starts PostgreSQL, Redis, and MinIO:
Terminal window pnpm docker:up -
Generate environment files
This runs automatically on
pnpm install, but you can run manually:Terminal window pnpm setup:env
Database Setup Commands
Individual Service Setup
pnpm setup:db:auth # Setup mana-core-auth database + schemapnpm setup:db:chat # Setup chat database + schemapnpm setup:db:zitare # Setup zitare database + schemapnpm setup:db:contacts # Setup contacts database + schemapnpm setup:db:calendar # Setup calendar database + schemapnpm setup:db:clock # Setup clock database + schemapnpm setup:db:todo # Setup todo database + schemapnpm setup:db:picture # Setup picture database + schemaSetup All Databases
pnpm setup:db # Creates ALL databases and pushes ALL schemasThis is useful when setting up a fresh environment or after pulling new schema changes.
How It Works
Docker Init Script
On first pnpm docker:up, the PostgreSQL container runs docker/init-db/01-create-databases.sql which creates all databases:
- manacore, chat, zitare, contacts, calendar, clock, todo, manadeck
- storage, mail, moodlit, finance, inventory, techbase, voxel_lava, figgos
Setup Script
The scripts/setup-databases.sh script:
- Creates database if it doesn’t exist (using
psql) - Pushes schema using
drizzle-kit push --force
The --force flag auto-approves schema changes without interactive prompts.
Apps Without Full Commands
Some apps don’t have backends or don’t use Drizzle:
| App | Reason |
|---|---|
| manacore | No backend (uses other services) |
| manadeck | Backend exists but no db:push |
For these, use the regular dev commands:
pnpm dev:manacore:webpnpm dev:manadeck:appTroubleshooting
Database doesn’t exist
If you see database "xxx" does not exist:
pnpm setup:db:chat # or whichever servicePGPASSWORD=devpassword psql -h localhost -U manacore -d postgres -c "CREATE DATABASE chat;"Schema out of date
If you see errors about missing tables/columns:
# Push the latest schemapnpm --filter @chat/backend db:push --forcePort already in use
If auth (port 3001) is already running:
# Check what's using the portlsof -i :3001
# Kill the process if neededkill <PID>Fresh Start (Nuclear Option)
To completely reset all databases:
# Stop and remove all containers + volumespnpm docker:clean
# Start freshpnpm docker:up
# Setup all databasespnpm setup:dbAdding a New Application
Step 1: Create Project Structure
apps/newproject/├── apps/│ ├── backend/ # NestJS API (if needed)│ ├── mobile/ # Expo React Native app│ ├── web/ # SvelteKit web app│ └── landing/ # Astro marketing page├── packages/ # Project-specific shared code├── package.json # Workspace root└── CLAUDE.md # Project documentationStep 2: Configure Backend Database
If your backend uses Drizzle ORM:
-
Add database to Docker init (
docker/init-db/01-create-databases.sql):CREATE DATABASE IF NOT EXISTS newproject;GRANT ALL PRIVILEGES ON DATABASE newproject TO manacore; -
Add DATABASE_URL to
.env.development:NEWPROJECT_DATABASE_URL=postgresql://manacore:devpassword@localhost:5432/newproject -
Update
scripts/generate-env.mjsto generate the backend.envfile.
Step 3: Add Package.json Scripts
Add to root package.json:
{ "scripts": { "dev:newproject:full": "./scripts/setup-databases.sh newproject && ./scripts/setup-databases.sh auth && concurrently \"pnpm dev:auth\" \"pnpm dev:newproject:backend\" \"pnpm dev:newproject:web\"", "setup:db:newproject": "./scripts/setup-databases.sh newproject" }}Step 4: Test
pnpm setup:db:newprojectpnpm dev:newproject:full