Architecture Overview
ProjectSpecter follows a modern, containerized architecture designed for scalability and ease of management.System Architecture
Core Components
1. Traefik Reverse Proxy
Purpose: Central routing and load balancing Key Features:- Dynamic service discovery via Docker
- Automatic SSL/TLS certificate generation
- HTTP to HTTPS redirect
- Request routing based on hostnames
- Middleware support for authentication, compression, etc.
- Built-in dashboard and API
- Static config:
traefik.yml - Dynamic config: Docker labels in compose files
- Ports: 80 (HTTP), 443 (HTTPS), 8080 (Dashboard)
- Receives all incoming requests on ports 80/443
- Inspects request headers and URL
- Matches against configured routes
- Applies middleware (e.g., authentication)
- Routes to appropriate backend service
- Returns response to client
2. Descope Authentication Service
Purpose: Enterprise authentication and authorization Key Features:- OAuth/OpenID Connect provider
- Single Sign-On (SSO)
- Magic links
- Passkeys
- Multi-factor authentication
- User management
- Session management
- Implements
/verifyendpoint for Traefik middleware - Sets authentication cookies for
*.starfleet-command.dev - Redirects unauthenticated users to login page
- User requests protected service
- Traefik applies
descope-verify@dockermiddleware - Middleware calls Descope verify endpoint
- If no session → redirect to login at
auth.starfleet-command.dev - User authenticates
- Descope creates session and sets cookie
- User redirected back to original service
- Traefik verifies session → allows access
3. Docker & Networking
Purpose: Service containerization and communication Network Model:- Services communicate by container name
- Automatic DNS resolution
- Isolated from host network
- Easy service discovery
4. Cloudflare Integration
Purpose: DNS management and domain security Responsibility:- DNS record management
- DDoS protection
- WAF (Web Application Firewall)
- SSL/TLS infrastructure (optional, we use Let’s Encrypt)
- API access for Traefik ACME challenges
Request Flow Example
Scenario: User accesses Traefik dashboard
Data Flow Diagram
Deployment Model
Single VPS Deployment
- ACME certificates:
/opt/traefik/acme/acme.json - Session data: In-memory (ephemeral)
- Configuration: Volume mounts from host
Security Model
Network Security
- Services not exposed to host network
- Only Traefik has external network access
- Services communicate through Docker network
- Port 22 (SSH) restricted to specific IPs
Application Security
- SSL/TLS encryption in transit
- Authentication required for protected services
- Descope handles credential management
- Session tokens validated per request
Certificate Management
- Automatic renewal via Let’s Encrypt
- Cloudflare DNS challenge integration
- 90-day default expiration with auto-renewal
- Stored encrypted in
acme.json
Scaling Considerations
Horizontal Scaling
Vertical Scaling
- Increase VPS CPU/RAM
- Add more service replicas
- Increase Docker resource limits
Service-Specific Scaling
Technology Stack
| Layer | Technology | Version | Purpose |
|---|---|---|---|
| Reverse Proxy | Traefik | v2.11 | Routing & load balancing |
| Authentication | Descope | Latest | Enterprise auth |
| Containerization | Docker | 24.0+ | Container runtime |
| Orchestration | Docker Compose | v2 | Service orchestration |
| DNS | Cloudflare | API v4 | Domain management |
| Certificates | Let’s Encrypt | ACME v2 | SSL/TLS |
Architecture Principles
- Containerization - All services run in Docker
- Infrastructure as Code - Define services in code (docker-compose.yml)
- Single Responsibility - Each service has one purpose
- Stateless Services - Services can be restarted without data loss
- Automatic Discovery - Traefik discovers services dynamically
- Security First - HTTPS by default, authentication required
- Observability - Logs and metrics accessible
- Reproducibility - Same config across environments
Next: Quickstart Guide