Guide to (usage and description of) the Rent-A-Ride Vehicle Rental application.
Table of Contents
- What Rent-A-Ride Is
- Features of the Application
- Technical Features of the Application
- Technologies Utilized in Crafting Rent-A-Ride 1. Server-side 2. Client-side
- API Documentation
- Database Structure
- How to Install and Run the Rent-A-Ride Application Locally On Your Device 1. Requirements 2. Installation Procedure 1. Server-side Terminal 2. Client-side Terminal
- How to Generate Keys for your Environment Variable (.env) File
- Footnotes !important
Rent-A-Ride is a vehicle rental application where users can search for vehicles and hire. Vehicle owners can also put up their vehicles for hire.
(gif image showing working application comes here)
- There are 3 roles: user, vehicle owner and admin.
- A user can choose to register as an user or vehicle owner.
- Users can book vehicles. Vehicle owners can register their vehicles to be booked by users.
- Users can like and comment on vehicles.
- Users can search for vehicles for hire.
- Users and vehicle owners can interact on a particular vehicle hire.
- Vehicle and user locations can be tracked.
- Payment can be made for each vehicle hire on the app.
Click for more details and admin functions.
- Authentication
- Authorization (multiple roles)
- JWT tokens (access and refresh tokens)
- Rotating refresh tokens
- Registration link (via email) verification on registration
- Soft-delete function so that data is never really lost (all deleted data can be retrieved/re-activated)
- Image upload to the cloud (cloudinary)
- All incoming requests are validated multiple times on both client side and server-side.
- Detailed custom logs using morgan
- API requests rate-limiting to prevent attacks.
- Other security measures in place to prevent attacks.
- Multiple error handlers (for both planned and unplanned errors) to catch all errors properly.
- Payment handled by PayPal.
- Plus much more...
Rent-A-Ride is crafted in the following technologies:
- Express.JS (Node.JS) on the server-side. 1. Jest (for writing tests for the application) 2. Joi was used for additional server-side form validation.
- MongoDB (for database). 1. Mongoose (for communicating with the MongoDB database)
- Cloudinary (for cloud file/image storage).
- Nodemailer (for email notifications).
- ApiDoc (for API Documentation).
- React.JS (JavaScript) library on the client-side
- Vanilla CSS3 and TailwindCSS for styling.
Here is a link to the API documentation: https://rent-a-ride-api-documentation.vercel.app/
-
You must have Node.JS installed on your device. Visit the official Node.JS website and follow the steps for download and installation. Preferably, go for the LTS version amongst the two options.
-
After installing Node.JS, download and install a text editor (e.g. VS Code) if you do not have one.
Then go to your terminal and follow these steps:
- From your terminal, cd (change directory) into your favorite directory (folder) where you would like to have the application files
cd C:\Users\maxim\Desktop>
Here I changed directory into my personal Desktop space/folder on my Windows Computer. And then;
- Clone this repository from here on Github using either of the 2 commands on your terminal:
git clone https://github.com/maxralph1/rent-a-ride.git
or
git clone git@github.com:maxralph1/rent-a-ride.git
- And to end this section, CD into the newly installed "rent-a-ride" application file with the following commands.
cd rent-a-ride
At this point, you must have 2 terminals running side-by-side (server-side (to running the server side code) and client-side (to consume the server-side API)).
- On the first terminal, change directory into the server file
cd server
- From here, use the command below to install all dependencies I utilized in this application as can be seen from my 'server/package.json' file
npm i
- Spin up the server with the command:
npm run devstart
- On the second terminal, change directory into the server file
cd client
- Use the command below to install all dependencies I utilized in this application as can be seen from my 'client/package.json' file
npm i
- Spin up the client-side (front-end) to consume the back-end API using the following command:
npm run dev
Your application should be up on http://localhost:5173/ if you have nothing previously running on the port :5173. Check your terminal to confirm the actual port.
Rename the "server/env.example" to "/server/.env" or create the new file.
Below are the steps you could take to populate the "/server/.env" file variables.
Leave this as the default, "development" or "production"
This is the database connection key from Mongo DB. Go to the official MongoDB website and either use the Atlas or have it downloaded locally. You may also wish to use another database provider. But you must modify the MongoDB database connection logic. For ease, stick with MongoDB.
Provide random string or use any token generation library. I used Node's Crypto library from a node command line like so:
require('crypto').randomBytes(64).toString('hex')
These are for production. This is enabled when you are on "production". You can use GMail service for mail notifications to populate the fields.
The port on development or URL on production.
This application is strictly for demonstration purposes. It is not yet production-ready and should never be used as such.I will continue to gradually update this project in my free time.
**On the general pattern of coding, if you noticed, the entire application has a specific approach in structure. I however decided to deviate (bring in several flavors) a little (but paid attention not to deviate too much) from these principles so as to showcase my skills.
In a real-world application, I would stick to a particular pattern.
Finally, contributions/suggestions on how to improve this project, are welcome.