Getting Started
Installation
Code
The SDK has runtime dependencies: jose (JWT/OIDC), json-bigint
(BigInt-safe JSON), nats (NATS™ client), redis (optional cache), and
reflect-metadata (cache metadata). These are installed automatically.
Redis (optional)
Redis is NOT required to run Primebrick. If you want to enable the optional
cache layer for hot single-row reads, install Redis and set the redis_url
key in the auth_configurations table. See Cache layer for
details. Without redis_url, the system runs DB-only with no cache.
Redis is also used by the optional presence module (collaboration awareness — who is viewing/editing an entity). Like the cache, presence is best-effort: if Redis is unavailable, the BE wrapper turns presence calls into no-ops and the UI simply shows no other users. See Presence for the contract.
Minimal microservice setup
A Primebrick microservice is a single createMicroservice() call — the SDK
owns env validation (assertDbEnv closed set), DAL init, own-schema
migrations, ConfigLoader, NATS connection, service registration +
heartbeat, the HTTP server (with /health), and graceful shutdown:
Code
Mandatory config_entries keys (seeded via db-meta/patches):
nats_url, service_code, http_port, service_base_url,
be_base_url, service_client_shield_key — createMicroservice
configLoader.requires them at boot and crashes when missing.
Verify the health endpoint
After running the service, verify it is up with a single curl:
Code
Code
If any check fails, the HTTP status is 503 and ok is false — the FE's 503
interceptor probes /health and shows the right health chip. See
HTTP Server for the full HealthResponse shape and how to
register custom checks (db, redis, idp).
Importing sub-modules
The SDK exports everything from the package root:
Code
The Ext-JSON module is also available as a sub-path import (useful when you need only JSON serialization without pulling in the NATS™/auth code paths):
Code
Next steps
- Authentication — configure auth for STANDALONE or GATEWAY-RESOLVED mode
- NATS Client — publish/subscribe patterns
- Service Registration — lifecycle events
- HTTP Server — the unified
/healthresponse shape and custom checks - Cache layer — optional Redis cache for hot single-row reads
- Presence — optional real-time collaboration awareness
- API Reference — full API listing