Skip to content

Local Setup

Prerequisites

  • Node.js 22+ (LTS)
  • pnpm 10+ (enabled via corepack: corepack enable)
  • Docker & Docker Compose

That's it. Docker handles PostgreSQL, PostGIS, Redis, and all application services — you don't need to install any of these manually.

Quick Start (macOS / Linux)

bash
# Clone and install
git clone <repo-url>
cd gis-data
cp .env.example .env
pnpm install

# Start everything: Docker services, migrations, admin seed
make start

make start does the following automatically:

  1. Starts all Docker containers (PostgreSQL + PostGIS, Redis, API, frontend, admin, workers, docs)
  2. Waits for PostgreSQL to be healthy
  3. Runs database migrations
  4. Seeds default admin users

Once it completes, services are available at:

Default users created by the seed:

  • Superadmin: superadmin@gis-data.work / Super@dmin2026!
  • Admin: admin@gis-data.work / Adm1n@2026!

Quick Start (Windows)

Windows doesn't include make by default. You have two options:

Install make via one of these package managers, then use the same make start command as above:

With Chocolatey:

powershell
choco install make

With Scoop:

powershell
scoop install make

With winget:

powershell
winget install GnuWin32.Make

After installing, restart your terminal and use make start, make dev, etc. as normal.

Option B: Run commands manually (PowerShell)

If you prefer not to install make, run the equivalent commands directly:

powershell
# Clone and install
git clone <repo-url>
cd gis-data
Copy-Item .env.example .env
pnpm install

# Start Docker services
docker compose up -d

# Wait for PostgreSQL to be ready
Write-Host "Waiting for postgres..."
do { Start-Sleep -Seconds 1 } while (-not (docker compose exec postgres pg_isready -U gis -d gis_data 2>$null))
Write-Host "Postgres is ready."

# Run migrations and seed
$env:DB_PORT = "5434"; pnpm migration:run
cd api
$env:DB_PORT = "5434"; pnpm seed:admin
cd ..

Other common commands for Windows (without Make):

Make commandPowerShell equivalent
make startSee above
make restartdocker compose down; then run the start commands above
make devStart-Process pnpm -ArgumentList "dev:frontend"; pnpm dev:api
make lintpnpm lint
make formatpnpm format
make testcd api; pnpm test
make docker-updocker compose up -d
make docker-downdocker compose down
make docker-logsdocker compose logs -f

WSL (Windows Subsystem for Linux)

If you use WSL, you can follow the macOS / Linux instructions directly. WSL provides a full Linux environment with make available out of the box. Make sure Docker Desktop is configured to use the WSL 2 backend.

Makefile Commands

The Makefile provides shortcuts for common tasks. Run make help to see all available commands.

CommandDescription
make startStart Docker + migrations + seed (full setup)
make restartStop everything and start fresh
make devStart frontend + API in parallel (local, no Docker)
make dev-frontendStart Vite dev server (:8000)
make dev-apiStart NestJS in watch mode (:8001)
make buildBuild all packages
make lintLint all packages
make formatFormat all packages
make testRun all API tests (unit + e2e)
make test-frontendRun frontend tests
make storybookStart Storybook on :6006
make docker-upStart Docker containers
make docker-downStop Docker containers
make docker-logsFollow Docker logs
make docker-rebuildRebuild and restart all containers
make migrate-runRun pending migrations
make migrate-revertRevert last migration
make seed-adminSeed admin users
make cleanRemove build artifacts and node_modules

Environment Variables

Copy .env.example to .env before starting. The defaults work out of the box with Docker.

API & microservices (.env at project root)

VariableDefaultDescription
DB_HOSTlocalhostPostgreSQL host
DB_PORT5434PostgreSQL port (Docker maps 5434:5432)
DB_USERNAMEgisDatabase user
DB_PASSWORDgis_secretDatabase password
DB_DATABASEgis_dataDatabase name
API_PORT8001API server port
REDIS_HOSTlocalhostRedis host
REDIS_PORT6379Redis port (Docker maps 6380:6379)

Optional:

