A complete Minimum Viable Product (MVP) for managing a car dealership inventory with sales tracking, user management, and dashboard analytics.
✅ Vehicle Inventory Management
- Add, view, edit, and delete vehicles
- Track stock ID, brand, model, year, variant, color, transmission, fuel type, mileage
- Manage purchase and selling prices
- Add notes and remarks
✅ Inventory Search & Filter
- Search by brand, model, year
- Filter by status (Available, Reserved, Sold)
- Sort by price and date added
- Real-time table view
✅ Sales Tracking
- Record sales with buyer information
- Track payment method (Cash, Financing, Cheque)
- Auto-mark vehicle as Sold
- View sales history
✅ Dashboard
- Total vehicles count
- Available vehicles
- Sold vehicles count
- Total inventory value
- Total sales sum
- Recent sales list
✅ User Access Control
- Admin: Full access (CRUD, user management, delete)
- Staff: Add and update vehicles only
- Frontend: HTML5 + CSS3 + Bootstrap 5 + Vanilla JavaScript
- Backend: Node.js + Express.js
- Database: MySQL
- Authentication: JWT (JSON Web Tokens)
sample_webpage/
├── backend/
│ ├── middleware/
│ │ └── auth.js # JWT authentication
│ ├── routes/
│ │ ├── auth.js # Login/Register endpoints
│ │ ├── vehicles.js # Vehicle CRUD endpoints
│ │ ├── sales.js # Sales tracking endpoints
│ │ └── dashboard.js # Dashboard stats endpoints
│ ├── server.js # Express server setup
│ ├── package.json # Dependencies
│ └── .env # Environment variables
├── frontend/
│ ├── index.html # Main HTML file
│ ├── css/
│ │ └── styles.css # Custom styles
│ └── js/
│ └── app.js # Frontend logic
├── database.sql # Database schema
└── README.md # This file
Before running the system, ensure you have:
- Node.js (v14 or higher) - Download
- MySQL (v5.7 or higher) or XAMPP with MySQL
- Git (optional, for version control)
- Open MySQL command line or PHPMyAdmin (if using XAMPP)
- Copy and paste the contents of
database.sql - Execute the SQL to create tables and insert sample users
# If using command line:
mysql -u root -p < database.sqlSample Login Credentials:
- Admin:
admin@cardealer.com/admin123 - Staff:
staff@cardealer.com/staff123
- Navigate to the backend directory:
cd backend- Install dependencies:
npm install- Configure
.envfile:
DB_HOST=localhost
DB_USER=root
DB_PASSWORD= # Leave empty if no password (XAMPP default)
DB_NAME=car_inventory_db
DB_PORT=3306
JWT_SECRET=your_secret_key_change_in_production
PORT=5000
- Start the backend server:
npm start
# Or with nodemon for auto-reload:
npm run devThe server should now be running on http://localhost:5000
- In your web browser, navigate to:
http://localhost/sample_webpage/frontend/index.html
Or if using XAMPP, place the files in C:\xampp\htdocs\sample_webpage and access:
http://localhost/sample_webpage/frontend/index.html
- Log in with one of the sample credentials above
POST /api/auth/login- User loginPOST /api/auth/register- Create new user (admin only)
GET /api/vehicles- Get all vehicles (with filters)GET /api/vehicles/:id- Get single vehiclePOST /api/vehicles- Add new vehicle (admin/staff)PUT /api/vehicles/:id- Update vehicle (admin/staff)DELETE /api/vehicles/:id- Delete vehicle (admin only)
Query Parameters for GET /api/vehicles:
brand- Filter by brandmodel- Filter by modelyear- Filter by yearstatus- Filter by status (Available/Reserved/Sold)sortBy- Sort by 'price' or 'date'order- Sort order 'asc' or 'desc'
GET /api/sales- Get all salesPOST /api/sales- Record new sale (admin/staff)PUT /api/sales/:id- Update sale (admin only)DELETE /api/sales/:id- Delete sale (admin only)
GET /api/dashboard/stats- Get dashboard statistics
- id (INT, Primary Key)
- name (VARCHAR)
- email (VARCHAR, Unique)
- password (VARCHAR, hashed)
- role (ENUM: 'admin', 'staff')
- created_at (TIMESTAMP)- id (INT, Primary Key)
- stock_number (VARCHAR, Unique)
- brand (VARCHAR)
- model (VARCHAR)
- year (INT)
- variant (VARCHAR)
- color (VARCHAR)
- transmission (ENUM: 'Manual', 'Automatic')
- fuel_type (ENUM: 'Petrol', 'Diesel', 'Hybrid', 'Electric')
- mileage (INT)
- purchase_price (DECIMAL)
- selling_price (DECIMAL)
- status (ENUM: 'Available', 'Reserved', 'Sold')
- notes (TEXT)
- created_at (TIMESTAMP)
- updated_at (TIMESTAMP)- id (INT, Primary Key)
- vehicle_id (INT, Foreign Key → vehicles.id)
- buyer_name (VARCHAR)
- sale_price (DECIMAL)
- payment_method (ENUM: 'Cash', 'Financing', 'Cheque')
- sale_date (DATE)
- created_at (TIMESTAMP)- View dashboard and all stats
- Add, edit, delete vehicles
- View, record, edit, delete sales
- Create and manage users
- Full system access
- View dashboard (limited stats)
- Add and edit vehicles only
- View vehicles list
- Record sales
- Cannot delete vehicles or access user management
- Ensure Node.js server is running on port 5000
- Check that MySQL is running
- Verify
.envconfiguration
- Verify MySQL credentials in
.env - Check if
car_inventory_dbdatabase exists - Ensure MySQL service is running
- Clear browser cache and cookies
- Check database schema is properly initialized
- Verify user exists in
userstable
- Backend CORS is configured for all origins (update in production)
- Verify requests are to correct API URL
- Advanced reporting and analytics
- Export inventory to Excel/PDF
- Vehicle photo gallery
- Customer management system
- Finance integration
- Mobile app
- Email notifications
- Barcode scanning
- Maintenance history tracking
Before deploying to production:
- Change
JWT_SECRETin.envto a strong random value - Set
NODE_ENV=production - Update CORS to specific domain
- Enable HTTPS
- Use environment-specific database credentials
- Set up proper error logging
- Implement rate limiting
- Add input validation and sanitization
- Use process manager like PM2
For issues or feature requests, contact your development team.
Version: 1.0.0
Last Updated: February 2026