Skip to content

ASalem020/Django-React

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

33 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ Crowd Spark - Crowdfunding Platform

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.

πŸ“‹ Table of Contents

✨ Features

Core Features

  • 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 Features

  • User registration and login
  • Profile management
  • Campaign creation and editing
  • Donation history
  • Campaign browsing and search
  • Real-time notifications

Admin Features

  • User management
  • Campaign moderation
  • Donation tracking
  • Analytics dashboard

πŸ› οΈ Tech Stack

Backend (Django)

  • 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

Frontend (React)

  • 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

Development Tools

  • Linting: ESLint 9.29.0
  • Package Manager: npm
  • Version Control: Git

πŸ“ Project Structure

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

πŸ“‹ Prerequisites

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

πŸš€ Installation

1. Clone the Repository

git clone https://github.com/ASalem020/Django-React.git
cd Django-React

2. Backend Setup

# 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

3. Frontend Setup

cd frontend
npm install

4. Database Setup

cd backend
python manage.py makemigrations
python manage.py migrate
python manage.py createsuperuser

βš™οΈ Configuration

Environment Variables

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

πŸƒβ€β™‚οΈ Running the Application

Development Mode

  1. Start the Django Backend:

    cd backend
    python manage.py runserver

    The API will be available at http://localhost:8000

  2. Start the React Frontend:

    cd frontend
    npm run dev

    The frontend will be available at http://localhost:5173

Production Mode

  1. Build the Frontend:

    cd frontend
    npm run build
  2. Configure Django for Production:

    • Set DEBUG=False
    • Configure static files
    • Set up a production database
    • Use a production WSGI server (Gunicorn)

πŸ“š API Documentation

Authentication Endpoints

  • POST /auth/users/ - User registration
  • POST /auth/jwt/create/ - Login (get JWT tokens)
  • POST /auth/jwt/refresh/ - Refresh JWT token
  • POST /auth/jwt/verify/ - Verify JWT token
  • GET /auth/users/me/ - Get current user profile

Campaign Endpoints

  • GET /api/campaigns/ - List all campaigns
  • POST /api/campaigns/ - Create a new campaign
  • GET /api/campaigns/{id}/ - Get campaign details
  • PUT /api/campaigns/{id}/ - Update campaign
  • DELETE /api/campaigns/{id}/ - Delete campaign

Donation Endpoints

  • GET /api/campaigns/{id}/donations/ - Get campaign donations
  • POST /api/campaigns/{id}/donations/ - Make a donation
  • GET /api/users/me/donations/ - Get user's donation history

πŸ—„οΈ Database Schema

User Model

  • username - Unique username
  • email - Unique email address
  • phone - Egyptian phone number (11 digits starting with 01)
  • password - Hashed password
  • date_joined - Account creation date

Campaign Model

  • owner - Foreign key to User
  • title - Campaign title
  • description - Campaign description
  • target_amount - Funding goal
  • start_date - Campaign start date
  • end_date - Campaign end date
  • created_at - Creation timestamp
  • updated_at - Last update timestamp

Donation Model

  • campaign - Foreign key to Campaign
  • donor - Foreign key to User (nullable for anonymous)
  • amount - Donation amount
  • donation_date - Donation timestamp
  • message - Optional donor message

πŸ› οΈ Development

Code Style

  • Python: Follow PEP 8 guidelines
  • JavaScript: Use ESLint configuration
  • React: Use functional components with hooks

Database Migrations

cd backend
python manage.py makemigrations
python manage.py migrate

πŸš€ Deployment

Backend Deployment (Django)

  1. Set up a production server (e.g., Ubuntu with Nginx)

  2. Install dependencies:

    pip install -r requirements.txt
    pip install gunicorn
  3. Configure environment variables

  4. Set up PostgreSQL database

  5. Configure Nginx as reverse proxy

  6. Use Gunicorn as WSGI server

Frontend Deployment (React)

  1. Build the application:

    npm run build
  2. Deploy to a static hosting service:

    • Netlify
    • Vercel
    • AWS S3 + CloudFront
    • GitHub Pages

Docker Deployment

# 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"]

πŸ™ Acknowledgments

  • 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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •