Skip to content

Architecture Overview

Understanding the complete architecture of the Deplate.io infrastructure template - from high-level design to detailed component interactions.

The infrastructure follows a modern microservices architecture pattern with clear separation of concerns:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Internet β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ DNS & CDN β”‚
β”‚ (Cloudflare) β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Kubernetes Cluster β”‚
β”‚ β”‚
β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚ β”‚ Load Balancer β”‚ β”‚
β”‚ β”‚ (Traefik Ingress) β”‚ β”‚
β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚ β”‚ β”‚ β”‚
β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚ β”‚ Frontend β”‚ β”‚ Backend β”‚ β”‚
β”‚ β”‚ (Next.js) β”‚ β”‚ (Laravel) β”‚ β”‚
β”‚ β”‚ β”‚ β”‚ β”‚ β”‚
β”‚ β”‚ - SSR β”‚ β”‚ - API Endpoints β”‚ β”‚
β”‚ β”‚ - Static Assets β”‚ β”‚ - WebSockets β”‚ β”‚
β”‚ β”‚ - Auto-scaling β”‚ β”‚ - Auto-scaling β”‚ β”‚
β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚ β”‚ β”‚
β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚ β”‚ Background Jobs β”‚ β”‚
β”‚ β”‚ β”‚ β”‚
β”‚ β”‚ - Workers β”‚ β”‚
β”‚ β”‚ - Scheduler β”‚ β”‚
β”‚ β”‚ - Queue Processing β”‚ β”‚
β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚ β”‚ β”‚
β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚ β”‚ Data Layer β”‚ β”‚
β”‚ β”‚ β”‚ β”‚
β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚
β”‚ β”‚ β”‚ MariaDB β”‚ β”‚ Redis β”‚ β”‚ RabbitMQ β”‚ β”‚ β”‚
β”‚ β”‚ β”‚(Database)β”‚ β”‚ (Cache) β”‚ β”‚ (Queue) β”‚ β”‚ β”‚
β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚
β”‚ β”‚ β”‚ β”‚
β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚
β”‚ β”‚ β”‚ MinIO β”‚ β”‚ Graylog β”‚ β”‚ β”‚
β”‚ β”‚ β”‚ (Storage) β”‚ β”‚ (Logging) β”‚ β”‚ β”‚
β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚
β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ AWS Services β”‚
β”‚ β”‚
β”‚ - SES (Email) β”‚
β”‚ - IAM (Access) β”‚
β”‚ - Route53 (DNS) β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
  • Technology: Next.js 13+ with App Router
  • Rendering: Server-Side Rendering (SSR) and Static Generation
  • Deployment: Kubernetes deployment with auto-scaling
  • Domains: yourdomain.com, www.yourdomain.com

Key Features:

  • React 18+ with modern features
  • TypeScript for type safety
  • Optimized build caching
  • Progressive Web App (PWA) capabilities
  • SEO-optimized with structured data
  • Technology: Laravel 10+ with PHP 8.2+
  • Architecture: Multi-container deployment
  • Domains: app.yourdomain.com

Container Structure:

Backend Pod:
β”œβ”€β”€ Nginx Container (Web Server)
β”œβ”€β”€ PHP-FPM Container (Application)
β”œβ”€β”€ Init Container (Migrations)
└── Shared Volumes

Key Features:

  • RESTful API endpoints
  • WebSocket support (Laravel Reverb)
  • Queue-based background processing
  • Database migrations automation
  • Session management with Redis
  • Workers: Process queued jobs asynchronously
  • Scheduler: Handles cron-like tasks
  • Queue System: Redis-backed job queue
  • Setup: High-availability cluster
  • Features: Master-slave replication, automated backups
  • Storage: Persistent volumes with SSD storage
  • Monitoring: Performance metrics and slow query logging
MariaDB Cluster:
β”œβ”€β”€ Primary Node (Read/Write)
β”œβ”€β”€ Secondary Node (Read-only)
β”œβ”€β”€ Automated Backups
└── Point-in-time Recovery
  • Use Cases: Session storage, application cache, queue backend
  • Configuration: Cluster mode with persistence
  • Features: High availability with Sentinel
  • Purpose: Reliable message delivery and job processing
  • Features: Dead letter queues, message persistence
  • Management: Web-based administration interface
  • Compatibility: S3-compatible API
  • Use Cases: File uploads, static assets, backups
  • Features: Multi-tenancy, encryption, versioning
  • Version: 1.19+ with modern features
  • Networking: CNI with network policies
  • Storage: CSI drivers for dynamic provisioning
  • Security: RBAC, pod security policies
  • Features: Automatic SSL/TLS, load balancing
  • Integrations: Let’s Encrypt, middleware support
  • Monitoring: Metrics and tracing
  • Provider: Let’s Encrypt integration
  • Features: Automatic renewal, wildcard certificates
  • Validation: DNS-01 and HTTP-01 challenges
  • Logs: Graylog for centralized logging
  • Metrics: Prometheus for time-series data
  • Alerting: Automated alert management
  • Visualization: Grafana dashboards
  • Features: Transactional email, bounce handling
  • Configuration: DKIM, SPF, domain verification
  • Monitoring: Delivery metrics and analytics
  • Security: Least-privilege access
  • Features: Service accounts, access key rotation
  • Monitoring: CloudTrail audit logging
