microservices-architecture-models/SKILL.md
The three NGINX Microservices Reference Architecture networking models — Proxy, Router Mesh, and Fabric — with a model selection decision tree, API gateway design, and service discovery patterns. Invoke during HLD for any microservices-based...
npx skillsauth add peterbamuhigire/skills-web-dev microservices-architecture-modelsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
microservices-architecture-models or would be better handled by a more specific companion skill.SKILL.md first, then load only the referenced deep-dive files that are necessary for the task.Stetson, C. (2017). NGINX Microservices Reference Architecture. NGINX Inc. — Three progressive networking models with source code (the Ingenious photosharing demo app).
The NGINX MRA defines three networking models that form a progression. Start with the Proxy Model and move up as your needs grow.
| Model | Complexity | Best For | NGINX Instances | |-------|-----------|---------|----------------| | Proxy | Low | Simple apps, monolith migration start | 1 cluster (ingress) | | Router Mesh | Medium | Robust new apps, moderate-complexity legacy migration | 2 clusters (ingress + routing hub) | | Fabric | High | Large secure apps, SSL/TLS everywhere, high-performance | 1 per container + ingress |
Architecture:
Client → [NGINX Plus — API Gateway + Reverse Proxy] → Service Instances
Capabilities:
When to use:
When to move up:
Implementation checklist:
valid parameter on resolver to control refresh rate (not DNS TTL)Architecture:
Client → [NGINX Cluster 1 — Reverse Proxy] → [NGINX Cluster 2 — Router Mesh Hub] → Service Instances
How it differs from Proxy Model: Cluster 1 handles external traffic (caching, SSL, rate limiting). Cluster 2 is a dedicated routing hub for inter-service communication — it handles service discovery, load balancing, health checks, and circuit breaking for all services.
Capabilities (additional beyond Proxy):
When to use:
Implementation steps:
LB_SERVICE=true in container definition.Architecture:
Client → [NGINX Plus — Ingress] → [Container: NGINX Plus sidecar + Service] ←→ [Container: NGINX Plus sidecar + Service]
The key difference: NGINX Plus runs inside every container, acting as both forward and reverse proxy for each service. Services talk to localhost for all outbound requests; the local NGINX Plus instance handles service discovery, load balancing, and SSL/TLS.
The persistent SSL/TLS mini-VPN effect:
Capabilities (additional beyond Router Mesh):
Comparison — Normal Process vs Fabric Model:
| Step | Normal Process | Fabric Model | |------|---------------|-------------| | Service discovery | Per request — wait for DNS | Background task — instant | | Load balancing | Primitive DNS round-robin | Advanced (Least Time, session persistence) | | SSL handshake | Every request (9 steps) | Once per pair, then persistent | | Resilience | Manual per service | Built into network |
When to use:
Service discovery flow in Fabric Model:
Service A needs to call Service B
→ Service A sends request to localhost
→ Local NGINX Plus looks up Service B in its internal table
→ Table was built by async DNS resolver querying service registry (Consul/etcd/K8s/ZooKeeper)
→ NGINX Plus sends to Service B via persistent SSL connection (or creates one if first time)
→ Response returned directly
Start here: How many services do you have?
1-5 services and simple inter-service calls?
→ Proxy Model
6-20 services with active circuit breaking needed?
→ Router Mesh Model
20+ services OR security mandate for inter-service SSL/TLS?
→ Fabric Model
Still on a monolith?
→ Start with Proxy Model in front of monolith, then use Strangler Fig
to extract services and promote to Router Mesh as you grow
In all three models, the ingress NGINX instance acts as the API gateway. Responsibilities:
| Responsibility | Implementation |
|---------------|---------------|
| SSL/TLS termination | NGINX ssl_certificate + ssl_protocols TLSv1.2 TLSv1.3 |
| Rate limiting | limit_req_zone per IP and per tenant |
| Authentication | JWT validation at gateway (pass X-User-Id header downstream) |
| Routing | location blocks per service, or proxy_pass with service name |
| Load balancing | upstream block with least_conn or least_time |
| Caching | proxy_cache_path for static and microcached responses |
| HTTP/2 | listen 443 ssl http2 |
| Health checks | health_check uri=/health interval=3s |
| Circuit breaker | max_fails=1 fail_timeout=10s in upstream block |
| Request aggregation | Lua module for multi-service fan-out + combine |
| Registry | Protocol | Best For | |----------|---------|---------| | Consul | DNS + HTTP | Multi-datacenter, health checks built in | | etcd | gRPC / HTTP | Kubernetes native, key-value | | Kubernetes DNS | DNS (CoreDNS) | K8s-native deployments | | ZooKeeper | TCP | Legacy Java/JVM ecosystems |
NGINX DNS resolver config:
resolver 127.0.0.1:8600 valid=1s; # Consul DNS on port 8600
# valid=1s means NGINX re-queries every second, ignoring DNS TTL
See also:
microservices-fundamentals — When to choose microservices, decomposition patternsmicroservices-resilience — Circuit breaker implementation, health check designmicroservices-communication — Service discovery deep dive, sync vs asyncmicroservices-ai-integration — AI gateway layered on top of this architecturedata-ai
Use when adding AI-powered analytics to a SaaS platform — semantic search over business data, natural language queries, trend detection, anomaly alerts, and AI-generated insights for dashboards. Covers embeddings, NL2SQL, and per-tenant analytics...
data-ai
Design AI-powered analytics dashboards — what metrics to show, how to display AI predictions and confidence, drill-down patterns, KPI cards, trend visualisation, AI Insights panels, export design, and role-based dashboard variants. Invoke when...
development
Use when designing, building, reviewing, or upgrading production software systems that must be secure, performant, maintainable, scalable, and user-centered. Apply before writing specs, code, architecture, APIs, databases, mobile apps, SaaS platforms, or ERP systems.
development
Professional web app UI using commercial templates (Tabler/Bootstrap 5) with strong frontend design direction when needed. Use for CRUD interfaces, dashboards, admin panels with SweetAlert2, DataTables, Flatpickr. Clone seeder-page.php, use...