Skip to content

JimmYCHUU/GoDrive

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

GoDrive — Ride-Sharing Database Management System

PHP MySQL Node.js Express.js JWT

A database management system for ride-sharing applications — efficiently managing users, drivers, rides, and transactions with optimized real-time request handling, secure authentication, and scalable data architecture.


Architecture

┌─────────────┐     ┌───────────────────────────────────────────────┐
│   React     │     │  Node.js / Express API                       │
│   Frontend  │◄───►│  ┌─────────────────────────────────────────┐  │
│   (Optional)│     │  │  Auth Middleware (JWT)                  │  │
│             │     │  │  Ride Logic                             │  │
│             │     │  │  Payment Processing                     │  │
│             │     │  │  Real-time Request Handler              │  │
│             │     │  └─────────────────────────────────────────┘  │
└─────────────┘     └───────────────────┬───────────────────────────┘
                                        │
                              ┌─────────▼─────────┐
                              │     MySQL 8.0     │
                              │  ┌─────────────┐  │
                              │  │   users     │  │
                              │  │   drivers   │  │
                              │  │   rides     │  │
                              │  │   payments  │  │
                              │  │   ratings   │  │
                              │  └─────────────┘  │
                              └───────────────────┘

Features

👥 User & Driver Management

  • Registration & Profiles — Register, log in, manage personal profiles
  • Driver Onboarding — Vehicle registration, document verification, availability toggling
  • Role-Based Access — Distinct user/driver/admin dashboards with permission control

🚗 Ride Management

  • Real-Time Requests — Handle ride requests with live driver assignment
  • Ride Lifecycle — Initiation → acceptance → ride in progress → completion
  • Status Tracking — Real-time ride status updates with timestamps

💳 Transactions & Payments

  • Transaction History — Complete ledger of all completed rides and payments
  • Payment Processing — Secure payment flow between riders and drivers
  • Invoice Generation — Per-ride receipts with fare breakdown

🔐 Security

  • JWT Authentication — Token-based secure access for all endpoints
  • Password Hashing — bcrypt-based credential storage
  • API Protection — Route guards and middleware-level authorization

Database Schema

godrive/
├── users          # Rider accounts (name, email, phone, location, rating)
├── drivers        # Driver profiles (vehicle info, license, availability, rating)
├── rides          # Ride records (pickup/dropoff, status, fare, timestamps)
├── payments       # Transaction records (amount, method, status, ride_id)
├── ratings        # User & driver ratings (score, review, ride_id)
└── ride_requests  # Pending ride requests with real-time matching

Quick Start

Prerequisites

  • PHP 8.2+
  • MySQL 8.0+
  • Node.js 18+
  • Composer

Setup

# 1. Clone the repository
git clone https://github.com/JimmYCHUU/GoDrive.git
cd GoDrive

# 2. Install backend dependencies
npm install

# 3. Configure database
# Import the schema
mysql -u root -p < godrive.sql

# Configure .env with your database credentials
cp .env.example .env

# 4. Start the server
npm start

# → API available at http://localhost:3000

API Endpoints

Method Endpoint Description
POST /api/auth/register Register new user/driver
POST /api/auth/login Authenticate & get JWT
GET /api/rides List available rides
POST /api/rides Request a new ride
PUT /api/rides/:id/accept Driver accepts ride
GET /api/rides/history Ride history for user/driver
GET /api/payments Transaction history
POST /api/ratings Submit ride rating

Environment Variables

Variable Description Default
DB_HOST MySQL host localhost
DB_PORT MySQL port 3306
DB_NAME Database name godrive
DB_USER Database user root
DB_PASS Database password
JWT_SECRET JWT signing secret (required)
PORT API server port 3000

License

MIT

About

Go Drive is a database management system for a ride-sharing app, designed to efficiently handle user, driver, and ride data with optimized real-time ride requests, secure authentication, and scalable data management using MySQL and Node.js.

About

Go Drive is a database management system for a ride-sharing app, designed to efficiently handle user, driver, and ride data. The project focuses on optimizing real-time ride requests, user authentication, and transaction history, ensuring secure and scalable data management using MySQL and PHP.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages