How abdulkarim1422/bloodsapp works
Main Components
a. Client Layer:
• HTML Templates (from /templates directory)
• Static Assets (CSS/JS)
• Client-side JavaScript for form handling and interactions
b. API/Web Layer:
• Gin Web Framework
• Router Layer (/routers)
• Middleware Layer (/middlewares)
• Handler Layer (/handlers)
c. Service Layer (/services):
• Authentication Service
• Donation Service
• Matching Service
• Email Service
• Location Service
• HTML Rendering Service
d. Repository Layer (/repositories):
• Auth Repository
• Donor Repository
• Patient Repository
• Request Repository
e. Data Layer:
• PostgreSQL Database
• GORM ORM
• Models (/models)
f. External Services:
• Email System
• Location Services
[Client Layer] → [API Layer] → [Service Layer] → [Repository Layer] → [Data Layer]
• ↑ ↕ ↓
• [Middleware] [External Services] [Models]
Specific Component Details
a. Client Layer:
• Main templates (dashboard, forms, match results)
• Static asset management
• JavaScript modules for form handling and matching
b. API Layer:
• Route groups (auth, donate, donor, patient, match)
• Middleware integration (auth, methods)
• Handler flow
c. Service Layer:
• Related services (auth, donation, matching)
• Email and feedback service integration
• Location services
d. Repository Layer:
• CRUD operations for each entity
• Relationship with models
• Database interactions
e. Data Layer:
• Database schema relationships
• Model structures
• GORM integration
Authentication Flow
Login Template → Auth Handler → Auth Service → Auth Repository → Database
Donation Matching Flow
Match Form → Match Handler → Match Service →
Donor/Patient Repositories → Database
Feedback Flow
Service Layer → Feedback Service → Email Service → External Email Provider
Technical Stack Callouts
• Gin framework integration
• PostgreSQL and GORM interaction
• Template rendering system
• External service integration points