Installation
This page covers everything you need to install and run Baan in a Node.js environment. If you prefer containers, see Deploy with Docker.
System Requirements
Section titled “System Requirements”| Requirement | Minimum | Notes |
|---|---|---|
| Node.js | 24.0.0 | Check with node -v |
| npm | 10.0.0 | Check with npm -v |
| Disk space | ~500 MB | Includes node_modules |
| RAM | 512 MB | 1 GB+ recommended for builds |
| OS | Linux, macOS, Windows (WSL2) | Native Windows not tested |
Step 1 — Clone the Repository
Section titled “Step 1 — Clone the Repository”git clone https://github.com/baan-press/baancd baanStep 2 — Install Dependencies
Section titled “Step 2 — Install Dependencies”npm installStep 3 — Configure Environment Variables
Section titled “Step 3 — Configure Environment Variables”Baan uses two principles for configuration:
- Secrets (API keys, credentials) → stored in
.env/ environment variables - Settings (site title, theme, language) → stored in the database, managed via the admin panel
Create a .env.local file in the project root:
Minimum (local filesystem, self-hosted)
Section titled “Minimum (local filesystem, self-hosted)”No storage environment variables needed — the setup wizard configures the provider and stores it in the database.
Full Reference
Section titled “Full Reference”# ── Storage ──────────────────────────────────────────────# The provider type is configured via the setup wizard (saved to DB). Add only the credentials for your provider.
# Google Cloud StorageGOOGLE_CLOUD_PROJECT_ID=your-project-idGCS_BUCKET_NAME=your-bucket-nameGOOGLE_CLOUD_CREDENTIALS_BASE64=base64-encoded-service-account-json
# Amazon S3AWS_REGION=ap-northeast-1AWS_S3_BUCKET_NAME=your-bucket-nameAWS_ACCESS_KEY_ID=your-access-keyAWS_SECRET_ACCESS_KEY=your-secret-key
# Cloudflare R2CF_ACCOUNT_ID=your-cloudflare-account-idCF_R2_BUCKET_NAME=your-bucket-nameCF_R2_ACCESS_KEY_ID=your-access-keyCF_R2_SECRET_ACCESS_KEY=your-secret-key
# ── AI (optional) ────────────────────────────────────────ANTHROPIC_API_KEY=sk-ant-...OPENAI_API_KEY=sk-...GEMINI_API_KEY=AI...
# ── Database (serverless / Turso only) ───────────────────DATABASE_URL=libsql://your-db.turso.ioDATABASE_AUTH_TOKEN=...The admin URL path and user accounts are not env vars — the setup wizard writes them directly to data/app.db (self-hosted) or your Turso database (serverless).
Step 4 — Run the Setup Wizard
Section titled “Step 4 — Run the Setup Wizard”Start the development server:
npm run devBefore Next.js starts, two pre-build scripts run automatically:
generate-theme-manifest— scansthemes/and registers available themes inlib/generated/theme-manifest.jsonprebuild-site-settings— reads settings from the database and writeslib/generated/site-settings.jsonfor fast access at runtime
Once you see ✓ Ready, open your browser at:
http://localhost:3000/baan-admin/setupThe default port is 3000. To use a different port, set the PORT environment variable:
PORT=3001 npm run devThe 4-step wizard creates the database schema, your admin user, and the secret admin URL. All values are saved directly to data/app.db — no .env.local editing required after setup. The wizard redirects you straight to the login page when done.
Step 5 — Production Build
Section titled “Step 5 — Production Build”npm run buildnpm startThe build runs the same pre-build scripts, then compiles the Next.js app. Watch for any errors — a successful build is required before deployment.
Updating Baan
Section titled “Updating Baan”git pullnpm install # picks up any new or updated dependenciesnpm run buildnpm start # or restart your PM2 / systemd processDatabase migrations run automatically on the first database access after an update — no manual migration step is needed. Migrations are idempotent and check the actual database state directly before applying changes.
Useful Commands
Section titled “Useful Commands”npm run dev # Development server with hot reloadnpm run build # Production buildnpm run start # Start production servernpm run clean # Remove build cache (.next)npm test # Run all unit tests (Vitest)npm run test:security # Security-focused testsnpm run test:e2e # End-to-end tests (Playwright)To fully reset the project to a clean state (removes the database, build cache, and dependencies):
rm -rf .next .next-test node_modules data .test-outputnpm installAfter this, run npm run dev and complete the setup wizard at /baan-admin/setup.