Internet Request
↓
DNS Resolution (Cloudflare)
↓
Load Balancer (Traefik)
↓
Application Pod (Frontend/Backend)
↓
Data Layer (Database/Cache)
  1. Edge Security: DDoS protection, WAF
  2. Network Policies: Pod-to-pod communication control
  3. TLS Encryption: End-to-end encryption
  4. RBAC: Kubernetes role-based access
  • Primary: yourdomain.com β†’ Frontend
  • API: app.yourdomain.com β†’ Backend
  • Static: static.yourdomain.com β†’ CDN/Storage
  • Wildcard: *.yourdomain.com β†’ Certificate coverage
1. User Request β†’ CDN/DNS
2. CDN β†’ Load Balancer
3. Load Balancer β†’ Application Pod
4. Application β†’ Database/Cache
5. Response β†’ User
1. Job Queued β†’ Redis Queue
2. Worker Process β†’ Job Execution
3. Database Updates β†’ Result Storage
4. Notifications β†’ Email/WebSocket
1. Frontend Upload β†’ Backend API
2. Backend Processing β†’ MinIO Storage
3. Database Record β†’ File Metadata
4. CDN Distribution β†’ Global Access
  • Frontend: 1-5 replicas based on CPU
  • Backend: 1-10 replicas based on CPU/memory
  • Database: Read replicas for scaling reads
  • Cache: Redis cluster for distributed caching
Frontend:
CPU: 80% threshold
Memory: 70% threshold
Backend:
CPU: 70% threshold
Memory: 80% threshold
Custom metrics: Queue length
Production Sizing:
Small (< 1k users):
- Frontend: 2 replicas
- Backend: 2 replicas
- Database: Single instance
Medium (1k-10k users):
- Frontend: 3-5 replicas
- Backend: 3-7 replicas
- Database: Master + replica
Large (10k+ users):
- Frontend: 5+ replicas
- Backend: 5-10+ replicas
- Database: Cluster setup
  1. Perimeter Security: Firewall, DDoS protection
  2. Network Security: Network policies, VPN access
  3. Application Security: HTTPS, input validation
  4. Data Security: Encryption at rest and in transit
  5. Access Security: RBAC, service accounts
Kubernetes Secrets:
β”œβ”€β”€ Database credentials
β”œβ”€β”€ API keys and tokens
β”œβ”€β”€ TLS certificates
└── Service account keys
  • Pod-to-pod communication rules
  • Database access restrictions
  • External service limitations
  • Monitoring and logging access
Code Change β†’ Git Repository
↓
CI/CD Pipeline β†’ Image Build
↓
Container Registry β†’ Image Storage
↓
Helm Deployment β†’ Kubernetes
↓
Health Checks β†’ Monitoring
  • Development: Local/staging cluster
  • Staging: Production-like environment
  • Production: Multi-zone deployment
  • Blue-Green: Zero-downtime deployments
  • Rolling Updates: Gradual rollout
  • Canary: Risk-reduced releases
Application Metrics β†’ Prometheus
↓
Infrastructure Logs β†’ Graylog
↓
Performance Data β†’ Grafana
↓
Alert Rules β†’ Notification System
  • Application: Response time, error rate, throughput
  • Infrastructure: CPU, memory, disk, network
  • Business: User activity, feature usage
  • Security: Failed login attempts, suspicious activity
  • Application Cache: Redis for dynamic content
  • Database Cache: Query result caching
  • CDN Cache: Static asset distribution
  • Browser Cache: Client-side caching
  • Indexing: Optimized database indexes
  • Query Optimization: Efficient query patterns
  • Connection Pooling: Resource management
  • Read Replicas: Load distribution
  • Database: Automated daily backups
  • Files: Object storage replication
  • Configuration: Git-based versioning
  • Secrets: Encrypted backup storage
  • RTO: 15 minutes for critical services
  • RPO: 1 hour maximum data loss
  • Testing: Monthly recovery drills
  • Documentation: Step-by-step procedures
  • Payment: Stripe integration
  • Email: AWS SES SMTP
  • Maps: Google Maps API
  • SMS: Twilio API
  • Currency: Exchange rate APIs
  • RESTful: Standard HTTP methods
  • Authentication: JWT tokens, API keys
  • Rate Limiting: Request throttling
  • Versioning: API version management

This architecture provides a robust, scalable, and secure foundation for modern SaaS applications, designed to handle growth from startup to enterprise scale while maintaining operational excellence.