How wernerreyes/c24_5_2024-1_g8b_vamosexpeditions-backend works
Main System Components
a) Presentation Layer (API Layer)
• Controllers, Routes, and Services for:
• Authentication
• Clients
• Hotels
• Reservations
• Quotations
• Version Quotations
• Countries
b) Domain Layer
• Entities
• DTOs (Data Transfer Objects)
• Error Handling
c) Core Layer
• Adapters (BCrypt, JWT, Cache)
• Constants
• Utils
d) Data Layer
• PostgreSQL Database
• Prisma ORM
e) External Services
• Email Service (Nodemailer)
• PDF Generation (PDFMake)
Component Relationships
a) Client Request Flow:
Client Request → Routes → Controllers → Services → Domain Layer ↔ Data Layer
b) Authentication Flow:
Auth Request → Auth Controller → JWT Adapter → User Entity ↔ Database
c) External Services Integration:
Services → Email Service
Services → PDF Service
Specific Design Elements
Use the following visual elements:
• Hexagons: Core business entities
• Blue: Presentation Layer
• Green: Domain Layer
• Yellow: Core Layer
• Red: Data Layer
• Purple: External Services
Key Architectural Patterns to Highlight
a) Clean Architecture:
• Clear separation between layers
• Demonstrate dependency flow from outer to inner layers
• Domain-driven design approach
b) Repository Pattern:
• Data access abstraction through Prisma
• Separation between business logic and data access
c) Adapter Pattern:
• External service integrations
• How core functionality is adapted to external services
Important Details
a) Authentication & Authorization:
• JWT flow
• Middleware placement
• Role-based access control
b) Data Flow:
• DTO transformations
• Entity relationships
• Validation points
c) External Integrations:
• Email service connection
• PDF generation flow
• External API connections (if any)
Technical Stack Indicators
• Node.js + Express
• TypeScript
• Prisma ORM
• PostgreSQL
• JWT
• BCrypt
• Nodemailer
• PDFMake