Skip to content

resham57/Car-Rental-Management-System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

31 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Car Rental Management System (CRMS)

A comprehensive web-based car rental management system built with Node.js, Express, and LevelDB. This system provides separate interfaces for customers and administrators, featuring vehicle search, booking management, and administrative tools.

πŸš€ Features

Customer Features

  • User Registration & Authentication - Secure phone-based registration and login
  • Vehicle Search & Filter - Advanced search with date availability, make, model, fuel type filters
  • Real-time Booking - Reserve vehicles with date/time selection and conflict prevention
  • Dashboard - View booking history and manage reservations
  • Responsive Design - Mobile-friendly interface with Bootstrap

Admin Features

  • Admin Dashboard - Overview of vehicles, bookings, and customer statistics
  • Vehicle Management - Add, edit, delete vehicles with comprehensive details
  • Advanced Search & Filtering - Search vehicles by VIN, make, model with sortable columns
  • Booking Management - View and manage all customer bookings
  • Customer Management - View registered customers and their booking history
  • Bulk Operations - CSV import/export for vehicle data management
  • Pagination & Sorting - Handle large datasets efficiently

Security Features

  • UUID Vehicle Mapping - Hide sensitive VIN numbers from customers
  • Session Management - Secure session-based authentication
  • Input Validation - Server-side validation with express-validator
  • Role-based Access Control - Separate admin and customer access levels
  • Password Hashing - Secure password storage with bcrypt

πŸ› οΈ Technology Stack

  • Backend: Node.js, Express.js
  • Database: LevelDB (Key-Value Store)
  • Frontend: EJS Templates, Bootstrap 5, jQuery
  • Authentication: Express Session, bcrypt
  • File Upload: Multer
  • Validation: Express Validator
  • UI Icons: Bootstrap Icons

πŸ“‹ System Requirements

Minimum Requirements

  • Node.js: Version 18.x or higher
  • NPM: Version 8.x or higher (comes with Node.js)
  • Operating System: Windows 10+, macOS 10.15+, Ubuntu 18.04+
  • Memory: 512MB RAM minimum, 1GB recommended
  • Storage: 100MB free disk space

Recommended Requirements

  • Node.js: Version 20.x LTS
  • NPM: Version 10.x
  • Memory: 2GB RAM
  • Storage: 500MB free disk space

πŸš€ Installation & Setup

Prerequisites

  1. Install Node.js

    # Check if Node.js is installed
    node --version
    npm --version
    
    # If not installed, download from: https://nodejs.org/
    # Recommended: Use Node Version Manager (nvm)
  2. Install Git (if not already installed)

    # Check if Git is installed
    git --version
    
    # If not installed, download from: https://git-scm.com/

Project Setup

  1. Clone the Repository

    # Using SSH (recommended)
    git clone git@github.com:resham57/Car-Rental-Management-System.git
    
    # Or using HTTPS
    git clone https://github.com/resham57/Car-Rental-Management-System.git
  2. Navigate to Project Directory

    cd Car-Rental-Management-System
  3. Install Dependencies

    # Install all required packages
    npm install
    
    # Verify installation
    npm list --depth=0
  4. Environment Configuration (Optional)

    # Copy example environment file
    cp .env.example .env
    
    # Edit environment variables (optional)
    # APP_PORT=3000
    # APP_SECRET=your-secret-key
  5. Start the Application

    # Development mode (with auto-reload)
    npm run dev
    
    # Production mode
    npm start
  6. Access the Application

    🌐 Application: http://localhost:3000
    πŸ‘€ Default Admin:
       Username: admin
       Password: Admin@123
    

πŸ“ Project Structure

CRMS/
β”œβ”€β”€ app.js                 # Main application entry point
β”œβ”€β”€ package.json           # Dependencies and scripts
β”œβ”€β”€ README.md             # Project documentation
β”œβ”€β”€ .env.example          # Environment variables template
β”œβ”€β”€ constants.js          # Application constants
β”œβ”€β”€ config/
β”‚   └── database.js       # LevelDB configuration and helpers
β”œβ”€β”€ middleware/
β”‚   └── auth.js          # Authentication middleware
β”œβ”€β”€ routes/
β”‚   β”œβ”€β”€ auth.js          # Authentication routes
β”‚   β”œβ”€β”€ admin.js         # Admin panel routes
β”‚   β”œβ”€β”€ customer.js      # Customer routes
β”‚   └── vehicles.js      # Vehicle search routes
β”œβ”€β”€ views/
β”‚   β”œβ”€β”€ layouts/         # EJS layout templates
β”‚   β”œβ”€β”€ admin/           # Admin panel views
β”‚   β”œβ”€β”€ auth/            # Login/register views
β”‚   β”œβ”€β”€ customer/        # Customer dashboard views
β”‚   └── vehicles/        # Vehicle search views
β”œβ”€β”€ public/
β”‚   β”œβ”€β”€ css/            # Stylesheets
β”‚   └── js/             # Client-side JavaScript
β”œβ”€β”€ validations/
β”‚   β”œβ”€β”€ index.js        # Validation exports
β”‚   └── userValidation.js # User input validation
β”œβ”€β”€ database/           # LevelDB data files (auto-created)
└── uploads/           # Temporary file uploads (auto-created)

