Sixième Étoile — Documentation

Shared Packages

The six shared packages — database schema, Hono API, Better Auth, SSE EventBus, UI design system, and i18n catalogues.

The monorepo contains six shared packages under packages/. Each is consumed by one or more of the five apps; none of them can depend on another app.

packages/database — Prisma schema & client

The data layer for the platform. Key characteristics:

  • Multi-file Prisma schema — the schema is split into domain-bounded files under packages/database/prisma/schema/ (base, auth, enums, fleet, pricing, crm, quotes, orders, missions, billing, documents, audit, and Phase 2 additions).
  • Single Prisma client — all schema files are compiled into one generated client at packages/database/src/index.ts.
  • Migrations — tracked in packages/database/prisma/migrations/ and applied via pnpm prisma migrate.
  • Multi-tenancy: virtually every VTC model has an organizationId field — records are isolated per operator organization.

See also: Data Model overview for entity-by-entity documentation.

packages/api — Hono REST + SSE server

The HTTP API layer, consumed by all four business apps.

  • Framework: Hono 4.12+ running on Node.js.
  • Routes: organized under packages/api/src/routes/vtc/ by bounded context (pricing, fleet, crm, billing, missions, settings, integrations) plus Phase 2 routes (driver, tracking, agency, realtime).
  • OpenAPI: hono-openapi is already wired — Story 85-5 completes coverage and emits a single openapi.json build artifact.
  • Auth middleware: requireOperatorAuth, requireAgencyAuth, requireDriverAuth, validateTrackingToken (public).
  • SSE streams: GET /api/v1/realtime/stream (operator) and GET /api/v1/driver/realtime/stream (driver) use packages/realtime's EventBus.

See also: API Reference for the interactive endpoint explorer.

packages/auth — Better Auth sessions

Centralized authentication and authorization.

  • Library: Better Auth.
  • Identity types: operator users (multi-organization), agency portal users (AgencyPortalUser), driver users.
  • Organization membership with role-based policies — operators can have multiple organization memberships.
  • Session storage: server-side session tokens validated by API middleware.
  • No apps/docs coupling: apps/docs is public and does not import packages/auth.

packages/realtime — EventBus & SSE streams

The real-time communication backbone.

  • EventBus — an in-process publish/subscribe bus. Services in packages/api publish events (mission status changes, driver location updates); SSE handlers subscribe and forward events to connected clients.
  • SSE management — handles client connection lifecycle, heartbeats, and graceful disconnection.
  • Driver locationDriverLocation records are written on each driver position update (deduplicated at ≥ 20 m movement threshold) and broadcast via the EventBus.
  • Operator streampackages/api/src/routes/vtc/realtime.ts pushes operator-relevant events (driver connected, mission accepted, location update).
  • Driver streampackages/api/src/routes/driver/realtime.ts pushes driver-relevant events (mission broadcast, dispatch assignment).

packages/ui — Design system

The shared component library, based on shadcn/ui and Tailwind CSS.

  • Provides reusable UI primitives (Button, Input, Dialog, Table, Badge, etc.) consumed by apps/web, apps/agency, and apps/tracking.
  • Tailwind design tokens (colors, spacing, typography) are defined here and referenced by all consuming apps.
  • apps/docs may reference design tokens for visual consistency only if that introduces no runtime coupling. In practice, apps/docs uses FumaDocs' own Tailwind configuration.

packages/i18n — Translation catalogues

Internationalization strings for the three Next.js business apps.

  • Library: next-intl.
  • Structure: packages/i18n/translations/fr.json (primary) + en.json — JSON key-value catalogues.
  • Consumed by: apps/web, apps/agency, apps/tracking.
  • Not used by apps/docs or apps/driver. apps/docs uses FumaDocs' own routing-based i18n (physical per-locale MDX duplication); apps/driver has its own public/locales/ resource files.

Note: packages/i18n (next-intl JSON keys) and apps/docs i18n (FumaDocs MDX duplication) are completely separate i18n regimes and do not share infrastructure.


See also: Apps overview · Monorepo layout · Data Model

Was this page helpful?

On this page