Shared packages¶
The platform has five internal packages under packages/. All are consumed by one or more NestJS services via workspace symlinks. Package names are the authoritative identifiers used in import statements.
@sa-platform/common¶
Location: packages/common/
Shared utilities used by every service. Provides crypto wrappers (key-encryption-key helpers, per-patient DEK utilities), standardised error types, an IdService for ULID generation, a RedisModule / RedisService abstraction over ioredis, a CorrelationIdMiddleware, ProblemJsonFilter, and request-context helpers.
Consumed by: all eight services.
@sa-platform/auth-client¶
Location: packages/auth-client/
JWT verification and scope enforcement for services acting as resource servers. Provides an AuthModule (global), AuthGuard, RequireScopes decorator, and JWKS-backed key caching. Services import this module globally in their AppModule so every endpoint is protected by default.
Consumed by: all services that expose authenticated endpoints (clinical-api, consent, human-review, notifications, orchestrator, user-management, ai-review, auth).
@sa-platform/events¶
Location: packages/events/
Typed event-bus client over Redis Streams. Exports typed Zod schemas and string constants for every platform event (CASE_CREATED_EVENT, AI_REVIEW_COMPLETED_EVENT, HUMAN_REVIEW_REQUESTED_EVENT, CONSENT_CHECK_REQUESTED_EVENT, CASE_WORKFLOW_COMPLETED_EVENT, etc.), plus makeEnvelope, publishEvent, readBatch, ensureGroup, and ack helpers for consumer-group fan-out (XADD / XREADGROUP).
Consumed by: clinical-api, orchestrator, consent, human-review, ai-review.
@sa-platform/eslint-config¶
Location: packages/eslint-config/
Shared ESLint configuration preset applied to all services and packages via extends. Ensures a consistent lint rule set across the monorepo and is enforced in CI.
Consumed by: all packages and services (dev dependency).
@sa-platform/tsconfig¶
Location: packages/tsconfig/
Shared TypeScript base configuration (tsconfig.base.json) extended by every service and package tsconfig.json. Enforces strict mode and common compiler options uniformly.
Consumed by: all packages and services (dev dependency).