A platform for transparent charitable donations where donors support verified organizations through campaigns. Administrators moderate and approve campaigns to ensure trust and accountability. The project focuses on transparency, traceability of donations, and clear campaign management.
- Overview
- Roles and Use Cases
- Features
- Architecture
- Data Model (ERD)
- Statuses and Rules
- API (Draft Structure)
- Running the Project
- Project Structure
- Development Plan and Contribution
- Diagrams
The Charity Service Platform connects donors with charitable organizations through fundraising campaigns. Organizations create campaigns, donors make contributions, and administrators review and approve campaigns before they become publicly available.
-
Donor
- Browse campaigns
- Donate to campaigns
- View personal donation history
-
Organization
- Register an organization
- Create and manage campaigns
- Submit campaigns for approval
- View reports and analytics
-
Administrator
- Approve or reject campaigns
- Moderate users and content
- View moderation records and platform reports
- User registration and authentication
- Role-based access (Donor / Organization / Admin)
- Organization registration and verification
- Campaign creation and management
- Donation processing and donation history
- Administrative moderation tools
- Campaign and organization donation summaries
- Campaign categories and tags
- Donation comments
- Basic analytics and reporting export
The system follows a layered (clean) architecture:
-
API (HTTP layer)
- Router (mux) and middleware
- Request handlers
-
Service layer (Business Logic)
- AuthService
- CampaignService
- DonationService
-
Repository layer (Data Access)
- UserRepo
- OrgRepo
- CampaignRepo
- DonationRepo
- ModerationRepo
-
Domain layer
- Entities: User, Organization, Campaign, Donation, ModerationRecord
-
Integrations (could be)
- Payment gateway
- Email / SMS notifications
-
Database
- PostgreSQL
Users
user_id : UUIDname : stringemail : string (unique)password_hash : stringrole : DONOR | ORG | ADMINcreated_at : datetime
Organizations
org_id : UUIDowner_user_id : UUID (FK → Users)name : stringdescription : textstatus : PENDING | APPROVED | SUSPENDEDcreated_at : datetime
Campaigns
campaign_id : UUIDorg_id : UUID (FK → Organizations)title : stringdescription : texttarget_amount : decimalcurrent_amount : decimalstatus : DRAFT | PENDING | APPROVED | REJECTED | PAUSED | ENDEDstart_date : dateend_date : datecreated_at : datetime
Donations
donation_id : UUIDcampaign_id : UUID (FK → Campaigns)donor_user_id : UUID (FK → Users)amount : decimalpayment_ref : stringstatus : PENDING | PAID | FAILED | REFUNDEDcreated_at : datetime
ModerationRecords
moderation_id : UUIDcampaign_id : UUID (FK → Campaigns)admin_user_id : UUID (FK → Users)reason : textaction : APPROVE | REJECTcreated_at : datetime
PENDINGAPPROVEDSUSPENDED
DRAFTPENDINGAPPROVEDREJECTEDPAUSEDENDED
PENDINGPAIDFAILEDREFUNDED
APPROVEREJECT
This is a high-level API outline based on the architecture and diagrams. Final routes may differ.
POST /auth/register– Register a new userPOST /auth/login– Login and get JWT token
Register Example:
curl -X POST http://localhost:8080/auth/register \
-H "Content-Type: application/json" \
-d '{"email": "user@example.com", "name": "John Doe", "password": "secret123"}'Login Example:
curl -X POST http://localhost:8080/auth/login \
-H "Content-Type: application/json" \
-d '{"email": "user@example.com", "password": "secret123"}'Response:
{
"user": {
"id": "uuid",
"email": "user@example.com",
"name": "John Doe"
},
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}Use the JWT token in the Authorization header:
curl -X GET http://localhost:8080/me \
-H "Authorization: Bearer <your-jwt-token>"GET /campaigns– browse campaigns (public)GET /campaigns/{id}– campaign details (public)POST /campaigns– create campaign (requires auth)PUT /campaigns/{id}– update campaign (requires auth, owner only)DELETE /campaigns/{id}– end campaign (requires auth, owner only)
POST /donations– donate to a campaign (requires auth)GET /my/donations– view user's donation history (requires auth)GET /campaigns/{id}/donations– view campaign donations (public)
GET /users– list all users (public)GET /users/{id}– get user by ID (public)GET /me– get current user (requires auth)PUT /me– update current user (requires auth)DELETE /me– delete current user (requires auth)
Copy .env.example to .env and configure:
| Variable | Description | Default |
|---|---|---|
SERVER_PORT |
Port to run the server | 8080 |
JWT_SECRET |
Secret key for JWT signing | your-super-secret-key-change-in-production |
JWT_EXPIRATION_HOURS |
JWT token expiration in hours | 24 |
DB_HOST |
PostgreSQL host | localhost |
DB_PORT |
PostgreSQL port | 5432 |
DB_USER |
PostgreSQL user | postgres |
DB_PASSWORD |
PostgreSQL password | postgres |
DB_NAME |
PostgreSQL database name | crowdfunding |
DB_SSLMODE |
PostgreSQL SSL mode | disable |
- Go 1.21+
- Node.js 20+ (for frontend and fake services)
- PostgreSQL 14+
- Docker 24+
- Docker Compose 2.20+
Deploy the entire stack with a single command:
# Clone the repository
git clone https://github.com/your-username/final-project.git
cd final-project
# Create environment file
cp .env.example .env
# Edit .env with secure values for production
# Start all services
docker-compose up -d --buildThis starts:
- PostgreSQL database
- Go Backend API on internal port 8080
- React Frontend served via nginx
- Fake Services (payment & approval simulation) on internal port 3001
- Nginx reverse proxy on ports 80/443
- Main Application: http://apex.maqsatto.tech (or http://localhost)
- API Endpoints: http://apex.maqsatto.tech/api/
- Fake Services: http://apex.maqsatto.tech/fake-api/
# View logs
docker-compose logs -f
# View specific service logs
docker-compose logs -f backend
# Restart a service
docker-compose restart backend
# Stop all services
docker-compose down
# Stop and remove volumes (clears database)
docker-compose down -v
# Rebuild specific service
docker-compose up -d --build backend# Create the database
psql -U postgres -c "CREATE DATABASE crowdfunding;"# Copy example env file
cp .env.example .env
# Edit .env with your database credentialsgo mod tidy
go run .cd frontend
npm install
npm run devcd internal/utils
npm install
npm startThe server will automatically run database migrations on startup.
- SSH into server
ssh root@164.92.192.185- Install Docker
curl -fsSL https://get.docker.com -o get-docker.sh
sh get-docker.sh- Clone and deploy
git clone https://github.com/your-username/final-project.git
cd final-project
cp .env.example .env
nano .env # Configure secure values
docker-compose up -d --build- Install certificates (using Let's Encrypt):
mkdir -p nginx/ssl
certbot certonly --standalone -d apex.maqsatto.tech
cp /etc/letsencrypt/live/apex.maqsatto.tech/fullchain.pem nginx/ssl/
cp /etc/letsencrypt/live/apex.maqsatto.tech/privkey.pem nginx/ssl/-
Uncomment HTTPS configuration in
nginx/nginx.conf -
Restart nginx:
docker-compose restart nginx├── Dockerfile # Go backend Docker build
├── docker-compose.yml # Multi-service orchestration
├── main.go # Application entry point
├── frontend/
│ ├── Dockerfile # Frontend Docker build
│ ├── nginx.conf # Frontend nginx config
│ └── src/ # React application
├── internal/
│ ├── config/ # Configuration management
│ ├── database/ # Database connection
│ ├── domain/ # Domain entities
│ ├── http/ # HTTP layer (handlers, middleware, router)
│ ├── repository/ # Data access layer
│ ├── service/ # Business logic
│ ├── utils/ # Fake payment/approval services
│ │ ├── Dockerfile
│ │ ├── server.js
│ │ ├── paymentService.js
│ │ └── approvalService.js
│ └── worker/ # Background workers
├── nginx/
│ └── nginx.conf # Reverse proxy configuration
└── docs/ # Documentation
All diagrams and design documents are located in the /docs directory:
- Use-Case Diagram – user roles and system interactions
- ERD (Entity-Relationship Diagram) – database structure and relations
- UML / Architecture Diagram – layered architecture (API, services, repositories, database)
- Project Proposal – system description, requirements, and milestones