Skip to content

MUSTAFA-Hamzawy/Rentify

Repository files navigation


Rentify

Rentify is a backend API for a car rental system, built using NestJS and PostgreSQL.

API Docs . Report Bug . Request Feature


Table Of Contents

About The Project

Rentify is a backend API for a car rental system built with NestJS and PostgreSQL, inspired by the RentX app. It provides essential endpoints for managing car rentals, focusing on robust features like user management, authentication, and rental operations. Rentify is designed to streamline the backend processes required for a modern car rental service.

Features

  • User Management: Handles user and admin accounts, supporting creation, updates, and role-based access.
  • Authentication: Secures the API with JWT-based access and refresh token mechanisms.
  • Brands: Provides endpoints to manage and retrieve car brands for easy categorization and filtering.
  • Car Management: Includes CRUD operations for cars, managing details like availability, pricing, and specifications.
  • Locations: Manages pickup and dropoff points for rented cars, offering flexibility for users.
  • Discounts: Enables management of promotional discounts to enhance customer engagement.
  • Orders: Handles rental bookings, including order creation, status tracking, and related operations.

API Documentation

API Docs [Postman]

API Docs [Swagger]

Built With

  • NodeJS
  • NestJS
  • TypeScript
  • PostgreSQL
  • Redis
  • TypeORM
  • JWT (JSON Web Tokens)
  • bcryptjs
  • multer
  • Jest
  • npm
  • Postman
  • Swagger
  • Docker

Getting Started

To get a local copy up and running follow these simple steps.

Prerequisites

  • NodeJS
  • npm
  • PostgreSQL
  • Redis
  • Docker (optional)

Installation

First : Clone the repo

    git clone https://github.com/MUSTAFA-Hamzawy/Rentify.git

then, Move to the project directory

Second : Make your own copy of the .env file

  1. Create a copy of the .env.example file and name it .env:

        cp .env.example .env
  2. Update the .env file with the following configurations:

    • JWT_ACCESS_TOKEN_KEY: Generate a secure hexadecimal key using this command ( or use any way you prefer )
        openssl rand -hex 32
    • JWT_REFRESH_TOKEN_KEY: Generate another secure hexadecimal key using the same command.

    • OTP_SECRET_KEY: Generate yet another secure hexadecimal key using the same command.

    • SMTP_MAIL : write your smtp email that will be used to send emails for users

    • APP_PASSWORD : you can generate app passwrod for gmail account from here : https://knowledge.workspace.google.com/kb/how-to-create-app-passwords-000009237

Second : You can proceed using docker or the manual setup

Using Docker

Set up and run the application using Docker containers

    docker-compose -f docker-compose.yml -f docker-compose-prod.yml up -d

NOTE: the container will run on port 4000, you can adjust it from the file docker-compose.yml

Manual Setup

  1. Create a new database
  2. setup "src/database/db.config.json" file based on your db configurations
  3. Install dependecies & seeding database
    npm install -g @nestjs/cli
    npm install
    npm run migration:run
    npm run seed
  1. Start Running
    npm start

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  • If you have suggestions for adding or removing projects, feel free to open an issue to discuss it, or
  • Directly create a pull request after you edit the files with necessary changes.

Creating A Pull Request

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

See LICENSE for more information.