System Architecture
SPCBot follows a microservices architecture with clear separation of concerns between the dashboard UI, API, background workers, and deployed Odoo instances.
High-Level Overview
┌─────────────────────────────────────────────────────────────┐
│ Users │
└─────────────────────────────────────────────────────────────┘
│
┌──────────────────────────▼──────────────────────────────────┐
│ Next.js Frontend (Port 3000) │
│ • Dashboard UI │
│ • Environment Management │
│ • Real-time Deployment Logs (SSE) │
└──────────────────────────┬──────────────────────────────────┘
│ REST API / WebSocket
┌──────────────────────────▼──────────────────────────────────┐
│ NestJS API (Port 4000) │
│ • Authentication (JWT) │
│ • Business Logic (Projects, Instances, Servers) │
│ • Queue Management (BullMQ) │
└──────────┬───────────────┬────────────────┬─────────────────┘
│ │ │
┌──────▼──────┐ ┌─────▼──────┐ ┌──────▼──────┐
│ PostgreSQL │ │ Redis │ │ Worker │
│ (Data) │ │ (Queue) │ │ (Background)│
└─────────────┘ └────────────┘ └──────┬──────┘
│
┌───────────────────────────────────────────▼───────────────────┐
│ Docker Orchestration (Per Instance) │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
│ │ Odoo App │ │ Database │ │ Nginx │ │
│ │ (Port X) │ │ (Container) │ │ (Reverse) │ │
│ └─────────────┘ └─────────────┘ └─────────────┘ │
└─────────────────────────────────────────────────────────────┘
Data Flow
- User creates environment via Dashboard
- API generates Docker Compose configuration
- DeploymentWorker queues job via BullMQ
- Worker executes SSH commands on target server
- Server runs Docker containers (Odoo, DB, Nginx)
- Instance accessible on allocated port/domain
Component Responsibilities
- Frontend (Next.js): Dashboard UI, real-time logs, user interactions
- API (NestJS): Business logic, authentication, database operations
- Worker (BullMQ): Background job processing, deployments, SSH operations
- PostgreSQL: Persistent storage for all platform data
- Redis: Job queue, caching, real-time event publishing
Instance Isolation
Each Odoo instance runs in isolated Docker containers with:
- Dedicated PostgreSQL database (container or shared with unique DB)
- Isolated filestore volume for attachments
- Unique port allocation (auto-assigned or custom)
- Separate nginx configuration for domain routing
- Environment-specific configuration (odoo.conf)