- About The Project
- Key Features
- Tech Stack
- Project Structure
- Getting Started
- Usage
- API Endpoints
- Database Schema
- Deployment
- Contributing
- License
- Contact
Jinete Riders is a comprehensive ride-booking platform designed for seamless urban transportation. Built with Django REST Framework, it provides a robust backend API for connecting passengers with drivers, managing rides, and processing secure payments.
The platform features separate portals for passengers and drivers, real-time ride matching, integrated payment processing via Razorpay, and automated email notifications through SendGrid.
- Scalable Architecture: Built on Django with RESTful API design principles
- Secure Authentication: JWT-based authentication with token management
- Payment Integration: Secure payment processing with Razorpay
- Email Automation: Password reset and notifications via SendGrid
- Production Ready: Deployed on Heroku with PostgreSQL database
- Well Documented: Comprehensive API documentation via Postman
- ✅ User registration and authentication
- ✅ Profile management with ratings
- ✅ Book rides with source and destination
- ✅ Real-time ride status tracking
- ✅ Rate drivers after ride completion
- ✅ Secure payment processing
- ✅ Password reset via email
- ✅ Driver registration with vehicle details
- ✅ Profile management including license information
- ✅ Accept or reject ride requests
- ✅ Update ride status in real-time
- ✅ Rate passengers after ride completion
- ✅ View earnings and ride history
- ✅ JWT token-based authentication
- ✅ Role-based access control (Passenger/Driver)
- ✅ Automated email notifications
- ✅ Payment order creation and verification
- ✅ Rating system for both passengers and drivers
- ✅ RESTful API architecture
- ✅ CORS support for frontend integration
- Django 3.1.14 - High-level Python web framework
- Django REST Framework 3.12.4 - Powerful toolkit for building Web APIs
- PostgreSQL - Production database
- SQLite - Development database
- psycopg2 2.8.6 - PostgreSQL adapter for Python
- PyJWT 2.3.0 - JSON Web Token implementation
- bcrypt 3.2.0 - Password hashing
- django-cors-headers 3.10.0 - CORS handling
- Razorpay 1.2.0 - Payment gateway integration
- SendGrid 6.9.7 - Email delivery service
- Gunicorn 20.1.0 - WSGI HTTP Server
- WhiteNoise 5.3.0 - Static file serving
- django-heroku 0.3.1 - Heroku configuration
- dj-database-url 0.5.0 - Database URL parsing
- python-decouple 3.5 - Environment variable management
- autopep8 1.5.7 - Code formatting
jinete-riders/
├── api/ # Main API application
│ ├── driver/ # Driver management module
│ │ ├── models.py # Driver & Token models
│ │ ├── views.py # Driver endpoints
│ │ ├── serializers.py # Data serialization
│ │ └── urls.py # Driver routes
│ ├── passenger/ # Passenger management module
│ │ ├── models.py # Passenger & Token models
│ │ ├── views.py # Passenger endpoints
│ │ ├── serializers.py # Data serialization
│ │ └── urls.py # Passenger routes
│ ├── ride/ # Ride management module
│ │ ├── models.py # Ride model
│ │ ├── views_driver.py # Driver ride operations
│ │ ├── views_passenger.py # Passenger ride operations
│ │ └── urls.py # Ride routes
│ ├── order/ # Payment & order module
│ │ ├── models.py # Order model
│ │ ├── views.py # Payment endpoints
│ │ └── urls.py # Order routes
│ ├── middleware/ # Custom middleware
│ │ └── auth_strategy.py # Authentication middleware
│ └── utils/ # Utility modules
│ ├── mailer.py # Email functionality
│ ├── payment_status_constants.py
│ └── ride_type_constants.py
├── jinete/ # Project configuration
│ ├── settings.py # Django settings
│ ├── urls.py # Root URL configuration
│ └── wsgi.py # WSGI configuration
├── templates/ # HTML templates
├── manage.py # Django management script
├── requirements.txt # Python dependencies
├── Procfile # Heroku deployment config
└── README.md # Project documentation
Ensure you have the following installed on your system:
- Python 3.8+ - Download Python
- pip - Python package installer (comes with Python)
- PostgreSQL - Download PostgreSQL (for production)
- Git - Download Git
-
Clone the repository
git clone https://github.com/yourusername/jinete-riders.git cd jinete-riders -
Create a virtual environment
# Windows python -m venv venv venv\Scripts\activate # macOS/Linux python3 -m venv venv source venv/bin/activate
-
Install dependencies
pip install -r requirements.txt
-
Set up environment variables
Create a
.envfile in the project root:touch .env
See Environment Variables section for required variables.
-
Run database migrations
python manage.py migrate
-
Create a superuser (optional, for admin access)
python manage.py createsuperuser
-
Run the development server
python manage.py runserver
-
Access the application
- API Base:
http://localhost:8000/api/ - Admin Panel:
http://localhost:8000/admin/
- API Base:
Create a .env file in the root directory and add the following variables:
# Django Configuration
SECRET_KEY=your-django-secret-key-here
ENVIRONMENT=dev # 'dev' for development, 'production' for production
# JWT Authentication
ACCESS_SECRET_TOKEN=your-jwt-secret-token-here
# Password Encryption
BCRYPT_SALT=your-bcrypt-salt-value-here
# SendGrid Email Configuration
SENDGRID_API_KEY=your-sendgrid-api-key
PASSWORD_RESET_EMAIL_TEMPLATE_ID=your-sendgrid-template-id
FROM_EMAIL=[email protected]
# Database (Production)
DATABASE_URL=postgresql://user:password@localhost:5432/jinete_db
# Razorpay Payment Gateway
RAZOR_KEY_ID=your-razorpay-key-id
RAZOR_KEY_SECRET=your-razorpay-secret-key| Variable | Description | Required |
|---|---|---|
SECRET_KEY |
Django secret key for cryptographic signing | ✅ Yes |
ENVIRONMENT |
Environment mode (dev or production) |
✅ Yes |
ACCESS_SECRET_TOKEN |
Secret key for JWT token generation | ✅ Yes |
BCRYPT_SALT |
Salt value for password encryption | ✅ Yes |
SENDGRID_API_KEY |
SendGrid API key for email services | ✅ Yes |
PASSWORD_RESET_EMAIL_TEMPLATE_ID |
SendGrid template ID for password reset emails | ✅ Yes |
FROM_EMAIL |
Sender email address for notifications | ✅ Yes |
DATABASE_URL |
PostgreSQL database connection URL | ✅ Yes (Production) |
RAZOR_KEY_ID |
Razorpay API key ID | ✅ Yes |
RAZOR_KEY_SECRET |
Razorpay API secret key | ✅ Yes |
# Generate Django SECRET_KEY
python -c "from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())"
# Generate ACCESS_SECRET_TOKEN
python -c "import secrets; print(secrets.token_urlsafe(32))"# Standard development server
python manage.py runserver
# Run on a specific port
python manage.py runserver 8080
# Run on all network interfaces
python manage.py runserver 0.0.0.0:8000# Create new migrations
python manage.py makemigrations
# Apply migrations
python manage.py migrate
# Reset database (⚠️ deletes all data)
python manage.py flush
# Create database backup
python manage.py dumpdata > backup.json
# Load database backup
python manage.py loaddata backup.json# Create superuser
python manage.py createsuperuser
# Collect static files
python manage.py collectstatic
# Run Django shell
python manage.py shellBoth passengers and drivers have separate authentication endpoints.
POST /api/passenger/register/- Register new passengerPOST /api/passenger/login/- Passenger loginPOST /api/passenger/logout/- Passenger logoutPOST /api/passenger/forgot-password/- Request password resetGET /api/passenger/profile/- Get passenger profilePUT /api/passenger/profile/- Update passenger profile
POST /api/driver/register/- Register new driverPOST /api/driver/login/- Driver loginPOST /api/driver/logout/- Driver logoutPOST /api/driver/forgot-password/- Request password resetGET /api/driver/profile/- Get driver profilePUT /api/driver/profile/- Update driver profile
POST /api/ride/create/- Create new ride requestGET /api/ride/passenger/rides/- Get all passenger ridesGET /api/ride/passenger/:id/- Get specific ride detailsPOST /api/ride/passenger/:id/rate/- Rate driver after rideDELETE /api/ride/passenger/:id/cancel/- Cancel ride
GET /api/ride/driver/available/- Get available ride requestsPOST /api/ride/driver/:id/accept/- Accept ride requestPOST /api/ride/driver/:id/reject/- Reject ride requestPUT /api/ride/driver/:id/status/- Update ride statusGET /api/ride/driver/rides/- Get all driver ridesPOST /api/ride/driver/:id/rate/- Rate passenger after ride
POST /api/order/create/- Create payment orderPOST /api/order/verify/- Verify payment signatureGET /api/order/:id/- Get order details
For detailed API documentation including request/response schemas, authentication headers, and example requests, visit:
- id (AutoField)
- name (CharField)
- email (CharField, Unique)
- phone (CharField)
- password (CharField, Hashed)
- city (CharField)
- country (CharField)
- profile_image (CharField, Optional)
- rating (FloatField, 0-5)
- created_at (DateTimeField)
- updated_at (DateTimeField)- id (AutoField)
- name (CharField)
- email (CharField, Unique)
- phone (CharField)
- password (CharField, Hashed)
- city (CharField)
- country (CharField)
- profile_image (CharField, Optional)
- rating (FloatField, 0-5)
- car_name (CharField)
- car_number (CharField)
- car_image (CharField)
- driving_license_no (CharField)
- created_at (DateTimeField)
- updated_at (DateTimeField)- id (AutoField)
- driver (ForeignKey → Driver, Nullable)
- passenger (ForeignKey → Passenger, Nullable)
- source (CharField)
- destination (CharField)
- total_cost (IntegerField)
- estimated_time (IntegerField, minutes)
- driver_rating (FloatField, 0-5)
- passenger_rating (FloatField, 0-5)
- ride_status (IntegerField, Choices)
- created_at (DateTimeField)
- updated_at (DateTimeField)- id (AutoField)
- ride (ForeignKey → Ride, Nullable)
- order_id (CharField)
- payment_id (CharField, Optional)
- signature (CharField, Optional)
- price (FloatField)
- payment_status (CharField, Choices)
- created_at (DateTimeField)
- updated_at (DateTimeField)Passenger 1──────* Token
Driver 1─────────* Token
Passenger 1──────* Ride
Driver 1─────────* Ride
Ride 1───────────1 Order
This project is configured for Heroku deployment with the following files:
Procfile- Defines process types and commandsrequirements.txt- Python dependenciesruntime.txt- Python version (optional)
-
Install Heroku CLI
# macOS brew tap heroku/brew && brew install heroku # Windows (use installer from heroku.com)
-
Login to Heroku
heroku login
-
Create Heroku app
heroku create your-app-name
-
Add PostgreSQL addon
heroku addons:create heroku-postgresql:hobby-dev
-
Set environment variables
heroku config:set SECRET_KEY=your-secret-key heroku config:set ACCESS_SECRET_TOKEN=your-jwt-token heroku config:set SENDGRID_API_KEY=your-sendgrid-key # ... set all other environment variables -
Deploy the application
git push heroku main
-
Run migrations
heroku run python manage.py migrate
-
Create superuser
heroku run python manage.py createsuperuser
Click to expand Docker instructions
Create a Dockerfile:
FROM python:3.9-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
EXPOSE 8000
CMD ["gunicorn", "jinete.wsgi:application", "--bind", "0.0.0.0:8000"]Build and run:
docker build -t jinete-riders .
docker run -p 8000:8000 --env-file .env jinete-riders# Run all tests
python manage.py test
# Run tests for specific app
python manage.py test api.passenger
python manage.py test api.driver
python manage.py test api.ride
python manage.py test api.order
# Run with verbosity
python manage.py test --verbosity=2
# Run with coverage (install coverage first: pip install coverage)
coverage run --source='.' manage.py test
coverage report
coverage htmlPlace tests in the tests.py file within each app:
api/passenger/tests.py- Passenger module testsapi/driver/tests.py- Driver module testsapi/ride/tests.py- Ride module testsapi/order/tests.py- Order module tests
Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch
git checkout -b feature/AmazingFeature
- Commit your Changes
git commit -m 'Add some AmazingFeature' - Push to the Branch
git push origin feature/AmazingFeature
- Open a Pull Request
- Follow PEP 8 style guide for Python code
- Use meaningful variable and function names
- Add docstrings to functions and classes
- Write unit tests for new features
- Update documentation for API changes
If you find a bug, please create an issue with:
- Clear title and description
- Steps to reproduce
- Expected vs actual behavior
- Screenshots (if applicable)
- Environment details
This project is licensed under the MIT License - see the LICENSE file for details.
Project Maintainer: Your Name
- 📧 Email: [email protected]
- 🌐 Portfolio: yourportfolio.com
- 💼 LinkedIn: Your LinkedIn
- 🐙 GitHub: @yourusername
Project Link: https://github.com/yourusername/jinete-riders
Live Demo: https://jinete-riders.herokuapp.com/
- Django - The web framework for perfectionists with deadlines
- Django REST Framework - Powerful and flexible toolkit for building Web APIs
- Razorpay - Payment gateway integration
- SendGrid - Email delivery service
- Heroku - Cloud platform for deployment
- PostgreSQL - Advanced open source database