RiderX offers an intuitive booking system for renting bikes, managing rentals, and applying discounts to rentals.
Bike Rental Reservation System Backend using TypeScript, Express and Mongoose. This project offers API endpoints with role base authentication for RideX bike reservation application.
- Programming Language: TypeScript
- Framework: Express.js
- Database: MongoDB
- ODM: Mongoose
- Validation Library: Zod
- Authentication: JSON Web Tokens (JWT)
- User Registration and Authentication
- Role Based Access Control: Admin and User Roles with Different Permissions
- Retrieve and Update User's Own Profile
- Add, Update and Delete Bike by the Admin
- Bike Availability and Rental Management
- Rental Transactions and Cost Calculation
- Error Handling and Input Validation
- AmarPay payment method integration
- Email sending functionality using Nodemailer
- Image Upload functionality using Cloudinary
Follow this step-by-step guide to run the server on your local machine.
First, clone the repository to your machine using the following command:
git clone https://github.com/saifscripts/ridex-server.git
Next, navigate to the project directory with this command:
cd ridex-server
Before running the app, you need to install all dependencies. You can do this using either Yarn or npm.
yarn install
npm install --legacy-peer-deps
To run the app, create a .env
file in the root folder with the following properties (I have included a few demo values here for testing):
NODE_ENV=development
PORT=5000
DB_URI=mongodb://localhost:27017/bike-rental
BASE_URL=http://localhost:5000
CLIENT_BASE_URL=http://localhost:5173
BCRYPT_SALT_ROUNDS=12
JWT_ACCESS_SECRET=demo_secret
JWT_REFRESH_SECRET=demo_secret
JWT_ACCESS_EXP_IN=7d
JWT_REFRESH_EXP_IN=365d
STORE_ID=aamarpaytest
SIGNATURE_KEY=your_signature_key
PAYMENT_BASE_URL=https://sandbox.aamarpay.com
MAIL_AUTH_USER=email
MAIL_AUTH_PASS=your_mail_auth_pass
CLOUDINARY_NAME=your_cloudinary_name
CLOUDINARY_API_KEY=your_cloudinary_api_key
CLOUDINARY_API_SECRET=your_cloudinary_api_secret
Note: Change the DATABASE_URL
if you want to use your own database URI.
Now, you're ready to run the app. Use one of the following commands to start the server.
yarn dev
npm run dev
That's it! The application should now be running locally.