Architecture Overview
Terragate is built as an enterprise-grade microservices platform designed for scalability, security, and reliability.
High-Level Architecture
┌─────────────────────────────────────────────────────────────────┐
│ Terragate Platform │
├─────────────────────────────────────────────────────────────────┤
│ │
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
│ │ Dashboard │ │ Landing │ │ Mobile │ │
│ │ (Next.js) │ │ (Next.js) │ │ (React │ │
│ │ │ │ │ │ Native) │ │
│ └──────┬───────┘ └──────────────┘ └──────────────┘ │
│ │ │
│ ▼ │
│ ┌──────────────────────────────────────────────────────────┐ │
│ │ API Gateway (NestJS) │ │
│ │ • Authentication & Authorization │ │
│ │ • Rate Limiting & Security Middleware │ │
│ │ • Request Validation & Transformation │ │
│ └──────────────────────────┬───────────────────────────────┘ │
│ │ │
│ ┌───────────────────┼───────────────────┐ │
│ ▼ ▼ ▼ │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
│ │ User & │ │ Workspace │ │ Execution │ │
│ │ Auth │ │ Service │ │ Service │ │
│ │ Service │ │ │ │ (Go) │ │
│ └──────┬──────┘ └──────┬──────┘ └──────┬──────┘ │
│ │ │ │ │
│ ▼ ▼ ▼ │
│ ┌──────────────────────────────────────────────────────────┐ │
│ │ Data Layer │ │
│ │ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ │ │
│ │ │PostgreSQL│ │ Redis │ │ RabbitMQ │ │ S3 │ │ │
│ │ └──────────┘ └──────────┘ └──────────┘ └──────────┘ │ │
│ └──────────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────┘Core Components
Frontend Applications
| Application | Technology | Purpose |
|---|---|---|
| Dashboard | Next.js 15, React 19 | Main user interface for workspace management |
| Landing | Next.js 15 | Marketing site and documentation |
| Mobile | React Native | Mobile app for monitoring and approvals |
Backend Services
| Service | Technology | Purpose |
|---|---|---|
| API Gateway | NestJS | Central entry point, auth, routing |
| Execution Engine | Go | Terraform/Terragrunt execution |
| Worker Services | Python | AI processing, analytics |
Data Stores
| Store | Purpose |
|---|---|
| PostgreSQL | Primary database (users, workspaces, jobs) |
| Redis | Caching, sessions, real-time features |
| RabbitMQ | Async job processing, events |
| S3 | Terraform state, artifacts, backups |
Key Design Principles
1. Multi-Tenant by Default
Every resource is scoped to an organization. Row-level security ensures data isolation.
2. Event-Driven Architecture
Async operations use RabbitMQ with the outbox pattern for reliability.
3. Observability First
Full distributed tracing (Jaeger), metrics (Prometheus), and logs (Loki).
4. Security Layers
- API key authentication for services
- JWT for users with refresh token rotation
- AES-256-GCM encryption for credentials
- Audit logging for compliance
Next Steps
- Multi-Tenant Architecture - Deep dive into tenant isolation
- Execution Engine - How Terraform runs work
- Security - Security model and compliance
Last updated on