Local Development

Source: docs/SYSTEM_OVERVIEW.md § Running locally.

Prerequisites

  • Bun (see Stack)
  • PostgreSQL (Homebrew 18.3 on this machine — Docker path described below)
  • Redis

Note

As of 2026-05-09 the active development machine (MacBook Pro, user shangrilab-1) runs Homebrew PostgreSQL 18.3 on port 5432 with no password. Docker Desktop is not installed. Use the Homebrew path below. The Docker path is preserved for reference.

Setup — Homebrew PostgreSQL (active path)

git clone <repo> && cd DBPOC
bun install
 
# Restore from the team dump (get enrichnodedb.dump from the shared location)
dropdb -U shangrilab-1 enrichnodedb 2>/dev/null || true
createdb -U shangrilab-1 enrichnodedb
pg_restore -U shangrilab-1 -d enrichnodedb --no-owner --no-acl enrichnodedb.dump

No migrations needed — the dump includes the full schema at migration 014.

Setup — Docker (original path, Docker Desktop required)

cp .env.example .env
# fill in vars
 
docker-compose up -d
bun run migrate

docker-compose starts:

  • PostgreSQL on localhost:5433 (user/password/enrichnodedb)
  • Redis on localhost:6379
  • Keycloak on localhost:8080 (admin/admin)

Optional: seed bulk data

bun run src/import/bolagsverket-import.ts data/bolagsverket_bulkfil.txt
bun run src/import/scb-import.ts data/scb_bulkfil.txt

See Bolagsverket Import, SCB Import.

Run

# API server (port 3000)
bun --hot src/api/index.ts
 
# Frontend (port 8080)
cd frontend/enrichnode && bun run dev
 
# Re-ingest procurement notices from TED (last 30 days, no API key needed)
bun run scripts/run-ingest-batch16.ts
 
# tests
bun test

Minimum .env — Homebrew path

KEYCLOAK_DEV_MODE=true
PGHOST=localhost
PGPORT=5432
PGUSER=shangrilab-1
PGPASSWORD=
PGDATABASE=enrichnodedb
REDIS_HOST=localhost
REDIS_PORT=6379
REDIS_PASSWORD=

Minimum .env — Docker path

PGHOST=localhost
PGPORT=5433
PGUSER=user
PGPASSWORD=password
PGDATABASE=enrichnodedb
REDIS_HOST=localhost
REDIS_PORT=6379
REDIS_PASSWORD=devpassword
KEYCLOAK_DEV_MODE=true

For Firecrawl mode also: FIRECRAWL_API_KEY=fc-... and USE_FIRECRAWL=true.

Bun-only conventions

bun <file> (not node/ts-node), bun test (not jest/vitest), bun install (not npm). Bun auto-loads .env. See CLAUDE.md at the repo root for full rules.

See also

Stack, Schema Migrations, Bolagsverket Import, SCB Import, Autoresearch Loop, Firecrawl.