System Architecture
Metlo is built with a microservices architecture designed for scalability, reliability, and real-time API security monitoring. This page explains how the different components work together.Architecture Diagram
Core Components
1. Ingestor
Metlo Ingestor
Receives and processes API traffic from your applications in real time.
Image:
metlo/backend:latestCommand:
yarn start-collector
The ingestor is the entry point for all API traffic data. It:
- Receives HTTP request/response data from Metlo agents in your applications
- Validates and normalizes incoming traffic data
- Performs initial processing and enrichment
- Stores raw traffic data in PostgreSQL
- Queues jobs for the analyzer via Redis
- High-throughput traffic ingestion
- Minimal latency impact on your APIs
- Automatic batching and buffering
- Handles traffic spikes gracefully
The ingestor runs database migrations on startup when
RUN_MIGRATION=true is set.2. Backend API
Metlo Backend
Provides the REST API for the frontend dashboard and manages core business logic.
Image:
metlo/backend:latestTechnology: Node.js, Express, TypeORM The backend service handles:
- User authentication and session management
- API endpoint inventory management
- Attack detection rule configuration
- Security test execution
- Alert and notification management
- Data aggregation and analytics
- RESTful API for dashboard
- User and role management (Enterprise)
- Attack blocking rules
- Security testing framework
- Integration with CI/CD systems
3. Frontend Dashboard
Metlo Frontend
Web-based UI for visualizing API security, managing endpoints, and configuring protection.
Image:
metlo/frontend:latestTechnology: Next.js, React, Chakra UI The frontend provides:
- API Inventory Dashboard - Complete view of all discovered endpoints
- Attack Monitoring - Real-time view of detected attacks and threats
- Sensitive Data View - Identifies endpoints handling PII and sensitive data
- Security Testing - Build and run security tests
- Analytics - Traffic patterns, risk scores, and trends
- Configuration - Manage detection rules and blocking policies
4. Analyzer
Metlo Analyzer
Processes API traffic to detect attacks, identify patterns, and classify threats.
metlo/jobrunner:latestCommand:
yarn start-analyzer
The analyzer is a worker pool that:
- Analyzes API traffic for attack patterns
- Detects SQL injection, XSS, BOLA, and other OWASP Top 10 vulnerabilities
- Identifies sensitive data (PII, credentials, tokens)
- Builds behavioral models of normal API usage
- Generates attack signatures for blocking
- Updates risk scores for endpoints
- SQL Injection attempts
- Cross-Site Scripting (XSS)
- Broken Object Level Authorization (BOLA)
- Broken Authentication
- Security misconfiguration
- Sensitive data exposure
- XML External Entities (XXE)
- Server-Side Request Forgery (SSRF)
5. Jobs Runner
Metlo Jobs
Executes scheduled tasks and background jobs for maintenance and optimization.
metlo/jobrunner:latest
The jobs runner handles:
- Scheduled Tasks - Periodic cleanup and maintenance
- Endpoint Aggregation - Consolidates similar endpoints
- Alert Generation - Creates notifications for detected issues
- Data Retention - Manages data lifecycle policies
- Report Generation - Compiles security reports
- Integration Syncs - Updates external systems
- Traffic aggregation and rollups
- Alert rule evaluation
- Data retention cleanup
- Security test scheduling
- Metrics calculation
6. Database (PostgreSQL)
PostgreSQL
Primary data store for API endpoints, traffic logs, attacks, and configuration.
postgres:14.4-alpinePort: 5432 (internal only) Stores:
- API endpoint metadata and specifications
- Raw and processed traffic logs
- Detected attacks and alerts
- User accounts and sessions
- Security test definitions and results
- Configuration and rules
7. Cache (Redis)
Redis Cache
High-performance cache for session data, job queues, and real-time state.
redis:7.0.4Port: 6379 (internal only) Used For:
- Session storage (via
connect-typeorm) - Job queue management (via
bull) - Real-time attack state
- Rate limiting data
- Temporary aggregations
- Cache for frequently accessed data
Data Flow
Traffic Ingestion Flow
Application Sends Traffic
Your application’s Metlo agent captures HTTP request/response data and sends it to the ingestor.
Ingestor Processes
The ingestor validates, normalizes, and stores the traffic data in PostgreSQL, then queues analysis jobs in Redis.
Analyzer Detects Threats
The analyzer workers pick up jobs from Redis, analyze traffic for attack patterns, and update the database with findings.
Attack Detection Flow
Deployment Architecture
Local Development
Usedocker-compose.yaml for local development:
Production Deployment
For production, deploy components separately:AWS Deployment
- ECS/EKS for containers
- RDS for PostgreSQL
- ElastiCache for Redis
- ALB for load balancing
GCP Deployment
- GKE for containers
- Cloud SQL for PostgreSQL
- Memorystore for Redis
- Cloud Load Balancing
Azure Deployment
- AKS for containers
- Azure Database for PostgreSQL
- Azure Cache for Redis
- Azure Load Balancer
Kubernetes
- Use Helm charts
- StatefulSets for stateful components
- Services for networking
- Ingress for external access
Scaling Considerations
Horizontal Scaling
Components that scale horizontally:- Ingestor: Add more instances behind a load balancer for high traffic
- Backend: Scale API servers for more dashboard users
- Analyzer: Increase worker count or add more analyzer instances
- Jobs: Run multiple job runners for parallel task execution
- PostgreSQL: Use read replicas or sharding for large datasets
- Redis: Use Redis Cluster for high availability
Resource Requirements
Minimum (Development):- 2 CPU cores
- 4GB RAM
- 20GB disk
- Ingestor: 2 CPU, 4GB RAM per instance
- Backend: 2 CPU, 4GB RAM per instance
- Analyzer: 4 CPU, 8GB RAM per instance
- Jobs: 2 CPU, 4GB RAM
- PostgreSQL: 4 CPU, 16GB RAM, 100GB SSD
- Redis: 2 CPU, 4GB RAM
Security
Encryption
All sensitive data is encrypted using the
ENCRYPTION_KEY environment variable.- API keys and credentials
- Sensitive data detected in traffic
- User session data
- Integration tokens
Authentication
The backend uses:- Session-based authentication with
express-session - Sessions stored in Redis with encryption
- CSRF protection
- Role-based access control (Enterprise)
Network Security
Best practices:- Run components in a private network
- Only expose frontend and ingestor ports
- Use TLS/SSL for all external connections
- Implement network policies in Kubernetes
Monitoring
Monitor these key metrics:- Ingestor: Requests per second, ingestion latency
- Analyzer: Queue depth, processing time, detection rate
- Database: Connection pool usage, query performance
- Redis: Memory usage, eviction rate
- System: CPU, memory, disk I/O
Next Steps
Deploy to AWS
Step-by-step guide for AWS deployment
Deploy to GCP
Step-by-step guide for GCP deployment
Configure Ingestors
Set up agents in your applications
Development Guide
Contribute to Metlo or customize for your needs