How borjapazr/express-typescript-skeleton works
Main Components
a. Presentation Layer (REST API):
• Controllers (Authentication, Health, Users)
• Middleware (Authentication, Error Handling, Logging)
• API Documentation (Swagger/OpenAPI)
b. Application Layer:
• Use Cases (Sessions, Users, Health)
• Request/Response DTOs
c. Domain Layer:
• Entities (User, Session)
• Value Objects
• Domain Services
• Repository Interfaces
d. Infrastructure Layer:
• Database Implementations (Prisma - PostgreSQL)
• Caching (Redis)
• Authentication (JWT)
• Logging (Pino)
e. External Services:
• PostgreSQL Database
• Redis Cache
[Client Applications]
• ↓
[Presentation Layer (REST API)]
• ↓
[Application Layer (Use Cases)]
• ↓
[Domain Layer (Business Logic)]
• ↓
[Infrastructure Layer]
• ↓
[External Services]
Specific Implementation Details
Key architectural elements:
a. REST API Layer:
• Main endpoints (/api/health, /api/users, /api/auth)
• Middleware chain
• OpenAPI/Swagger documentation
b. Authentication Flow:
• JWT token generation and validation
• Session management
• User authentication process
c. Data Flow:
• Repository pattern implementation
• Prisma ORM integration
• Redis caching strategy
d. Cross-Cutting Concerns:
• Error handling
• Logging
• Configuration management
Technical Stack Callouts
Technologies:
• Node.js & Express
• TypeScript
• Prisma ORM
• Redis
• PostgreSQL
• JWT
• Pino Logger
Deployment View
A separate section showing:
• Docker containers
• Database connections
• Cache connections
• API endpoints
• Clean Architecture principles
• Dependency flow (always inward)
• Clear separation of concerns
• Infrastructure independence
• Domain-driven design elements
Remember to emphasize the modular nature of the application and how the different layers interact while maintaining loose coupling through dependency injection and interfaces.
This system design should help developers understand both the high-level architecture and the specific implementation details of this Express TypeScript application.