Skip to main content

Local stack & dev setup

The Ghasi-edTech repo (ghasi-EdTech) is a Turborepo + pnpm workspace. Local development uses Docker for PostgreSQL and Keycloak; application services run on the host with pnpm dev.

What runs in Docker today​

ServiceDefault portPurpose
PostgreSQL 165432Shared dev database (schemas per service; see each service migrations folder). Default DB/user in infra/docker-compose.yml: ghasi_identity / ghasi / ghasi.
Keycloak 248081OIDC issuer http://localhost:8081/realms/ghasi (realm imported from infra/keycloak/).

From the repo root (Windows: PowerShell):

pnpm infra:up

Equivalent to docker compose -f infra/docker-compose.yml up -d via scripts/start-infra.ps1. Use pnpm infra:down to stop. Optional: pnpm infra:up:kong for the Kong smoke stack under infra/kong/.

Environment files​

Each service and app with a .env.example expects its own .env for local runs. Generate them from the examples (ports and cross-service URLs filled for local dev):

pnpm env:create

Use pnpm env:create -- --force to overwrite existing .env files. Without pnpm env:create, DATABASE_URL and other variables are missing and database scripts will fail.

Database migrations and seeds​

After Postgres is healthy, apply SQL migrations and seeds for all services (runs one package at a time to avoid connection stampedes):

pnpm db:setup

This is the same as pnpm db:setup:all. You can also run pnpm db:migrate:all or pnpm db:seed:all separately.

Platform-wide contract (additional infra)​

As more runtime pieces land in Compose, the stack is expected to grow toward:

ServicePortPurpose
Redis 76379Cache, rate limit, idempotency replay protection.
NATS JetStream4222Event broker.
OpenSearch9200Lexical search.
MinIO9000S3-compatible object storage.
Mailpit1025 / 8025SMTP capture for verification flows.

Seed personas for demos (when seeds define them) include learner@example.test, instructor@example.test, tenant-admin@example.test, and platform-admin@example.test.

Root package.json scripts (monorepo)​

ScriptWhat it does
pnpm buildturbo run build - production build for all packages that define build.
pnpm devturbo run dev - start dev servers (persistent) across the workspace.
pnpm lintturbo run lint.
pnpm typecheckturbo run typecheck.
pnpm testturbo run test.
pnpm test:integrationturbo run test:integration.
pnpm test:contractturbo run test:contract.
pnpm formatPrettier over ts, tsx, md, json, yml, yaml.
pnpm sync:openapiEmit OpenAPI specs from Nest services into the repo (Postman pipeline).
pnpm sync:postmanGenerate Postman collections from OpenAPI.
pnpm sync:stubsGenerate request/response stubs for tooling.
pnpm sync:envRefresh Postman environment files from local port config.
pnpm sync:allRuns sync:openapi, then sync:env, then sync:stubs, then sync:postman.
pnpm env:createCreate per-package .env from .env.example with local URLs and ports.
pnpm lint:platformLint cross-service / Postman platform invariants.
pnpm validate:openapiValidate OpenAPI artifacts.
pnpm check:driftCheck generated API artifacts for drift vs code.
pnpm kong:surfaceDerive Kong route surface from OpenAPI.
pnpm lint:kongLint Kong declarative config.
pnpm db:migrate:allRun db:migrate in every package (sequential concurrency).
pnpm db:seed:allRun db:seed in every package (sequential concurrency).
pnpm db:generate:allRun db:generate where defined (e.g. ORM clients).
pnpm db:setupRun db:setup everywhere: migrate then seed per service (sequential concurrency). Same as db:setup:all.
pnpm db:setup:allAlias for pnpm db:setup.
pnpm infra:upStart Postgres + Keycloak (PowerShell wrapper; detached).
pnpm infra:up:kongStart Postgres, Keycloak, and optional Kong stack.
pnpm infra:downTear down the infra started by the scripts above.