How rifatkasikci/mercury-backend works
Main Components
a) Client Layer:
• External Client Applications (Mobile/Web)
• reCAPTCHA Integration Point
b) API Gateway Layer:
• Express.js Server
• Middleware Components:
• Authentication Middleware
• Rate Limiter
• Validation Middleware
• Error Handling
c) Core Service Layer:
• Authentication Service
• User Management
• Barter System (Adverts & Trade Products)
• Category Management
• Verification System
• Waitlist Management
d) Infrastructure Layer:
• PostgreSQL Database
• Redis Cache
• Email Services (Mailgun/Nodemailer)
[Clients] → [API Gateway/Load Balancer] → [Application Server] → [Services] → [Data Layer]
Key Elements to Emphasize
a) Authentication Flow:
• JWT token generation and verification
• Refresh token mechanism
• Role-based access control
b) Data Flow:
• Repository pattern implementation
• Redis caching strategy
• Database relationships
c) External Services:
• Email service integration (both Mailgun and Nodemailer)
• reCAPTCHA verification flow
Specific Implementation Details
• Rectangles: Services and Controllers
• Hexagons: External Services
• Diamonds: Decision Points
Critical Paths
a) Authentication Flow:
Client → AuthMiddleware → AuthController → UserToken/RefreshToken → Redis/PostgreSQL
b) Barter Transaction Flow:
Client → AdvertController/TradeProductController → Repository → PostgreSQL
c) Email Verification Flow:
VerificationController → MailService → Mailgun/Nodemailer → User Email