Skip to main content

Development Environment Setup

How to set up a Merlon development environment. Two paths are covered: a DevContainer (recommended) and a local install.

With VS Code, the Dev Containers extension, and Docker, the whole toolchain is set up for you automatically.

  1. Open the repository in VS Code.
  2. Open the command palette (F1) and run Dev Containers: Reopen in Container.
  3. The first build takes a few minutes while the image is built. Once it's done, Go and Node.js are available, along with psql (the PostgreSQL client), gh (GitHub CLI), claude (Claude Code CLI), codex (OpenAI Codex CLI), and wrangler (Cloudflare CLI).

See .devcontainer/devcontainer.json and .devcontainer/Dockerfile for the configuration.

Option 2: Local environment

If you're not using the DevContainer, install the following tools yourself.

Go 1.25+

# Get it from https://go.dev/dl/, or via your package manager
go version # confirm go1.25 or higher

Node.js 20+ / npm

# Get the LTS release from https://nodejs.org/, or use nvm
node --version # v20 or higher
npm --version

PostgreSQL 16+

Running it via Docker is recommended.

docker run -d --name merlon-db \
-e POSTGRES_USER=merlon \
-e POSTGRES_PASSWORD=merlon \
-e POSTGRES_DB=merlon \
-p 5432:5432 \
postgres:16

First-time setup

# 1. Environment variables
cp .env.example .env

# 2. Fetch dependencies
cd api && go mod download && cd ..
cd ui && npm install && cd ..

# 3. Run DB migrations
make migrate

# 5. Load demo data (optional)
make seed

Make targets

TargetDescription
make buildBuild the Go API and UI
make testRun Go and UI tests
make lintRun all linters
make fmtFormat all code (Go, UI)
make migrateApply DB migrations with a checksum ledger using MERLON_MIGRATION_DATABASE_URL
make seedStart the full docker-compose topology with demo data (MERLON_SEED=true docker compose up --build)
make dev-up / make dev-downStart/stop the development topology (docker-compose.yml + docker-compose.dev.yml)
make minimal-up / make minimal-downStart/stop the minimal topology (PostgreSQL + API only)
make generate-openapiExport the OpenAPI spec to docs/api/openapi.json

To seed demo data into an already-running PostgreSQL instance instead of starting the whole compose topology, run scripts/seed-demo.sh, which loads deploy/seed/legacy/seed.sql via psql. That file predates the current schema (see deploy/seed/legacy/README.md); prefer MERLON_SEED=true with make seed for a working demo dataset.

See testing.md for more detail.