Skip to content

An API service for a non-existing car rental platform. Built using python, fastapi, and Postgresql. AirBnB but for Car rental

Notifications You must be signed in to change notification settings

ize-302/car-rental-service

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Car Rental API

API service for a car rental platform where users can rent out their vehicles as well as rent vehicles of other users. Inspired by the AirBnB platform.

Technology used

  • Python programming language
  • FastAPI - Really fast python library for building APIs
  • PostgreSQL database
  • JWT for authentication
  • Brevo for sending mail because it is free and easy to setup
  • BetterStack for log monitoring <3

Requirements

  • Users can create an account that allows them serve as host and renter depending on context
As Host
  • User can add their vehicles to rent out with important information like; name, model, type, pricing, description, location, color, engine information, photos etc
  • user can update vehicle information
  • User can see list of vehicles they own and can filter by status i.e active, reserved, available(see detail here)
  • User can see history of a vehicle. e.g when a vehicle was added, booked, when it became active, when it became available, when it was canceled etc
  • user can confirm or cancel reservation
As Renter
  • User can find vehicles they want to rent by running a quick search or seeing catalogs of vehicles. This can be sorted by location, vehicle name, model, color, price etc
  • User can book a vehicle by submitting rent and return date. User cannot reserve a vehicle that has been reserved at a set date and time
  • user can cancel booking
  • User can see rental history

API Endpoints

Auth

  • Create account /auth/register [POST]
  • Login /auth/login [POST]
  • Current user /auth/me [GET]
  • Forgot password /auth/forgot-password/reset-link [POST]
  • Reset password /auth/forgot-password/validate [POST]
  • Reset password /auth/forgot-password/update [POST]

User

  • Change password /user/change-password [POST]-[HOST,GUEST]
  • get user's profile /user/profile/:id [GET]-[HOST/GUEST]
  • get current user's vehicles /user/me/vehicles [GET]-[HOST/GUEST]
  • update profile /user/profile [PUT]-[HOST/GUEST]

Vehicles

  • create /vehicles [POST]-[HOST]
  • list /vehicles?status=[available / active / unavailable] [GET]
  • upload vehicle photos /vehicles/:id/upload [POST][HOST]
  • vehicle detail /vehicles/:id [GET]
  • update vehicle detail /vehicles/:id [PUT]-[HOST]
  • delete /vehicles/:id [DELETE]-[HOST]
  • vehicle reservations /vehicles/:id/bookings [GET]

Bookings

  • make a booking /bookings [POST]-[GUEST]
  • cancel booking /bookings/:id/cancel [PUT]-[HOST,GUEST]
  • update booking /bookings/:id [PUT]
  • booking detail /bookings/:id [GET]
  • confirm a booking /bookings/:id/confirm [PUT][HOST] booking status = canceled, confirmed

How to Install and Run the Project

This project requires a .env file in the project root. Rename the env.sample to .env

# file - .env

# Database connection
DATABASE_URL =

# JWT
SECRET_KEY =
ALGORITHM = "HS256"
ACCESS_TOKEN_EXPIRE_MINUTES = 30

# Mailing - https://www.brevo.com/
EMAIL_FROM =
BREVO_API_KEY =

# Logging - https://betterstack.com/
BETTERSTACK_LOG_SOURCE_TOKEN =
Install dependencies and run project
# install all dependencies
pdm install

# run app
pdm run start

Todos

  • refresh token
  • move from id to uuid
  • email template
  • change user_crud.handle_get_current_user to jwt_utils.verify_access_token(token)
  • find a way to use middleware to implment token verification
  • Containerize using Docker
  • Reviews and rating system

About

An API service for a non-existing car rental platform. Built using python, fastapi, and Postgresql. AirBnB but for Car rental

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages