Home - Hala-f-Habash/Support-Orphans GitHub Wiki
Home
Project Overview
HopeConnect is a comprehensive, full-stack Node.js-based platform dedicated to supporting orphans and orphanages through coordinated donations, resource distribution, and efficient orphanage management. It enables donors, sponsors, volunteers, and administrators to interact securely with verified orphanages while facilitating logistics for physical donations and ensuring transparency through reviews, reporting, and real-time tracking. The system streamlines key operations such as driver assignment, logistics coordination, and orphan tracking, empowering stakeholders with a centralized interface to manage resources, deliveries, and welfare updates. With features like role-based access, emergency campaigns, volunteer-service matching, Google Maps and email integration, and sustainable revenue models, HopeConnect fosters community engagement, enhances orphan well-being, and promotes accountability at every level.
Architecture
Layered Architecture
Separation of Concerns
-
Middleware: Handles authentication (via JWT), and uploads images
-
Routes: Define RESTful endpoints (
/api/orphanages
,/api/donations
, etc.) and route requests to their respective controllers. Clean mapping between HTTP verbs and CRUD operations. They validate input (via middleware). -
Controllers: Interface between HTTP requests and services. Check for authorization, call business logic, and return responses.
-
Services: Encapsulate business rules and workflows (e.g., assigning drivers to deliveries, verifying orphanages, sponsorship matching, donation fee processing, and email notification). Services coordinate with repositories and enforce domain-specific logic.
-
Repositories (Persistence Layer): Perform raw SQL operations using
mysql2
. Repositories handle all database interactions, enabling service logic to remain decoupled from DB specifics. -
Validation: Uses
express-validator
to validate and sanitize request data. Central to ensuring that only valid and secure input is processed.
why Layered Architecture?
Scalability and Maintainability
- Each layer can evolve independently.
- Supports multiple user roles (admin, orphanageManager, volunteer, donor, sponsor).
- Easy to add features like analytics, dashboards, or third-party APIs.
Enhanced Testability
- Isolated layers can be tested independently, facilitating unit testing and integration testing. This independent testing approach can improve the reliability and quality of the software.
Libraries & Frameworks
Library | Purpose |
---|---|
Express.js | Core web framework handling routing, middleware, and server logic. |
Cors | Enables secure cross-origin API access for web frontends. |
Body-parser | Parses incoming JSON and form-encoded request bodies. |
Express-validator | Provides validation middleware for request data. |
jsonwebtoken (JWT) | Used for secure stateless authentication of users. |
MySQL | Relational DBMS for managing orphanage, user, and donation data. Relationships are leveraged via foreign keys. |
dotenv | Loads environment variables from .env file |
multer | Handles image/file uploads (e.g., orphan profile photos) |
nodemailer | Sends email notifications (e.g., sponsor matched, campaign alerts) |
axios | For calling external APIs like Google Maps , openstreetmap |
Tools
Postman
Used for:
- Manual and automated API testing
- Verifying JWT-protected endpoints
- Sharing documented API collections with team members