How shek-a/membership-app works
Main Components
A. External Layer (Client Interface)
• REST API Endpoints (/member endpoints)
• Supported HTTP methods (GET, POST, PUT, DELETE)
B. Application Layers (following the clean architecture pattern):
1. Handler Layer (Controllers)
• Located in pkg/handler
• Handles HTTP requests/responses
• Input validation and response formatting
2. Service Layer (Business Logic)
• Located in pkg/service
• Contains core business logic
• Member operations implementation
3. Repository Layer (Data Access)
• Located in pkg/repository
• Database operations
• MongoDB interactions
C. Database Layer
• MongoDB instance
• Connection and data flow
D. Supporting Components
• Utils package (pkg/utils)
• Models package (pkg/models)
[Client Requests] → [REST API Layer]
• ↓
[Handler Layer (pkg/handler)]
• ↓
[Service Layer (pkg/service)]
• ↓
[Repository Layer (pkg/repository)]
• ↓
[MongoDB Database]
Important Details
A. Component Responsibilities:
• Handler: Request/Response handling, routing (routes.go)
• Service: Business logic, member operations
• Repository: Data persistence operations
• Utils: Support functions (date, email, ID generation)
B. Data Flow:
• How member data flows through the system
• Request/response transformations
• Validation points
C. Infrastructure:
• Docker container boundaries
• Network ports (8080 for API, 27017 for MongoDB)
Specific Implementation Notes
• The application follows a clear separation of concerns
• Each layer has its own test files
• Utility functions are separated into specific domains (date, email, ID generation)
• Docker composition manages service orchestration