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.
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
- Software and Tools required
- Installation
- Running the Server
- Running the Frontend
- API Endpoints
- Responses
- Postman Collection
- Snapshots
- 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
- Visual Studio Code(VS Code) ->
git clone https://github.com/HarshitPachori/ride_fast.git
-
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 serverport
address and yourmysql
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
-
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
-
@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
-
@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
-
@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
-
@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
-
@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
-
-
Login User/Driver (Success)
{ "statusCode": 200, "accessToken": "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJqb2huQGdtYWlsLmNvbSIsImlhdCI6MTcxMDY3MjMyMSwiZXhwIjoxNzExNTcyMzIxfQ.LIc-mqKb1-RRsl4W4l4emn0GDfpSXDY1Wy6NfS9-7dY", "refreshToken": "dfkjngfngn4gh5nf4z5hg4z5n5hg4xnx", "message": "Got All Data Successfuly", "success": true }
-
-
{ "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 }