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

  1. User creates environment via Dashboard
  2. API generates Docker Compose configuration
  3. DeploymentWorker queues job via BullMQ
  4. Worker executes SSH commands on target server
  5. Server runs Docker containers (Odoo, DB, Nginx)
  6. Instance accessible on allocated port/domain

Component Responsibilities

Instance Isolation

Each Odoo instance runs in isolated Docker containers with: