Architecture Diagrams
Visual maps of every layer of the Leadmetrics v3 system. Read top to bottom — each diagram zooms into a layer from the one above.
1. Full System Overview
All major components and the connections between them.
2. API Layer Internals
What lives inside the Fastify API process (:3003).
3. Job Lifecycle — API to Worker to Result
How a content generation request travels from the API to a completed piece of content.
4. Worker Servers & Their Queues
Seven background processes handle all async work.
5. Adapter Layer — LLM Dispatch
How the agents server selects and calls an LLM backend per job.
6. Auth Flow
How authentication works across all portals and the API.
7. Data Layer — What Goes Where
Which database stores which data and why.
8. RAG Pipeline
How documents and web pages flow from upload to searchable vector chunks used by AI agents.
9. Notification Routing
How notifications reach users across every channel.
10. Tenant Data Isolation
How one PostgreSQL + Redis cluster serves all tenants safely.
11. Deployment
Services, ports, and how code gets to production.
Component Summary
| Component | Technology | Port | Role |
|---|---|---|---|
| Dashboard | Next.js 15 + React 19 | :3000 | Client / tenant web portal |
| Manage | Next.js 15 + React 19 | :3001 | Super-admin platform portal |
| DM Portal | Next.js 15 + React 19 | :3002 | Internal DM reviewer portal |
| API | Fastify + TypeScript | :3003 | REST API, auth, SSE, Socket.IO |
| Knowledgebase | Nextra 4 (Next.js) | :3004 | Internal docs site |
| Mobile App | React Native + Expo 55 | — | iOS/Android client portal |
| agents server | Node.js + BullMQ | — | 40+ AI agent workers |
| billing server | Node.js + BullMQ | — | Invoicing, credits, overdue |
| notifications server | Node.js + BullMQ | — | Email, SMS, WhatsApp, push |
| ragengine server | Node.js + BullMQ | — | Document ingestion + crawling |
| reporting server | Node.js + node-cron | — | Daily automated reports |
| scheduler server | Node.js + DB poll | — | One-off scheduled tasks |
| search-indexer server | Node.js + BullMQ | — | Typesense content sync |
| PostgreSQL | Postgres (Prisma ORM) | 5432 | All application data, 100+ models |
| Redis | Redis | 6379 | BullMQ queues, rate limiting, Socket.IO |
| MongoDB | MongoDB (Mongoose) | 27017 | Immutable audit logs only |
| Typesense | Typesense | — | Full-text search, 13 collections |
| Qdrant | Qdrant | 6333 | RAG vector embeddings (configurable) |
| DigitalOcean Spaces | S3-compatible | — | File storage, media assets |