How zhxauda9/staymate works
Main Components
a) Client Layer:
• Web Interface (represented by the /web directory)
• External API Clients
b) Application Layer:
• HTTP Server (from internal/server)
• Handlers Layer (internal/handler)
• Service Layer (internal/service)
• Data Access Layer (internal/dal)
c) Infrastructure:
• PostgreSQL Database
• Logging System (internal/myLogger)
• Configuration Management (internal/config)
• Email Service (indicated by mail_handler.go and mail_service.go)
[Client Layer]
• ↓
[HTTP Server Layer]
• ↓
[Handler Layer]
• ↓
[Service Layer]
• ↓
[Data Access Layer]
• ↓
[Database Layer]
Component Relationships
• HTTP requests from clients to handlers
• Handler calls to services
• Service calls to repositories
• Repository interactions with the database
• Cross-cutting concerns like logging and configuration
Detailed Component Breakdown
• BookingHandler
• RoomHandler
• UserHandler
• MailHandler
• BookingService
• RoomService
• UserService
• MailService
• BookingRepository
• RoomRepository
• UserRepository
Technical Details
A technical stack sidebar showing:
• Go 1.22.3
• PostgreSQL
• GORM
• Zerolog
API Layer Details
REST endpoints grouped by resource:
• /bookings endpoints
• /rooms endpoints
• /user endpoints
Additional Notes
• Clean architecture pattern implementation
• Separation of concerns between layers
• Dependency injection flow
• Configuration points and environment variable usage