Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/harshitpachori/ride_fast

This is Ride-Fast application which have functionalities like Rapido or OLA . It is a simple ride sharing application.
https://github.com/harshitpachori/ride_fast

docker java junit5 jwt-authentication lombok material-ui maven mockito mysql nextjs14 payment-gateway razorpay spring-boot spring-data-jpa spring-security swagger-ui tailwindcss testcontainers tsx typescript

Last synced: about 15 hours ago
JSON representation

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

Awesome Lists containing this project

README

        

# `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](#software-and-tools-required)
- [Installation](#installation)
- [Running the Server](#running-the-server)
- [Running the Frontend](#running-the-frontend)
- [API Endpoints](#api-endpoints)
- [Register User](#register-user)
- [Login User](#login-user)
- [Register Driver](#register-driver)
- [Login Driver](#login-driver)
- [Book Ride](#book-ride)
- [Accept Ride](#accept-ride)
- [Start Ride](#start-ride)
- [Complete Ride](#complete-ride)
- [Decline Ride](#decline-ride)
- [Get Ride By Id](#get-ride-by-id)
- [Requested Rides By User](#request-rides-by-user)
- [Completed Rides By User](#completed-rides-by-user)
- [Completed Rides By Driver](#completed-rides-by-driver)
- [Cancelled Rides By Driver](#cancelled-rides-by-driver)
- [Responses](#responses)
- [Success Responses](#success-responses)
- [Error Responses](#error-responses)
- [Postman Collection](#postman-collection)
- [Snapshots](#snapshots)

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

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

### Backend

## Running the Server

- Server Directory

```bash
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.

```yaml
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
```bash
./mvnw spring-boot:run
```

## Running the Frontend

- Client Directory

```bash
cd ride_fast_frontend
```

- Update or Install Npm Packages
```bash
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.

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

- Run Client

```bash
npm run dev
```

## API Endpoints

- ### Register User

```java
@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

```java
@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

```java
@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

```java
@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

```java
@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)

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

- ### Error Responses

```json
{
"statusCode": 400,
"message": "All fields are required",
"errors": [],
"success": false
}
```

```json
{
"statusCode": 404,
"message": "Resource Not Found with given Id",
"errors": [],
"success": false
}
```

```json
{
"statusCode": 401,
"message": "You need to be logged in first in order to perform this action",
"errors": [],
"success": false
}
```

```json
{
"statusCode": 501,
"message": "Internal Server Error",
"errors": [],
"success": false
}
```

- ## Snapshots