- About
- Technologies
- Installation
- Functional Requirements, Non-Functional Requirements, and Business Rules
Rent an Auto is an API designed to manage car rentals efficiently. The system provides functionalities for car registration, rental management, and user authentication. It ensures that only administrators can manage car listings, while users can search for available cars and rent them. The API also includes features for managing car specifications, uploading car images, handling returns, and processing user authentication and password recovery.
- TypeScript
- Express
- Jest
- PostgreSQL
- TypeORM
- Multer (for file uploads)
# Clone the repository
git clone https://github.com/leandrolimadeveloper/rent-an-auto-api.git
cd rent-an-auto
# Install dependencies
npm install
# Set up environment variables
cp .env.example .env
Update the .env file with the necessary credentials. Use the .env.example file as a reference.
# Start the database container (PostgreSQL)
docker compose up
or
docker compose up -d # run in detached mode
# Start the application
npm run dev
# Run migrations
npm run typeorm migrations:run
- The system must allow the registration of a new car.
- The system must set a car as available by default when registered.
- The system must allow listing all available cars.
- The system must allow filtering available cars by category, brand, or name.
- The system must allow users to view cars without requiring login.
- The system must allow adding specifications to a car.
- The system must allow uploading car images.
- The system must allow uploading multiple images per car.
- The system must allow registering a new rental.
- The system must allow only authenticated users to rent a car.
- The system must change the car's status to unavailable after rental.
- The system must allow processing car returns.
- The system must mark the car as available for rental after return.
- The system must calculate the total rental cost, including any late fees if applicable.
- The system must allow users to retrieve all rentals associated with them.
- The system must require users to be authenticated to view their rental history.
- The system must allow users to request password recovery via email.
- The system must send an email with instructions to reset the password.
- The system must allow users to set a new password.
- The system must use Multer for file handling in image uploads.
- The system must use a PostgreSQL database to store information.
- The password recovery link must expire after 3 hours.
- The system must use TypeORM for database management.
- The system must be developed in TypeScript and use Express as the backend framework.
- The system must not allow the registration of cars with duplicate license plates.
- Only administrators can register cars in the system.
- The system must not allow adding specifications to unregistered cars.
- The system must prevent adding duplicate specifications to the same car.
- Only administrators can add specifications to a car.
- Only administrators can upload car images.
- The system must require a minimum rental period of 24 hours.
- The system must not allow a user to have multiple open rentals.
- The system must not allow a single car to be rented by multiple users simultaneously.
- If a car is returned before 24 hours, a full daily rate must be charged.
- The system must charge an extra fee for late returns.
- Users must be required to enter a new password when resetting their password.
To access the documentation and test the endpoints, make sure the application is running and open the following address in your browser: http://localhost:3333/api-docs