How maxima24/conduit works
Purpose and Workspace
Conduit is a webhook-delivery system: ingest external webhooks, persist events idempotently, queue delivery, track attempts/retries/DLQ, reconcile delivery gaps, and expose operational visibility. It is a pnpm/Turborepo monorepo with a NestJS API, Next.js dashboard, and a shared contract package. Root orchestration is in package.json, turbo.json, and docker-compose.yml.
Entrypoints and Runtime Composition
The API starts through Nest bootstrap in apps/api/src/main.ts, assembling feature modules in apps/api/src/app.module.ts. The dashboard uses the Next App Router rooted at apps/web/src/app/layout.tsx, with principal pages for events, DLQ, and reconciliation. Local/runtime infrastructure is PostgreSQL and Redis, configured for deployment alongside the API by docker-compose.yml and render.yaml; the API worker runs in-process on Render.
Shared API Boundary
packages/contracts is the source of truth for HTTP routes, request/response DTOs, enums, errors, pagination, and stream messages. Both applications should cross the API boundary through these definitions, notably packages/contracts/src/routes.ts, packages/contracts/src/index.ts, and packages/contracts/src/stream.ts. API responses use a common error envelope and cursor-paginated lists, while timestamps are ISO-8601 UTC strings and optional values are null.
Persistence and Data Access
Prisma models and migrations define the durable event, send, attempt, and reconciliation state in PostgreSQL: apps/api/prisma/schema.prisma and apps/api/prisma/migrations/20260719065629_init/migration.sql. Prisma access is deliberately isolated behind repositories, with shared client lifecycle in apps/api/src/common/prisma/prisma.service.ts. Feature repositories form the database boundary, including apps/api/src/modules/events/events.repository.ts, apps/api/src/modules/delivery/sends.repository.ts, and apps/api/src/modules/reconciliation/reconciliation.repository.ts.
Ingest-to-Delivery Pipeline
Webhook requests enter the webhooks module, which validates/verifies source input, persists idempotently, and enqueues work: apps/api/src/modules/webhooks/webhooks.controller.ts, apps/api/src/modules/webhooks/webhooks.service.ts, and apps/api/src/modules/webhooks/webhooks.repository.ts. Delivery jobs are defined and connected through apps/api/src/queue/queue.module.ts and apps/api/src/queue/job.types.ts, then consumed by apps/api/src/modules/delivery/delivery.processor.ts. Redis/BullMQ provides asynchronous delivery control; Resend is the intended outbound email provider at apps/api/src/modules/delivery/email/resend.provider.ts. Actual send/attempt/backoff/DLQ behavior remains marked scaffold TODO work.
Operational Read and Repair Surfaces
Events and delivery modules provide persisted operational history, with mapping from database state to contracts in apps/api/src/modules/events/events.service.ts and apps/api/src/modules/delivery/sends.service.ts. Reconciliation identifies or reports missing/inconsistent delivery state via apps/api/src/modules/reconciliation/reconciliation.service.ts; automated gap detection is still a TODO. Aggregate reporting is isolated in apps/api/src/modules/stats/stats.service.ts. Live updates are exposed through apps/api/src/modules/stream/stream.controller.ts and apps/api/src/modules/stream/stream.service.ts.
Dashboard Data Flow
The Next dashboard renders server-state views for events, event detail/timelines, DLQ replay, reconciliation, and statistics from apps/web/src/app/events/page.tsx, apps/web/src/app/dlq/page.tsx, and apps/web/src/app/reconciliation/page.tsx. Feature API clients call the backend through apps/web/src/lib/api-client.ts; TanStack Query owns server data via apps/web/src/lib/query-client.ts. Zustand is restricted to UI intent and live-stream state, such as apps/web/src/stores/filters.store.ts and apps/web/src/stores/stream.store.ts. The dashboard can run against fixtures through apps/web/src/mocks/index.ts before the API is available.
Main entry points: app.module.ts Feature modules · prisma.service.ts Prisma data access · webhooks.service.ts Webhook ingest · queue.module.ts Delivery queue
Components 21
NestJS API
Webhook ingestion, delivery, and operational APIs.
- API bootstrap
apps/api/src/main.ts - Feature modules · Assembles the API feature boundaries.
apps/api/src/app.module.ts - Webhook ingest · Validates input, enforces idempotency, and creates delivery work.
apps/api/src/modules/webhooks/webhooks.service.ts - Webhook repository
apps/api/src/modules/webhooks/webhooks.repository.ts - Delivery queue
apps/api/src/queue/queue.module.ts - Delivery processor · Send, retry, backoff, and DLQ behavior is scaffolded.
apps/api/src/modules/delivery/delivery.processor.ts - Resend provider
apps/api/src/modules/delivery/email/resend.provider.ts - Operational services · Maps persisted history to contract responses.
apps/api/src/modules/events/events.service.ts - Reconciliation · Reports missing or inconsistent delivery state; detection is scaffolded.
apps/api/src/modules/reconciliation/reconciliation.service.ts - Aggregate stats
apps/api/src/modules/stats/stats.service.ts - Live stream
apps/api/src/modules/stream/stream.service.ts
Data and Queue
Durable state and asynchronous job control.
- Prisma data access · Shared database client behind feature repositories.
apps/api/src/common/prisma/prisma.service.ts - PostgreSQL · Stores events, sends, attempts, and reconciliation state.
apps/api/prisma/schema.prisma - Redis
docker-compose.yml
Next.js Dashboard
Operational interface and client-side state.
- Dashboard shell
apps/web/src/app/layout.tsx - Operations views · Renders operational history and repair surfaces.
apps/web/src/app/events/page.tsx - API client
apps/web/src/lib/api-client.ts - Server data cache
apps/web/src/lib/query-client.ts - UI and stream state · Holds UI intent and live-stream state only.
apps/web/src/stores/stream.store.ts - Dashboard fixtures · Allows dashboard work before the API is available.
apps/web/src/mocks/index.ts
Shared Contracts
Cross-application API definitions.
- HTTP and stream contracts · Routes, DTOs, errors, pagination, enums, and stream messages.
packages/contracts/src/index.ts
Connections 25
- API bootstrap → Feature modules: starts
- Feature modules → Webhook ingest: routes webhooks
- Feature modules → Operational services: serves history
- Feature modules → Reconciliation: serves repair
- Feature modules → Aggregate stats: serves reporting
- Feature modules → Live stream: exposes updates
- Webhook ingest → Webhook repository: persists idempotently
- Webhook repository → Prisma data access: uses
- Webhook ingest → Delivery queue: enqueues delivery
- Delivery queue → Redis: stores jobs
- Delivery queue → Delivery processor: dispatches jobs
- Delivery processor → Resend provider: sends email
- Delivery processor → Prisma data access: records attempts
- Operational services → Prisma data access: reads history
- Reconciliation → Prisma data access: checks state
- Aggregate stats → Prisma data access: aggregates
- Prisma data access → PostgreSQL: reads and writes
- Dashboard shell → Operations views: renders
- Operations views → Server data cache: uses server state
- Server data cache → API client: fetches through
- Operations views → UI and stream state: uses live UI state
- API client → HTTP and stream contracts: uses API definitions
- Feature modules → HTTP and stream contracts: implements
- Live stream → UI and stream state: publishes live updates
- Dashboard fixtures → API client: can substitute backend