A modern, full-stack crowdfunding platform built with Django REST Framework and React. This application allows users to create campaigns, make donations, and track funding progress in real-time.
- Features
- Tech Stack
- Project Structure
- Prerequisites
- Installation
- Configuration
- Running the Application
- API Documentation
- Database Schema
- Development
- Deployment
- Contributing
- License
- User Authentication & Authorization: JWT-based authentication with custom user model
- Campaign Management: Create, edit, and manage crowdfunding campaigns
- Donation System: Secure donation processing with anonymous options
- Real-time Progress Tracking: Live updates on campaign funding progress
- Responsive Design: Modern UI with dark/light theme support
- Social Authentication: OAuth integration with Google and other providers
- User registration and login
- Profile management
- Campaign creation and editing
- Donation history
- Campaign browsing and search
- Real-time notifications
- User management
- Campaign moderation
- Donation tracking
- Analytics dashboard
- Framework: Django 5.2.4
- API: Django REST Framework 3.16.0
- Authentication: JWT (djangorestframework-simplejwt 5.5.0)
- User Management: Djoser 2.3.1
- Social Auth: social-auth-app-django 5.5.1
- Database: PostgreSQL (psycopg2-binary 2.9.10)
- CORS: django-cors-headers 4.7.0
- Environment: python-dotenv 1.1.1
- Framework: React 19.1.0
- Build Tool: Vite 7.0.0
- Routing: React Router DOM 7.6.3
- State Management: Redux Toolkit 2.8.2
- UI Framework: Bootstrap 5.3.7 + React Bootstrap 2.10.10
- HTTP Client: Axios 1.10.0
- Form Handling: Formik 2.4.6 + Yup 1.6.1
- Date Handling: Day.js 1.11.13
- Material UI: @mui/material 7.2.0
- Linting: ESLint 9.29.0
- Package Manager: npm
- Version Control: Git
Django-React/
βββ backend/ # Django backend application
β βββ app/ # Custom user app
β β βββ models.py # Custom User model
β β βββ serializers.py # User serializers
β β βββ views.py # User views
β β βββ urls.py # User URLs
β βββ project/ # Campaign and donation app
β β βββ models.py # Campaign and Donation models
β β βββ serializers.py # Project serializers
β β βββ views.py # Project views
β β βββ permissions.py # Custom permissions
β β βββ urls.py # Project URLs
β βββ core/ # Django project settings
β β βββ settings.py # Django settings
β β βββ urls.py # Main URL configuration
β β βββ wsgi.py # WSGI configuration
β βββ manage.py # Django management script
β βββ requirements.txt # Python dependencies
βββ frontend/ # React frontend application
β βββ src/
β β βββ components/ # Reusable React components
β β β βββ Layout.jsx # Main layout component
β β β βββ Navbar.jsx # Navigation component
β β βββ pages/ # Page components
β β β βββ Home.jsx # Home page
β β β βββ Login.jsx # Login page
β β β βββ Register.jsx # Registration page
β β β βββ CreateProject.jsx # Campaign creation
β β β βββ EditProject.jsx # Campaign editing
β β β βββ MyProjects.jsx # User's projects
β β βββ context/ # React context providers
β β β βββ ThemeContext.jsx # Theme management
β β βββ App.jsx # Main App component
β β βββ main.jsx # Application entry point
β βββ package.json # Node.js dependencies
β βββ vite.config.js # Vite configuration
β βββ index.html # HTML template
βββ venv/ # Python virtual environment
βββ README.md # Project documentation
Before running this application, ensure you have the following installed:
- Python 3.8+
- Node.js 16+
- npm (comes with Node.js)
- PostgreSQL (for production)
- Git
git clone https://github.com/ASalem020/Django-React.git
cd Django-React
# Create and activate virtual environment
python -m venv venv
# On Windows
venv\Scripts\activate
# On macOS/Linux
source venv/bin/activate
# Install Python dependencies
pip install -r requirements.txt
# Set up environment variables
cp .env.example .env
# Edit .env with your configuration
cd frontend
npm install
cd backend
python manage.py makemigrations
python manage.py migrate
python manage.py createsuperuser
Create a .env
file in the backend directory:
# Django Settings
SECRET_KEY=your-secret-key-here
DEBUG=True
ALLOWED_HOSTS=localhost,127.0.0.1
# Database Configuration
DATABASE_URL=postgresql://username:password@localhost:5432/fundme_db
# JWT Settings
JWT_SECRET_KEY=your-jwt-secret-key
# CORS Settings
CORS_ALLOWED_ORIGINS=http://localhost:5173,http://127.0.0.1:5173
# Social Authentication (Optional)
GOOGLE_CLIENT_ID=your-google-client-id
GOOGLE_CLIENT_SECRET=your-google-client-secret
-
Start the Django Backend:
cd backend python manage.py runserver
The API will be available at
http://localhost:8000
-
Start the React Frontend:
cd frontend npm run dev
The frontend will be available at
http://localhost:5173
-
Build the Frontend:
cd frontend npm run build
-
Configure Django for Production:
- Set
DEBUG=False
- Configure static files
- Set up a production database
- Use a production WSGI server (Gunicorn)
- Set
POST /auth/users/
- User registrationPOST /auth/jwt/create/
- Login (get JWT tokens)POST /auth/jwt/refresh/
- Refresh JWT tokenPOST /auth/jwt/verify/
- Verify JWT tokenGET /auth/users/me/
- Get current user profile
GET /api/campaigns/
- List all campaignsPOST /api/campaigns/
- Create a new campaignGET /api/campaigns/{id}/
- Get campaign detailsPUT /api/campaigns/{id}/
- Update campaignDELETE /api/campaigns/{id}/
- Delete campaign
GET /api/campaigns/{id}/donations/
- Get campaign donationsPOST /api/campaigns/{id}/donations/
- Make a donationGET /api/users/me/donations/
- Get user's donation history
username
- Unique usernameemail
- Unique email addressphone
- Egyptian phone number (11 digits starting with 01)password
- Hashed passworddate_joined
- Account creation date
owner
- Foreign key to Usertitle
- Campaign titledescription
- Campaign descriptiontarget_amount
- Funding goalstart_date
- Campaign start dateend_date
- Campaign end datecreated_at
- Creation timestampupdated_at
- Last update timestamp
campaign
- Foreign key to Campaigndonor
- Foreign key to User (nullable for anonymous)amount
- Donation amountdonation_date
- Donation timestampmessage
- Optional donor message
- Python: Follow PEP 8 guidelines
- JavaScript: Use ESLint configuration
- React: Use functional components with hooks
cd backend
python manage.py makemigrations
python manage.py migrate
-
Set up a production server (e.g., Ubuntu with Nginx)
-
Install dependencies:
pip install -r requirements.txt pip install gunicorn
-
Configure environment variables
-
Set up PostgreSQL database
-
Configure Nginx as reverse proxy
-
Use Gunicorn as WSGI server
-
Build the application:
npm run build
-
Deploy to a static hosting service:
- Netlify
- Vercel
- AWS S3 + CloudFront
- GitHub Pages
# Backend Dockerfile
FROM python:3.11-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . .
EXPOSE 8000
CMD ["gunicorn", "core.wsgi:application", "--bind", "0.0.0.0:8000"]
- Django REST Framework for the robust API framework
- React team for the amazing frontend library
- Bootstrap for the responsive UI components
- All contributors and supporters
Made with β€οΈ by the Crowd Spark Team