Skip to content

This is Ride-Fast application which have functionalities like Rapido or OLA . It is a simple ride sharing application.

Notifications You must be signed in to change notification settings

HarshitPachori/ride_fast

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RIDE FAST - A Cab Booking Application

This project is a CAB Booking application by which a user can book a cab by just typing there pickup and destination location. With a robust Backend in Java and Spring Boot & visualy appealing user interface or Frontend in NextJs , Typescript and TailwindCSS & Razorpay Payment Gateway for overall better user experience and easyness, we have developed this application.

TECH STACK

  • Backend : Java, Spring Boot, Spring Security, Spring Data JPA, JWT Authentication, MySQL, Postman, Junit, Mockito, TestContainers, Docker, RestAssured, etc.
  • Frontend : ReactJs, NextJs14, TailwindCSS, Redux-Toolkit Typescript, MaterialUI, etc

Table of Contents

Software and Tools required

  • JDK 17 or more
  • NodeJs
  • Git
  • MySQL Client
  • Docker
  • For Backend (IDE or Editors)
    • IntelliJ Idea (Community / Ultimate)
    • Spring Tool Suite (STS)
    • Eclipse
    • NetBeans
    • Visual Studio Code (VS Code)
  • For Frontend (Editors)
    • Visual Studio Code(VS Code) -> Recommended
    • Sublime Text

Installation

Clone Git Repository to your local machine

git clone https://github.com/HarshitPachori/ride_fast.git

Backend

Running the Server

  • Server Directory

    cd ride_fast_backend
  • Setup Database

    • Go to ride_fast_backend/src/main/resources/application.yaml file and replace the port, url, username, password with your server port address and your mysql credentials.

      server:
        port: 8080
      spring:
        datasource:
          url: jdbc:mysql://localhost:3306/ride_fast_db?createDatabaseIfNotExist=true
          username: root
          password: mysql
        jpa:
          hibernate:
            ddl-auto: update
          show-sql: true
          properties:
            format_sql: true
  • Run Server

    ./mvnw spring-boot:run

Running the Frontend

  • Client Directory

    cd ride_fast_frontend
  • Update or Install Npm Packages

    npm install
  • Move to ride_fast_frontend/next.config.mjs file

    • Replace the following path in destination field with your server url to apply proxy for server so that all our frontend's request to server starting with /api will get redirected to this URL.

       async rewrites() {
        return [
          {
            source: "/api/:path*",
            destination: "http://localhost:8080/api/:path*",
          },
        ];
      },
  • Run Client

    npm run dev

API Endpoints

  • Register User

     @route POST /api/v1/auth/register/user
     @desc Register New User
     @param {String} fullname
     @param {String} mobile
     @param {String} email
     @param {String} password
     @returns {Object} User
     @returns {StatusCode} 201 - Created
     @returns {StatusCode} 400 - Bad Request
  • Login User

     @route POST /api/v1/auth/login
     @desc Login User
     @param {String} email
     @param {String} password
     @param {String} userType
     @returns {Object} {String} accessToken, {String} refreshToken
     @returns {StatusCode} 200 - OK
     @returns {StatusCode} 400 - Bad Request
     @returns {StatusCode} 404 - Not Found
  • Register Driver

     @route POST /api/v1/auth/register/driver
     @desc Register new Driver
     @param {String} fullname
     @param {String} email
     @param {String} password
     @param {String} mobile
     @param {double} latitude
     @param {double} longitude
     @param {String} licenseNumber
     @param {String} licenseState
     @param {String} licenseExpirationDate
     @param {String} company
     @param {String} model
     @param {String} color
     @param {int} year
     @param {String} licensePlate
     @param {int} capacity
     @returns {Object} Driver
     @returns {StatusCode} 201 - Created
     @returns {StatusCode} 400 - Bad Request
  • Login Driver

     @route POST /api/v1/auth/login
     @desc Login Driver
     @param {String} email
     @param {String} password
     @param {String} userType
     @returns {StatusCode} 200 - OK
     @returns {StatusCode} 400 - Bad Request
     @returns {StatusCode} 404 - Not Found
  • Book Ride

     @route POST /api/v1/ride/request
     @desc Book Ride
     @header {Authorization} jwtToken
     @param {String} pickupArea
     @param {String} destinationArea
     @param {double} pickupLatitude
     @param {double} pickupLongitude
     @param {double} destinationLatitude
     @param {double} destinationLongitude
     @returns {Object} Ride
     @returns {StatusCode} 201 - Created
     @returns {StatusCode} 400 - Bad Request

Responses

  • Success Responses

    • Login User/Driver (Success)

      {
        "statusCode": 200,
        "accessToken": "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJqb2huQGdtYWlsLmNvbSIsImlhdCI6MTcxMDY3MjMyMSwiZXhwIjoxNzExNTcyMzIxfQ.LIc-mqKb1-RRsl4W4l4emn0GDfpSXDY1Wy6NfS9-7dY",
        "refreshToken": "dfkjngfngn4gh5nf4z5hg4z5n5hg4xnx",
        "message": "Got All Data Successfuly",
        "success": true
      }
  • Error Responses

    {
      "statusCode": 400,
      "message": "All fields are required",
      "errors": [],
      "success": false
    }
    {
      "statusCode": 404,
      "message": "Resource Not Found with given Id",
      "errors": [],
      "success": false
    }
    {
      "statusCode": 401,
      "message": "You need to be logged in first in order to perform this action",
      "errors": [],
      "success": false
    }
    {
      "statusCode": 501,
      "message": "Internal Server Error",
      "errors": [],
      "success": false
    }
  • Snapshots