Skip to main content

When to use this approach

Run services individually from source when you need to:
  • Develop or debug a specific microservice with live reload
  • Step through service code with a debugger
  • Test changes before building a Docker image
  • Run a subset of services while keeping others in Docker
For a full production-equivalent deployment, use Docker Compose instead.

Prerequisites

  • Node.js 18.17.0 or later
  • pnpm (installed globally)
  • NestJS CLI
  • Docker (for running PostgreSQL and NATS)
  • A clone of the repository

Setup

1

Clone the repository and install dependencies

2

Configure environment variables

Open .env and set all required values. At minimum, the following must be configured before any service will connect successfully:
  • DATABASE_URL — PostgreSQL connection string
  • NATS_URL — e.g. nats://0.0.0.0:4222
  • REDIS_HOST and REDIS_PORT
  • All *_NKEY_SEED variables for the services you plan to run
  • PLATFORM_ADMIN_EMAIL
  • CRYPTO_PRIVATE_KEY
  • KEYCLOAK_DOMAIN, KEYCLOAK_REALM, KEYCLOAK_MANAGEMENT_CLIENT_ID, KEYCLOAK_MANAGEMENT_CLIENT_SECRET
3

Start PostgreSQL

Start a local PostgreSQL instance using Docker:
Update DATABASE_URL in .env to match:
4

Start NATS

Pull and run the NATS message broker:
NATS listens on:
  • 4222 — client connections
  • 6222 — cluster routing
  • 8222 — HTTP monitoring
5

Start Redis

Redis listens on 6379.
6

Run Prisma migrations and generate the client

7

Seed initial data

The seed script populates org roles, agent types, ledger configs, platform config, and the platform admin user. It reads master data from prisma/data/credebl-master-table.json.
This is equivalent to running the seed container in the Docker Compose deployment.
8

Start the API gateway

Open a terminal and start the API gateway. Use --watch to enable live reload during development:
The gateway binds to http://0.0.0.0:5000. The Swagger UI is available at http://localhost:5000/api.
9

Start each microservice

Open a separate terminal window for each service. Start them in the order shown below, as later services depend on earlier ones being available on NATS.
The full set of services and their commands:
organization and utility are not listed in the README’s start sequence but are part of the platform. Start utility before connection, and organization before verification and agent-provisioning.

NATS authentication (NKEY seeds)

Each microservice authenticates to NATS using an NKey seed defined in .env. Set a unique seed for each service:
.env
The authentication type is controlled by NATS_AUTH_TYPE in .env. Supported values are nkey, creds, usernamePassword, and none. For local development, nkey is the default.

Accessing endpoints

Once the API gateway and at least the user service are running, navigate to:
The Swagger UI lists all registered routes. Routes provided by microservices that are not yet running will return NATS timeout errors.

Monitoring logs

Each nest start process writes structured logs to stdout. For production-like log aggregation, set the following in .env:
.env
OpenTelemetry tracing is also supported. Enable it with:
.env