VariableDefaultDescription
DATABASE_URLFull connection string (overrides individual DB_* vars)
DB_SSLfalseEnable SSL for database connection
REDIS_PASSWORDRedis password (used in Railway/production)
JWT_SECRETchange-me-in-productionJWT signing secret (HMAC)
JWT_EXPIRES_IN4hJWT token expiration
LOGIN_THROTTLE_LIMIT5Login attempts per minute (per IP)
THROTTLE_LIMIT30Default rate limit (requests / THROTTLE_TTL)
THROTTLE_TTL60000Throttle window in ms
RESEND_API_KEYResend API key for transactional email
RESEND_FROMSender email address (e.g. GIS Data <noreply@gis-data.work>)
FRONTEND_URLhttp://localhost:8000Used to build password-reset and invite links in emails
TILESERV_DB_PASSWORDtileserv_secretPassword for the SELECT-only tileserv Postgres role created/updated in migration 17. Read by both pg_tileserv and the migration.

Frontend & admin (root .env, VITE_* vars)

VariableDescription
VITE_MAPBOX_ACCESS_TOKENMapbox access token (public token is fine for web)
VITE_MAPBOX_STYLEMapbox style URL (optional; defaults to mapbox://styles/mapbox/streets-v12)
VITE_PUBLIC_APP_URLPublic app URL (used in cookie policy / legal pages)
API_URLVite proxy target for /api (default http://localhost:8001)
TILESERV_URLVite proxy target for /tiles (default http://localhost:7800; Docker uses http://tileserv:7800)

The frontend and admin Vite configs set envDir: '..', so only VITE_* variables from the root .env are exposed to the browser. API_URL and TILESERV_URL are consumed by the dev-server proxy, not the browser.

Manual Setup (without Docker)

If you prefer running services directly on your machine instead of Docker, you'll need to install and configure the following yourself:

  • PostgreSQL 16 with PostGIS 3.4 extension
  • Redis 7+

1. Set Up PostgreSQL

Create a database with PostGIS:

sql
CREATE DATABASE gis_data;
\c gis_data
CREATE EXTENSION IF NOT EXISTS postgis;
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";

For tests, create a separate database:

sql
CREATE DATABASE gis_data_test;
\c gis_data_test
CREATE EXTENSION IF NOT EXISTS postgis;
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";

2. Configure Environment

bash
cp .env.example .env

Update the DB_* and REDIS_* variables to match your local installations.

3. Run Migrations & Seed

bash
pnpm migration:run
pnpm seed:admin

4. Start Development Servers

bash
# Start API (port 8001)
pnpm dev:api

# Start Frontend (port 8000) — in a separate terminal
pnpm dev:frontend

# Start Admin (port 8002) — in a separate terminal
pnpm dev:admin

Or use the Makefile shortcut:

bash
make dev  # Starts frontend + API in parallel

pnpm Commands Reference

These commands work on all platforms regardless of make availability.

Root Commands

CommandDescription
pnpm dev:frontendVite dev server on :8000
pnpm dev:apiNestJS watch mode on :8001
pnpm dev:adminAdmin dev server on :8002
pnpm dev:helpUser docs dev server
pnpm dev:docsDev docs dev server
pnpm buildBuild all packages
pnpm lintLint all packages
pnpm formatFormat all packages
pnpm storybookStorybook on :6006

Docker Commands

CommandDescription
pnpm docker:upStart all containers
pnpm docker:downStop all containers
pnpm docker:logsFollow all container logs
pnpm docker:removeRemove containers, volumes, and images

Database Commands

CommandDescription
pnpm migration:runRun pending migrations
pnpm migration:generateGenerate migration from entity changes
pnpm migration:revertRollback last migration
pnpm seed:adminCreate default admin/superadmin users
pnpm backfillSeed historical data

Per-Package Commands (run from frontend/ or api/)

CommandDescription
pnpm lint:fixAuto-fix lint issues
pnpm format:checkCheck formatting
pnpm tsc-checkType-check (frontend only)
pnpm testRun all tests
pnpm test:unitUnit tests only
pnpm test:e2eE2E tests only

Pre-commit Hooks

Husky runs automatically on every commit:

  1. lint-staged — lints changed .ts and .vue files, builds API if API files changed
  2. Frontend type-check — runs vue-tsc --noEmit

If a commit fails, fix the reported issues before committing again. Do not use --no-verify to bypass hooks.