Giter Site home page Giter Site logo

sayeed1999 / ride-sharing-platform Goto Github PK

View Code? Open in Web Editor NEW
2.0 4.0 2.0 1.29 MB

This R&D project contains ridesharing service, keycloak identity provider, api gateway; uses microservices architecture, onion architecture, DDD, TDD, mediaTR and more.

C# 93.39% Dockerfile 0.72% HTML 0.83% CSS 0.17% JavaScript 4.01% PLpgSQL 0.88%

ride-sharing-platform's Introduction

Docker Compose Deployment

Table of Contents

Prerequisites

Before you begin, ensure you have the following installed & running properly on your server:

  • Docker Desktop
  • WSL (Windows Subsystem for Linux) if the server OS is Windows

Other Docs

Head to other deployment readme files: -

Setting Up the Project

Generate SSL Certificate

To obtain a valid SSL certificate for your server, open bash terminal and run the following command:

openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout server.key.pem -out server.crt.pem

This will generate two files on the home directory of the server:

  • SSL certificate file (server.key.pem)
  • SSL certificate key file (server.crt.pem)

Set Environment Variables for Docker Compose

The docker-compose.yml file requires proper environment variables set before execution.

Following the .env.example file, create another file .env in the same directory, and set proper values. DO NOT expose them!

Set Environment Variables for API development

Skip this if you are not developing API or writing code and debug.

Open Developer PowerShell from project root directory & run the following commands:

setx API__ConnectionStrings__DatabaseConnectionString "<connection_string_here>"
setx API__ClientApplication__AllowedOrigins "http://localhost:3000" (if frontend is running on this domain)
setx API__Keycloak__Host "http://localhost:9990"
setx API__Keycloak__Realm "RideSharing"

Running the Containers

Production Environment

Open Terminal from project /docker directory and run the following command to run all containers in detached mode:

docker compose -f docker-compose-keycloak.prod.yml -f docker-compose-postgres.yml -f docker-compose-rabbitmq.yml -f docker-compose-redis.yml up -d

Development Environment

Open Terminal from project /docker directory and run the following command to run all containers in detached mode:

docker compose -f docker-compose-keycloak.dev.yml -f docker-compose-postgres.yml -f docker-compose-rabbitmq.yml -f docker-compose-redis.yml up -d

Usage

Access APIs

  • Access RideSharing API through https:localhost:4000. GET https://localhost:4000 returns RideSharing.InternalAPI is running message.

  • Access RideSharing Customer API through https:localhost:5000. GET https://localhost:5000 returns RideSharing.CustomerAPI is running message.

Access MailHog

  • Access Local MailHog Server through http://localhost:8025(only for dev env).

Destroying the Containers

Run the following command to destroy all containers:

docker compose down

References

To learn more about each of these topics, head to the following documentations:-

ride-sharing-platform's People

Contributors

sayeed1999 avatar nafisiancastle avatar dependabot[bot] avatar msr-wtag avatar

Stargazers

Abid Al - Amin avatar  avatar

Watchers

Lucian avatar  avatar  avatar  avatar

ride-sharing-platform's Issues

feat: work on start and end trip by driver

Start or End the Trip
Using this API, a driver will be able to start and end the trip.
startTrip(driverID: UUID, tripID: UUID): boolean
endTrip(driverID: UUID, tripID: UUID): boolean
Parameters

Driver ID (UUID): ID of the driver.

Trip ID (UUID): ID of the requested trip.

Returns

Result (boolean): Represents whether the operation was successful or not.

feat: cancel accepted ride functionality by customer before it is started

Deny the Ride
This API will allow the customer to cancel the accepted trip.
denyRide(customerID: UUID, rideID: UUID, reason: string): boolean
Parameters

Customer ID (UUID): ID of the driver.

Ride ID (UUID): ID of the customer requested ride.

Returns

Result (boolean): Represents whether the operation was successful or not.

dockerize application

write separate dockerfile if necessary for each api
write docker compose to run altogether

unit tests for customer api features

write proper tests for customer api controller layer, service layer, domain layer, everywhere necessary

cover all scenarios e.g ride requested, accepted, rejected, etc..

feat: work on rate trip by customer

Rate the Trip
This API will enable customers to rate the trip.
rateTrip(customerID: UUID, tripID: UUID, rating: int, feedback?: string): boolean

Parameters

Customer ID (UUID): ID of the customer.

Trip ID (UUID): ID of the completed trip.

Rating (int): Rating of the trip.

Feedback (string): Feedback about the trip by the customer (optional).

Returns

Result (boolean): Represents whether the operation was successful or not.

https not working on docker container

docker compose up -> runs all images as containers

  • but each container can only be accessed via http ports
  • https wont work
  • api gateway wont work
  • cannot enter sql server through port
  • cannot view swagger

feat: implement cancel accepted ride functionality for driver

Deny the Ride
This API will allow the driver to deny the trip.
denyRide(driverID: UUID, rideID: UUID, reason: string): boolean
Parameters

Driver ID (UUID): ID of the driver.

Ride ID (UUID): ID of the customer requested ride.

Returns

Result (boolean): Represents whether the operation was successful or not.

integrate keycloak identity provider

  • keycloak instance should be up and running with docker compose
  • keycloak should use posgresql as its database
  • keycloak database backup should remain on hard disk of the server (data recovery on instance destroy)
  • user should signup & get access tokens from keycloak
  • api gateway should block requests if found unauthenticated!
  • all internal services should independently validate the jwt token from keycloak

feat: work on accept ride by driver

Accept the Ride
This API will allow the driver to accept the trip.
acceptRide(driverID: UUID, rideID: UUID): boolean
Parameters

Driver ID (UUID): ID of the driver.

Ride ID (UUID): ID of the customer requested ride.

Returns

Result (boolean): Represents whether the operation was successful or not.

ridesharing/ manage customer driver signup properly

Possible criteria:

  • when user is received in ridesharing, dont insert user in db if user has not role customer or driver
  • if a user with driver role signs up in auth service, insert driver entity in driver table of ridesharing db
  • if the user then adds customer role with update endpoint in auth service, insert customer entity in customer table of ridesharing db
  • if user updates mobile number, but user is not present in ridesharing db, then insert
  • if user updates mobile number, you may need to update both customer and driver table

manage oidc protocol totally from server side

it is very easy to use keycloak js adapter to login into keycloak from spa application.
but client side auth is less secure than server side auth.
the challenge is to build server side authorization with no control over frontend

feat: work on request ride endpoint

Request a Ride
Through this API, customers will be able to request a ride.
requestRide(customerID: UUID, source: Tuple, destination: Tuple, cabType: Enum, paymentMethod: Enum): Ride
Parameters

Customer ID (UUID): ID of the customer.

Source (Tuple): Tuple containing the latitude and longitude of the trip's starting location.

Destination (Tuple): Tuple containing the latitude and longitude of the trip's destination.

Returns

Result (boolean): Represents whether the operation was successful or not.

feat: work on customer cancel ride endpoint

Cancel the Ride
This API will allow customers to cancel the ride.
cancelRide(customerID: UUID, reason?: string): boolean
Parameters

Customer ID (UUID): ID of the customer.

Reason (UUID): Reason for canceling the ride (optional).

Returns

Result (boolean): Represents whether the operation was successful or not.

feat: auto cancel ride if no driver accepts in last two minutes

you need to throw a background job using rabbitmq when a ride is created and auto cancel it if not accepted in next one-five mins.

also, if a rider accepts it and cancels it, the auto cancel timeout should get reset (the resetting thing can be done in a follow up PR)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.