Shared packages
Reusable infrastructure lives under packages/. Apps depend on these; apps never depend on each other.
| Package | Purpose |
|---|---|
@constellation-platform/auth-core | JWT types, clearance levels, permission checking |
@constellation-platform/auth-next | Next.js auth middleware (withAuth, withTenantAuth, locale primitives) |
@constellation-platform/db | Tenant-scoped Prisma client, RLS helpers, auditAction() for routine audit, correlation-id propagation |
@constellation-platform/design-tokens | The Constellation design language (warm-neutral OKLCH foundation, single amber accent, functional status colours, Geist type) + a Path A bridge aliasing every shadcn variable onto a Constellation token, Tailwind v4 @theme mapping, light/dark palettes, and a11y baseline (prefers-reduced-motion, :focus-visible). CSS-only — import styles.css from each app's globals.css. |
@constellation-platform/errors | Standard error hierarchy and API envelope (AppError, toErrorResponse) |
@constellation-platform/audit | Transactional audit via outbox (auditCritical() — writes audit row + publishes audit.entry.created event in the same txn) |
@constellation-platform/events | Outbox-based event publishing (publish), polling dispatcher, subscribe |
@constellation-platform/jobs | Job queue abstraction (createJobQueue({ type: 'postgres' | 'memory', ... })). Two implementations today: PostgresJobQueue (durable) and InMemoryJobQueue (tests) |
@constellation-platform/storage | Object-storage adapter. S3-compatible (MinIO in dev, S3 in cloud, MinIO on-prem) plus a Supabase Storage backend for Supabase-hosted tenants |
@constellation-platform/i18n | BCP-47 Locale type, resolveLocale(), Intl format helpers |
@constellation-platform/translation | AI-backed translation; wraps ai-core |
@constellation-platform/ai-core | Provider-agnostic LLM abstraction (Claude / mock); audit + budget |
@constellation-platform/ai-embeddings | Embedding-API provider abstraction (OpenAI / mock); pgvector-friendly output |
@constellation-platform/ai-rag | Retrieval-augmented generation primitives — combines ai-core and ai-embeddings for grounded responses |
@constellation-platform/coordinator | Hosted reasoning service — stateless consultCoordinator() over programme-scoped Project Tracker state; persists every consult to coordinator.consults and emits an audit entry via auditCritical. Phase 1: engine only; MCP tool deferred to PLT-171. |
@constellation-platform/testing | Test tenant/user factories, test transaction wrapper |
@constellation/contracts | Shared Zod schemas and derived types (cross-module event payloads, common shapes) |
@constellation-platform/ui | Shared React components (incl. LocaleSwitcher) |
@constellation-platform/coordinator-chat | Shared coordinator UI rendered by Project Tracker as both the full-page workspace (CoordinatorWorkspace) and the task drawer (PLT-224, PLT-237). Zone-agnostic transport via an injected resolveApiUrl. Consumed as source. |
@constellation/config | Shared ESLint, TypeScript, Vitest configs |
i18n entry points
Internationalisation primitives are split across three packages so apps can compose only what they need:
@constellation-platform/i18n— runtime-agnostic.Localeunion,SUPPORTED_LOCALES,resolveLocale(),negotiateAcceptLanguage(),formatDate/DateTime/Number/Currency, message-loader with regional → base-language → default fallback, and alocalized()JSONB overlay reader.@constellation-platform/auth-next/locale— Next.js wiring. Cookie helpers (readLocaleCookie,serializeLocaleCookie,clearLocaleCookieValue), edge-middleware integration via thelocaleResolveroption oncreateConstellationAuthMiddleware,withVaryCookie()response decorator, andAuthContext.localepopulated bywithAuth.@constellation-platform/translation— AI translation.TranslationProviderinterface andcreateTranslationProvider({ ai, model })that wrapsai-coreso tenant budget + audit are inherited.@constellation-platform/ui— sharedLocaleSwitcherclient component (server-action driven; renders null when fewer than two locales are enabled).
See Multilanguage (i18n) for the architecture overview.
When to use which
- AI features. Start with
@constellation-platform/ai-corefor provider-agnostic completion calls (with budget + audit). Add@constellation-platform/ai-embeddingswhen you need vector embeddings (semantic search, RAG retrieval). Add@constellation-platform/ai-ragwhen you want grounded answers — it composesai-core+ai-embeddingsand handles the retrieval / context-injection wiring. For programme-scoped reasoning over live PT + GitHub state (prioritisation, duplicate-effort detection, "what next"), call@constellation-platform/coordinator'sconsultCoordinator()— it wrapsai-coreand writes an append-onlycoordinator.consultsrow plus acoordinator.consult.createdaudit entry per call. - Persistence.
@constellation-platform/dbfor any tenant-scoped DB access. UsewithTenantContext()to open a transaction withapp.tenant_idset. UseauditAction()for routine audit; reach for@constellation-platform/audit'sauditCritical()only when the mutation must publish anaudit.entry.createdoutbox event for downstream SIEM. - Async work.
@constellation-platform/jobsfor one-off background work.@constellation-platform/eventsfor cross-module domain events (always wrap in the originating transaction). - Files.
@constellation-platform/storage(S3 / MinIO). - Auth. Apps wire
@constellation-platform/auth-nextand call into@constellation-platform/auth-corefor permission helpers. - UI. Always import from
@constellation-platform/ui, never from app-localcomponents/ui/.