Architecture patterns
Каталог архитектурных паттернов для Java/Spring: CQRS, гексагональная архитектура, паттерны авторизации (OAuth2/JWT/OIDC), распределённые (saga/outbox/idempotency), отказоустойчивости (timeout/retry/circuit breaker), структурные паттерны микросервисов (API Gateway/BFF/Service Mesh).
Why it matters for UCP. CQRS is a Level 2 option, Hexagonal is part of Level 3 — a natural continuation of UCP. Resilience and distributed patterns are the mandatory foundation for UCP services in production. Auth is the external surface of every service. Part of the learning program.
Seven catalogs of architectural patterns in one section. Each article is a detailed breakdown of a group of patterns with Java/Spring code examples. Most have a paired style guide with R-* rules for AI review.
Articles in this section
- CQRS — separating the read and write models. When to apply it and the cost of eventual consistency. Style guide: CQRS Style Guide.
- Hexagonal architecture — Ports & Adapters, isolating the domain from infrastructure, ArchUnit. Style guide: Hexagonal Style Guide.
- Authorization patterns — OAuth2, JWT, OIDC, RBAC/ABAC, mTLS. Style guide: Auth Patterns Style Guide.
- Distributed patterns — Saga, Outbox, Idempotency, abandoning 2PC, eventual consistency. Style guide: Distributed Patterns Style Guide.
- Resilience patterns — Timeout, Retry, Circuit Breaker, Bulkhead, Fallback, Rate Limit. Style guide: Resilience Style Guide.
- Structural microservice patterns — API Gateway, BFF, Sidecar, Service Mesh, Strangler Fig, ACL.
- Batch processing: from a
@Scheduledloop to a task queue — a walkthrough of background processing on real code: SKIP LOCKED, task leasing, retries, Spring Batch, a broker.
Related
- DDD patterns — strategic, tactical, and integration patterns for modeling the domain.
- Use Case Pattern — the methodology that ties these patterns into a single workflow.
- End-to-end marketplace case study — how the patterns apply end-to-end on a single business domain.
- Architectural choice — monolith vs microservices, PostgreSQL vs MongoDB.