What problem does it solve?
Backend architecture guidance that prevents brittle APIs, tangled business logic, slow queries, and inconsistent error handling—by enforcing a standard layered pattern with production-ready concerns.
Core Features & Use Cases
- Layered routing → services → repositories: Keep HTTP concerns in routes, business rules in services, and data access in repositories.
- Database optimization: Prevent N+1 queries, select only needed fields, add indexes for common queries, and use efficient pagination.
- Caching and performance: Implement multi-tier caching with in-memory + Redis + database fallback and correct invalidation on updates.
- Robust error handling: Use custom error classes and centralized error middleware to return consistent status codes and error codes.
- AuthN/AuthZ patterns: Apply authentication middleware and role-based authorization checks on protected endpoints.
- Transactions for critical workflows: Use database transactions for multi-step operations requiring atomicity and auditability.
Quick Start
Ask the AI to generate an Express backend skeleton using the routes → services → repositories pattern with auth middleware, centralized error handling, optimized repository queries (no N+1), Redis caching for hot reads, and transactional updates for a critical operation.