πŸ”§ Available Scripts

# Development with auto-reload
npm run dev

# Production start
npm start

# Check for security vulnerabilities
npm audit

# Fix security vulnerabilities
npm audit fix

πŸ“Š Database Schema

Key-Value Store Structure (LevelDB)

users:{phone}           # Customer records
admins:{username}       # Admin accounts
vehicles:{vin}          # Vehicle inventory
vehicle_uuid_map:{uuid} # UUID to VIN mapping
bookings:{id}           # Rental bookings

🎯 Default Access

Admin Account

  • URL: /admin/login
  • Username: admin
  • Password: Admin@123
  • Capabilities: Full system access

Customer Registration

  • URL: /auth/register
  • Login: /auth/login
  • Requirements: Phone number, full name, password

πŸ” Key Features Guide

Bulk Vehicle Operations

Access /admin/vehicles/bulk for:

  • CSV Export: Download all vehicle data
  • CSV Import: Upload vehicle data (sample file: sample-vehicles-500.csv)
  • Format: VIN, Make, Model, Year, Body Type, Fuel Type, etc.

Vehicle Search

  • Customer Search: Date-based availability with filters
  • Admin Search: Advanced filtering with pagination and sorting
  • UUID Security: Customers see UUIDs instead of VINs

Booking System

  • Conflict Prevention: Automatic availability checking
  • Status Management: Pending, Confirmed, Cancelled, Completed
  • Date Validation: Future dates only, return after pickup

πŸ› Troubleshooting

Common Issues

  1. Port Already in Use

    # Kill process on port 3000
    lsof -ti:3000 | xargs kill -9
    
    # Or use different port
    PORT=3001 npm start
  2. Database Lock Error

    # Stop all Node.js processes
    pkill node
    
    # Delete lock file if exists
    rm database/LOCK
  3. Permission Errors

    # Fix permissions (macOS/Linux)
    sudo chown -R $USER:$USER .
    
    # Clear npm cache
    npm cache clean --force
  4. Module Not Found

    # Reinstall dependencies
    rm -rf node_modules package-lock.json
    npm install

πŸ“ Development Notes

  • Session Secret: Change default secret in production
  • File Uploads: Limited to 5MB for CSV files
  • Database: Automatic backup recommended for production
  • Security: Regular dependency updates recommended

🀝 Contributing

We welcome contributions from all team members! Please follow these guidelines:

Development Workflow

  1. Fork/Clone the Project

    git clone git@github.com:resham57/Car-Rental-Management-System.git
    cd Car-Rental-Management-System
  2. Create Feature Branch

    git checkout -b feature/AmazingFeatureBranch
    # or
    git checkout -b bugfix/ImportantBugFix
  3. Make Changes & Test

    # Make your changes
    npm run dev  # Test locally
    npm audit    # Check for vulnerabilities
  4. Commit Changes

    git add .
    git commit -m "Add some AmazingFeature
    
    - Detailed description of changes
    - Any breaking changes noted
    - References to issues if applicable"
  5. Push to Branch

    git push origin feature/AmazingFeatureBranch
  6. Open Pull Request

    • Create PR on GitHub
    • Add detailed description
    • Request review from team members
    • Ensure CI checks pass

Code Standards

  • Consistent formatting with existing codebase
  • Comments for complex logic
  • Validation for all user inputs
  • Error handling for all database operations
  • Security considerations for new features

Important Notes

  • ⚠️ Never work directly on the main branch
  • πŸ” All PRs require team review
  • βœ… Test your changes thoroughly
  • πŸ“ Update documentation as needed

πŸ‘₯ Team

πŸ“„ License

This project is licensed under the ISC License - see the package.json file for details.


Happy Coding! πŸš—πŸ’¨

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published