Architecture Patterns
Simple Deployment
Single container running both API server and job processing in-process. Best for:- Development environments
- Low-traffic deployments
- Quick demos and prototypes
Production Deployment
Separate API server and worker processes with Redis queue. Best for:- Production environments
- High-traffic applications
- Horizontal scaling requirements
- Reliability and fault tolerance
Deployment Options
Docker Compose
Deploy using docker-compose for local or single-server production
Job Queue
Configure BullMQ with Redis for reliable background processing
Horizontal Scaling
Scale workers across multiple servers for high throughput
Service Components
API Server
Responsibilities:- Handle HTTP requests and WebSocket connections
- Enqueue jobs to Redis
- Broadcast real-time notifications to clients
- Serve static frontend files
Worker Process
Responsibilities:- Process jobs from Redis queues
- Execute AI agent workflows
- Publish progress notifications via Redis Pub/Sub
- Update database with results
Redis
Responsibilities:- Message broker for BullMQ queues
- Pub/Sub for real-time notifications
- Job state persistence
Database (Supabase/PostgreSQL)
Responsibilities:- Store conversations, messages, and state
- User authentication and authorization
- File metadata and references
Running Modes
In-Process Mode
When to use: Development, low-traffic deploymentsPros: Simple setup, no Redis requiredCons: Cannot scale horizontally, jobs block API server
Queue Mode
When to use: Production deployments, high-traffic applicationsPros: Horizontal scaling, fault tolerance, graceful job handlingCons: Requires Redis infrastructure
Environment Requirements
Required
OpenAI API key for LLM models (or use alternative providers)
Supabase project URL for database access
Supabase anonymous key for client authentication
Queue Mode
Enable BullMQ job queue (required for production)
Redis connection URL (e.g.,
redis://localhost:6379)Optional
JWT signing key for authentication
Authentication mode:
none or jwtResource Requirements
API Server
| Traffic | CPU | Memory | Instances |
|---|---|---|---|
| Light (< 10 users) | 1 core | 512MB | 1 |
| Medium (10-50 users) | 2 cores | 1GB | 2 |
| Heavy (50+ users) | 4 cores | 2GB | 3+ |
Worker
| Workload | CPU | Memory | Workers |
|---|---|---|---|
| Light (< 10 jobs/hr) | 1 core | 1GB | 2 |
| Medium (10-50 jobs/hr) | 2 cores | 2GB | 4 |
| Heavy (50+ jobs/hr) | 4 cores | 4GB | 8+ |
Redis
| Scenario | Memory | Concurrent Jobs |
|---|---|---|
| Development | 256MB | ~50 |
| Light Production | 512MB | ~100 |
| Medium Production | 1GB | ~500 |
| Heavy Production | 2GB+ | 1000+ |
Health Checks
BioAgents provides a health endpoint for monitoring:Monitoring
Bull Board Dashboard
Access the job queue dashboard at/admin/queues when queue mode is enabled:
- View queue status and metrics
- Inspect job data and results
- Retry failed jobs
- Pause/resume queues
Logs
BioAgents uses structured logging with Pino:Next Steps
Docker Setup
Learn how to deploy with docker-compose
Job Queue
Configure BullMQ for reliable job processing