Skip to content

SeifHesham2/SwiftRide

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

9 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

SwiftRide - Ride Sharing Application πŸš—

A full-stack ride-sharing platform built with Spring Boot backend and React frontends, implementing enterprise-level design patterns and modern software architecture.

🎯 Project Overview

SwiftRide is a comprehensive ride-sharing system that manages customers, drivers, employees, trips, payments, and complaints. The application demonstrates professional software engineering practices with clean architecture, design patterns, and scalable solutions.

πŸ—οΈ Architecture & Design Patterns

1. Decorator Pattern - Dynamic Fare Calculation

Implemented for flexible trip pricing with add-on features:

  • BaseTripDecorator: Core trip fare wrapper
  • PremiumTripDecorator: Adds +$25 for premium service
  • ChildSeatTripDecorator: Adds +$15 for child seat option

This allows dynamic fare calculation by stacking decorators on top of the base trip fare.

2. Strategy Pattern - Payment Processing

Multiple payment methods with unified interface:

  • CashPaymentStrategy: Cash payment processing
  • CreditCardPaymentStrategy: Credit card transactions
  • WalletPaymentStrategy: Digital wallet payments

Each strategy implements PaymentStrategy interface for consistent payment handling.

3. Factory Pattern - Payment Method Selection

PaymentFactory dynamically selects the appropriate payment strategy based on payment type, with automatic dependency injection of all available strategies.

4. DTO Pattern - Data Transfer Objects

Clean separation between entities and API responses:

  • Mappers: CarMapper, CustomerMapper, DriverMapper, TripMapper, PaymentMapper, ComplaintMapper, EmployeeMapper
  • DTOs: Prevent over-exposure of entity data and provide API-specific views

5. Repository Pattern - Data Access Layer

DAO interfaces for each entity with JPA implementation:

  • CarDAO, CustomerDAO, DriverDAO, TripDAO, PaymentDAO, ComplaintDAO, EmployeeDAO
  • Clean abstraction over database operations

6. Service Layer Pattern - Business Logic

Separation of concerns with dedicated service classes:

  • Business logic isolated from controllers
  • Transactional management
  • Reusable service methods

πŸš€ Core Features

User Management

  • Three User Roles: Customer, Driver, Employee
  • Profile Management: Photo upload, personal information
  • Secure Authentication: Role-based access control

Trip Management

  • Trip Lifecycle: Request β†’ Pending β†’ Accepted β†’ Completed/Cancelled
  • Real-time Updates: Trip status tracking
  • Driver Assignment: Automatic driver matching
  • Location Services: Pickup and destination management
  • Scheduled Trips: Support for future trip scheduling

Payment System

  • Multiple Payment Methods: Cash, Credit Card, Wallet
  • Dynamic Fare Calculation: Base fare + decorators (premium, child seat)
  • Payment Tracking: Complete payment history
  • Flexible Pricing: Extensible decorator pattern for new pricing features

Complaint System

  • Customer Complaints: Submit and track issues
  • Employee Management: Review and resolve complaints
  • Status Tracking: Pending β†’ Resolved

Messaging & Notifications

  • Email Notifications: Trip confirmations and updates via SMTP
  • RabbitMQ Integration: Asynchronous message processing
  • Event-Driven Architecture: EmailEvent and EmailListener for decoupled communication

File Management

  • Profile Photo Upload: Image storage and retrieval
  • Static File Serving: Uploaded files accessible via API

πŸ› οΈ Technology Stack

Backend

  • Spring Boot 3.3.5 - Core framework
  • Java 17/21 - Programming language
  • MySQL - Relational database
  • Spring Data JPA - ORM and data access
  • Spring Security - Authentication & authorization
  • RabbitMQ - Message queue for async processing
  • Spring Mail - Email notifications (SMTP)
  • Maven - Build and dependency management

Frontend

  • React - UI framework
  • Vite - Build tool
  • React Router - Navigation
  • Axios - HTTP client
  • Tailwind CSS - Styling
  • Dark Mode - Theme toggle support

πŸ“‹ Prerequisites

  • Java 17 or 21
  • MySQL Server
  • RabbitMQ Server
  • Node.js & npm
  • Maven

🐳 Docker Deployment (Recommended)

This project is fully containerized using Docker Compose.

Prerequisites

  • Docker & Docker Compose
  • Local MySQL Server (running on port 3306)

How to Run

  1. Clone the repository:
    git clone https://github.com/SeifHesham2/SwiftRide.git
    cd SwiftRide
  2. Start the application:
    docker-compose up --build
    Note: The application is configured to connect to your local MySQL database via host.docker.internal.

Access the Application


πŸƒ Manual Installation (Alternative)

Backend

./mvnw clean install
./mvnw spring-boot:run

Backend runs on: http://localhost:8080

Customer/Driver Frontend

cd frontend
npm install
npm run dev

Employee Portal

cd employee-portal
npm install
npm run dev

πŸ—οΈ Project Structure

SwiftRide/
β”œβ”€β”€ src/main/java/com/luv2code/springboot/cruddemo/
β”‚   β”œβ”€β”€ controllers/        # REST API endpoints
β”‚   β”œβ”€β”€ service/            # Business logic layer
β”‚   β”œβ”€β”€ dao/                # Data access layer
β”‚   β”œβ”€β”€ entities/           # JPA entities
β”‚   β”œβ”€β”€ dto/                # Data transfer objects
β”‚   β”œβ”€β”€ mapper/             # Entity-DTO mappers
β”‚   β”œβ”€β”€ decorator/          # Decorator pattern (fare calculation)
β”‚   β”œβ”€β”€ strategy/           # Strategy pattern (payment methods)
β”‚   β”œβ”€β”€ factories/          # Factory pattern (payment factory)
β”‚   β”œβ”€β”€ messaging/          # RabbitMQ event handling
β”‚   β”œβ”€β”€ exception/          # Custom exceptions
β”‚   β”œβ”€β”€ handler/            # Global exception handler
β”‚   β”œβ”€β”€ config/             # Spring configuration
β”‚   └── util/               # Utility classes
β”œβ”€β”€ frontend/               # Customer/Driver React app
β”œβ”€β”€ employee-portal/        # Employee React app
β”œβ”€β”€ sql-scripts/            # Database scripts
└── uploads/                # User uploaded files

🎨 Key Entities

  • UserBase: Base class for Customer, Driver, Employee (inheritance)
  • Trip: Ride information with status tracking
  • Car: Vehicle details linked to drivers
  • Payment: Payment records with method and status
  • Complaint: Customer complaint management
  • Enums: TripStatus, PaymentMethod, PaymentStatus, ComplaintStatus, Role

πŸ”’ Security Features

  • Spring Security configuration
  • Role-based access control (Customer, Driver, Employee)
  • Secure password handling
  • CORS configuration for frontend integration

πŸ“§ Email Notifications

Automated email notifications for:

  • Trip acceptance confirmation
  • Trip status updates
  • Driver assignment details

🎨 Frontend Features

  • Responsive Design: Mobile-friendly interface
  • Dark Mode: System-wide theme toggle
  • Real-time Updates: Live trip status
  • Location Autocomplete: Nominatim API integration
  • Profile Management: Photo upload and user info
  • Toast Notifications: User feedback system
  • Inline Validation: Form error handling

Frontend: Vibe coding by Antigravity ✨

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors