Professional automobile inventory management and dealership platform
A comprehensive full-stack solution that streamlines car sales, inventory tracking, customer inquiries, and financial analytics for automotive dealerships and traders.
- Overview
- Features
- Architecture
- Tech Stack
- Getting Started
- Configuration
- API Documentation
- Deployment
- Security
- Troubleshooting
- Contributing
- License
Carventory is a production-ready, enterprise-grade inventory management system designed specifically for automotive dealerships and traders. Built as a modern monorepo, it combines robust backend services with intuitive user interfaces to deliver a complete dealership management experience.
- Automotive Dealerships: Manage inventory, sales, and customer relationships
- Car Traders: Track vehicle acquisitions, pricing, and profit margins
- Inventory Managers: Monitor stock levels and vehicle lifecycles
- Sales Teams: Process bookings, generate invoices, and track performance
- Customers: Browse available inventory and submit purchase inquiries
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β Marketplace ββββββββββΆβ Spring Boot βββββββββββ Dashboard β
β (Next.js) β β Backend β β (React + TS) β
β Public Facing β β (Java 21) β β Staff Portal β
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β
ββββββββββ΄βββββββββ
β β
ββββββΌββββββ βββββββΌββββββ
βPostgreSQLβ βCloudinary β
β Database β β Storage β
ββββββββββββ βββββββββββββ
- Comprehensive Vehicle Listings: Manage complete car details including make, model, year, VIN, mileage, and condition
- Rich Media Support: Upload up to 15 high-resolution images per vehicle
- Document Management: Store and track RC, insurance certificates, and PUC documents
- Maintenance History: Record service history and vehicle specifications
- Smart Soft Delete: Preserve historical data while maintaining clean active inventory
- Real-Time Dashboards: Monitor profit/loss metrics by month, year, and custom date ranges
- Sales Performance Tracking: Analyze monthly sales trends and employee contributions
- Inventory Status Overview: Visualize available, sold, and maintenance-stage vehicles
- Professional Reports: Export detailed financial statements as PDF documents
- Capital Analysis: Track stuck capital and inventory holding costs
- Role-Based Access Control: Granular permissions for admin, staff, and sales roles
- Multi-Dealership Support: Manage multiple company profiles with independent branding
- Employee Directory: Track staff members and their sales performance
- Secure Authentication: JWT-based authentication with email verification
- Password Security: Password history tracking and secure reset workflows
- Inquiry Management: Process customer requests with budget and preference matching
- Intelligent Matching: Automatically suggest vehicles based on inquiry criteria
- Status Tracking: Monitor inquiry lifecycle from submission to resolution
- Automated Notifications: Email alerts for inquiry updates and responses
- Streamlined Booking Process: Create reservations with advance payment tracking
- Payment Management: Monitor booking status and payment completion
- Professional Invoicing: Generate branded PDF invoices for completed sales
- Transaction History: Complete audit trail linking vehicles to buyers
- Customer-Facing Portal: Browse available inventory with rich search capabilities
- Advanced Filtering: Search by make, model, fuel type, transmission, price range, and location
- Detailed Vehicle Pages: High-quality image galleries with comprehensive specifications
- Direct Communication: Contact dealerships directly from listings
- Responsive Design: Optimized experience across desktop, tablet, and mobile devices
- Theme Customization: Toggle between dark and light modes
- Interactive Visualizations: Real-time data charts powered by Chart.js
- Modern UI Design: Glassmorphism effects and smooth animations
- Mobile-First Approach: Fully responsive layouts with Tailwind CSS
Carventory is structured as a monorepo containing three integrated applications:
Location: apps/backend/
Enterprise Java application providing RESTful APIs and business logic:
- Authentication & Authorization: JWT-based security with Spring Security
- Database Layer: PostgreSQL with Spring Data JPA and Flyway migrations
- Core Services: Cars, Users, Companies, Inquiries, Bookings, Financial Analytics
- Document Generation: OpenPDF for invoices and reports
- Cloud Integration: Cloudinary for media storage
- Email Service: Spring Mail for notifications
- Scheduled Tasks: Automated inquiry cleanup and maintenance jobs
- Caching: Caffeine cache for performance optimization
Location: apps/frontend/
Authenticated web portal for dealership staff:
- Framework: React 18 with TypeScript and Vite
- UI Components: Ant Design with Tailwind CSS styling
- Data Visualization: Chart.js for analytics dashboards
- State Management: React hooks with Axios for API communication
- Routing: Protected routes with role-based access
- Theme System: Dark/light mode with localStorage persistence
Location: apps/marketplace/
Public-facing website for customers:
- Framework: Next.js 15 with TypeScript
- UI Library: Radix UI primitives with Tailwind CSS
- Rendering: Static export for optimal performance
- SEO Optimization: Metadata and structured data
- Animations: Framer Motion for smooth interactions
- Icons: Lucide React icon library
Customer Browsing
β
Marketplace
β
Inquiry Submission
β
Dashboard (Staff Review)
β
Booking Creation
β
Payment & Invoice Generation
β
Analytics & Financial Reports
| Layer | Technology | Version | Purpose |
|---|---|---|---|
| Backend Framework | Spring Boot | 3.4.4 | Application foundation |
| Language | Java | 21 | Backend development |
| Database | PostgreSQL | 12+ | Data persistence |
| ORM | Spring Data JPA | - | Database abstraction |
| Security | Spring Security + JWT | - | Authentication/Authorization |
| Migration | Flyway | - | Schema versioning |
| Frontend Framework | React | 18 | Dashboard UI |
| Marketplace Framework | Next.js | 15 | Public website |
| Language | TypeScript | 5+ | Type-safe development |
| Build Tool | Vite | 5+ | Fast dev server |
| UI Components | Ant Design | 5+ | Component library |
| Styling | Tailwind CSS | 3+ | Utility-first CSS |
| Charts | Chart.js | 4+ | Data visualization |
| Icons | Lucide React | - | Icon system |
| HTTP Client | Axios | 1+ | API communication |
| PDF Generation | OpenPDF | - | Report generation |
| Cloud Storage | Cloudinary | - | Media management |
| Spring Mail | - | Email notifications | |
| Cache | Caffeine | - | In-memory caching |
| Build Tool | Maven | 3.9+ | Backend build |
Ensure the following software is installed on your system:
- Java Development Kit: JDK 21 or higher (Download)
- Node.js: Version 18+ (Download)
- PostgreSQL: Version 12+ (Download)
- Maven: Version 3.9+ (Download)
- Cloudinary Account: For media storage (Sign up)
git clone https://github.com/mohammadumar-dev/carventory.git
cd carventoryCreate a PostgreSQL database for the application:
# Connect to PostgreSQL
psql -U postgres
# Create database
CREATE DATABASE carventory;
# Grant permissions
GRANT ALL PRIVILEGES ON DATABASE carventory TO postgres;
# Exit psql
\qcd apps/backend
# Copy environment template
cp .env.example .env
# Edit .env with your configuration (see Configuration section)
# Install dependencies and build
mvn clean install
# Run the application
mvn spring-boot:runThe backend API will start on http://localhost:8080
cd apps/frontend
# Install dependencies
npm install
# or
pnpm install
# Create environment file
echo "VITE_API_BASE_URL=http://localhost:8080/api" > .env
# Start development server
npm run devThe dashboard will be available at http://localhost:5173
cd apps/marketplace
# Install dependencies
npm install
# Create environment file
echo "NEXT_PUBLIC_API_URL=http://localhost:8080/open-api" > .env.local
# Start development server
npm run devThe marketplace will be available at http://localhost:3000
Create apps/backend/.env with the following configuration:
# Database Configuration
SPRING_DATASOURCE_URL=jdbc:postgresql://localhost:5432/carventory
SPRING_DATASOURCE_USERNAME=postgres
SPRING_DATASOURCE_PASSWORD=your_secure_password
SPRING_JPA_HIBERNATE_DDL_AUTO=validate
# JWT Authentication
JWT_SECRET=your_minimum_32_character_secret_key_here
JWT_EXPIRATION=86400000
# Email Configuration (Gmail example)
SPRING_MAIL_HOST=smtp.gmail.com
SPRING_MAIL_PORT=587
SPRING_MAIL_USERNAME=your_email@gmail.com
SPRING_MAIL_PASSWORD=your_gmail_app_password
SPRING_MAIL_PROPERTIES_MAIL_SMTP_AUTH=true
SPRING_MAIL_PROPERTIES_MAIL_SMTP_STARTTLS_ENABLE=true
# Cloudinary Storage
CLOUDINARY_CLOUD_NAME=your_cloud_name
CLOUDINARY_API_KEY=your_api_key
CLOUDINARY_API_SECRET=your_api_secret
# Application Settings
SERVER_PORT=8080
SPRING_APPLICATION_NAME=carventoryImportant Notes:
- Replace all placeholder values with your actual credentials
- For Gmail, use an App Password (not your account password): Generate App Password
- Generate a secure JWT secret:
openssl rand -base64 32
Create apps/frontend/.env:
VITE_API_BASE_URL=http://localhost:8080/apiFor production, replace with your deployed backend URL.
Create apps/marketplace/.env.local:
NEXT_PUBLIC_API_URL=http://localhost:8080/open-apiFor production, replace with your deployed backend URL.
- Authenticated API:
http://localhost:8080/api - Public API:
http://localhost:8080/open-api
Protected endpoints require a JWT token in the Authorization header:
Authorization: Bearer <your_jwt_token>
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| POST | /auth/login |
User login | No |
| POST | /users/register |
Company registration | No |
| POST | /users/forgot-password |
Request password reset | No |
| POST | /users/reset-password |
Reset password with token | No |
| POST | /users/verify-email |
Verify email address | No |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| GET | /cars |
List all cars | Yes |
| GET | /cars/{id} |
Get car details | Yes |
| POST | /cars |
Add new car | Yes |
| PUT | /cars/{id} |
Update car | Yes |
| DELETE | /cars/{id} |
Delete car (soft) | Yes |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| GET | /inquiries |
List all inquiries | Yes |
| POST | /inquiries |
Create inquiry | Yes |
| PUT | /inquiries/{id} |
Update inquiry | Yes |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| GET | /bookings |
List all bookings | Yes |
| POST | /bookings |
Create booking | Yes |
| PUT | /bookings/{id} |
Update booking | Yes |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| GET | /dashboard/status |
Get dashboard statistics | Yes |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| GET | /open-api/cars |
Browse available cars | No |
| GET | /open-api/cars/search |
Search cars with filters | No |
| GET | /open-api/company/{id} |
Get company details | No |
curl -X POST http://localhost:8080/api/auth/login \
-H "Content-Type: application/json" \
-d '{
"email": "user@example.com",
"password": "password123"
}'Response:
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"user": {
"id": 1,
"email": "user@example.com",
"role": "ADMIN"
}
}curl -X GET http://localhost:8080/api/dashboard/status \
-H "Authorization: Bearer YOUR_JWT_TOKEN"curl -X GET "http://localhost:8080/open-api/cars/search?make=Toyota&minPrice=500000&maxPrice=1000000"carventory/
βββ apps/
β βββ backend/ # Spring Boot Application
β β βββ src/
β β β βββ main/
β β β β βββ java/com/carventory/
β β β β β βββ controller/ # REST API Controllers
β β β β β βββ service/ # Business Logic Layer
β β β β β βββ repository/ # Database Access Layer
β β β β β βββ entity/ # JPA Entity Models
β β β β β βββ dto/ # Data Transfer Objects
β β β β β βββ config/ # Spring Configuration
β β β β β βββ security/ # Security & JWT
β β β β β βββ util/ # PDF & Cloudinary Utils
β β β β β βββ helper/ # Helper Classes
β β β β βββ resources/
β β β β βββ db/migration/ # Flyway SQL Migrations
β β β β βββ application.properties
β β β βββ test/ # Unit Tests
β β βββ pom.xml # Maven Dependencies
β β βββ Dockerfile # Docker Configuration
β β βββ .env.example # Environment Template
β β
β βββ frontend/ # React Dashboard
β β βββ src/
β β β βββ pages/ # Dashboard Pages
β β β βββ components/ # Reusable Components
β β β βββ services/ # API Client (Axios)
β β β βββ utils/ # Utility Functions
β β β βββ router/ # Route Configuration
β β β βββ App.tsx # Root Component
β β β βββ main.tsx # Entry Point
β β βββ package.json
β β βββ vite.config.ts # Vite Configuration
β β βββ tailwind.config.js # Tailwind CSS Config
β β βββ index.html
β β
β βββ marketplace/ # Next.js Public Site
β βββ app/ # Next.js App Router
β βββ components/ # React Components
β βββ lib/ # Utility Libraries
β βββ public/ # Static Assets
β βββ package.json
β βββ next.config.js # Next.js Configuration
β βββ tailwind.config.ts # Tailwind CSS Config
β
βββ LICENSE # MIT License
βββ README.md # This File
| Directory | Purpose |
|---|---|
backend/entity/ |
Database models (Car, User, Company, Booking, Inquiry) |
backend/service/ |
Business logic and data processing |
backend/controller/ |
REST API endpoint definitions |
backend/repository/ |
Database query methods (Spring Data JPA) |
backend/db/migration/ |
Flyway database version control |
frontend/pages/ |
Dashboard UI pages (Cars, Bookings, Analytics) |
frontend/services/ |
Centralized API client configuration |
marketplace/app/ |
Public marketplace pages and routing |
marketplace/components/ |
Reusable UI components |
- Password Hashing: All passwords are hashed using bcrypt via Spring Security's
PasswordEncoder - JWT Tokens: Stateless authentication with configurable expiration (default: 24 hours)
- Password History: Prevents reuse of previous passwords
- Email Verification: Required for account activation
- Password Reset: Secure token-based reset flow with expiration
- Soft Delete: Deleted records are flagged rather than removed for audit trails
- Company Scoping: Users can only access data belonging to their company
- Request Logging: All API requests are logged for security auditing
- CORS Configuration: Restricted cross-origin access in production
- Cloud Storage: All uploads routed through Cloudinary (no local storage)
- Authentication Required: Only authenticated users can upload documents
- File Type Validation: Client and server-side validation of file types
- Size Limits: Enforced maximum file sizes per upload
- Environment Variables: Never commit
.envfiles to version control - Secret Management: Store secrets in secure vaults (AWS Secrets Manager, HashiCorp Vault)
- JWT Secret Rotation: Regularly rotate the
JWT_SECRETvalue - HTTPS Only: Always use HTTPS in production environments
- Database Credentials: Use strong, unique passwords for database access
- Regular Updates: Keep dependencies updated to patch security vulnerabilities
βββββββββββββββ βββββββββββββββ βββββββββββββββ
β Cloudflare ββββββΆβ Vercel β β AWS β
β CDN β β (Marketplace)β β RDS β
βββββββββββββββ βββββββββββββββ β (PostgreSQL)β
ββββββββ¬βββββββ
βββββββββββββββ βββββββββββββββ β
β Netlify β β AWS EC2 βββββββββββββ
β (Dashboard) β β (Backend) β
βββββββββββββββ βββββββββββββββ
β
ββββββββΌβββββββ
β Cloudinary β
β (Storage) β
βββββββββββββββ
# Build JAR
cd apps/backend
mvn clean package
# Transfer to server
scp target/carventory-0.0.1-SNAPSHOT.jar user@server:/opt/carventory/
# Run with systemd
sudo systemctl start carventorySample systemd service (/etc/systemd/system/carventory.service):
[Unit]
Description=Carventory Backend
After=network.target
[Service]
User=carventory
WorkingDirectory=/opt/carventory
ExecStart=/usr/bin/java -jar carventory-0.0.1-SNAPSHOT.jar
EnvironmentFile=/opt/carventory/.env
Restart=always
[Install]
WantedBy=multi-user.target# Build Docker image
cd apps/backend
docker build -t carventory-backend:1.0 .
# Run container
docker run -d \
--name carventory-backend \
-p 8080:8080 \
--env-file .env \
carventory-backend:1.0- Connect your Git repository
- Set environment variables in platform dashboard
- Platform auto-detects Maven and deploys
cd apps/frontend
# Build production assets
npm run build
# Deploy (example with Netlify CLI)
netlify deploy --prod --dir=distBuild settings:
- Build command:
npm run build - Publish directory:
dist - Environment variables: Set
VITE_API_BASE_URLto production backend URL
cd apps/marketplace
# Install Vercel CLI
npm install -g vercel
# Deploy
vercel --prodSet environment variable:
NEXT_PUBLIC_API_URL: Production backend URL
npm run build
# Output in 'out' directory - serve with any static hostManaged PostgreSQL (Recommended):
- AWS RDS
- Azure Database for PostgreSQL
- Google Cloud SQL
- DigitalOcean Managed Databases
Configuration:
- Enable automated backups
- Set up read replicas for high traffic
- Use connection pooling (HikariCP configured in Spring Boot)
version: '3.8'
services:
postgres:
image: postgres:15-alpine
environment:
POSTGRES_DB: carventory
POSTGRES_USER: postgres
POSTGRES_PASSWORD: ${DB_PASSWORD}
volumes:
- postgres_data:/var/lib/postgresql/data
ports:
- "5432:5432"
backend:
build: ./apps/backend
ports:
- "8080:8080"
environment:
SPRING_DATASOURCE_URL: jdbc:postgresql://postgres:5432/carventory
SPRING_DATASOURCE_USERNAME: postgres
SPRING_DATASOURCE_PASSWORD: ${DB_PASSWORD}
JWT_SECRET: ${JWT_SECRET}
CLOUDINARY_CLOUD_NAME: ${CLOUDINARY_CLOUD_NAME}
CLOUDINARY_API_KEY: ${CLOUDINARY_API_KEY}
CLOUDINARY_API_SECRET: ${CLOUDINARY_API_SECRET}
depends_on:
- postgres
volumes:
postgres_data:Run with: docker-compose up -d
Solution:
# Verify PostgreSQL is running
sudo systemctl status postgresql
# or
psql -U postgres -c "SELECT version();"
# Check connection details in .env
echo $SPRING_DATASOURCE_URL
# Create database if missing
createdb carventory
# Test connection
psql -U postgres -d carventory -c "SELECT 1;"Solution:
# Grant full permissions
psql -U postgres -d carventory -c "GRANT ALL PRIVILEGES ON DATABASE carventory TO postgres;"
# Clean and rebuild
dropdb carventory && createdb carventory
cd apps/backend && mvn flyway:migrate
# Check migration files
ls -la apps/backend/src/main/resources/db/migration/Solution:
- Users must log in again to obtain a fresh token
- Adjust expiration in
.env:JWT_EXPIRATION=172800000(48 hours) - Implement refresh token mechanism for better UX
Solution:
// Verify CORS configuration in Spring Security
@Bean
public CorsConfigurationSource corsConfigurationSource() {
CorsConfiguration configuration = new CorsConfiguration();
configuration.addAllowedOrigin("http://localhost:5173");
configuration.addAllowedMethod("*");
configuration.addAllowedHeader("*");
configuration.setAllowCredentials(true);
// ...
}Solution:
# Clear and reinstall
rm -rf node_modules package-lock.json
npm install
# Clear Vite cache
rm -rf dist .vite
npm run build
# Verify Node version
node --version # Must be 18+Solution:
// Check localStorage in DevTools
localStorage.getItem('theme')
// Clear cache if needed
localStorage.clear()
// Verify theme toggle logic
console.log(document.documentElement.classList.contains('dark'))Solution:
# Verify credentials
echo $CLOUDINARY_CLOUD_NAME
echo $CLOUDINARY_API_KEY
# Test with curl
curl -X POST "https://api.cloudinary.com/v1_1/$CLOUDINARY_CLOUD_NAME/image/upload" \
-F "file=@test.jpg" \
-F "upload_preset=unsigned_preset"
# Check account limits in Cloudinary dashboardSolution:
# For Gmail, use App Password (not account password)
# Generate at: https://myaccount.google.com/apppasswords
# Verify SMTP settings
SPRING_MAIL_HOST=smtp.gmail.com
SPRING_MAIL_PORT=587
SPRING_MAIL_USERNAME=your_email@gmail.com
SPRING_MAIL_PASSWORD=your_16_char_app_password
# Check logs for email send attempts
grep "Mail" logs/spring.logSolution:
- Enable Caffeine cache in Spring Boot
- Optimize database queries with indexes
- Implement pagination for large datasets
- Use React.lazy() for code splitting
Solution:
# Adjust HikariCP settings in application.properties
spring.datasource.hikari.maximum-pool-size=20
spring.datasource.hikari.minimum-idle=5
spring.datasource.hikari.connection-timeout=30000Contributions are welcome and appreciated! Here's how you can help improve Carventory:
- Fork the repository on GitHub
- Clone your fork:
git clone https://github.com/YOUR_USERNAME/carventory.git cd carventory - Create a feature branch:
git checkout -b feature/amazing-new-feature
- Make your changes following the existing code style
- Write tests for new functionality
- Ensure all tests pass:
mvn test(backend) andnpm test(frontend) - Update documentation if needed
- Commit your changes:
git commit -m "Add amazing new feature" - Push to your fork:
git push origin feature/amazing-new-feature
- Open a Pull Request on GitHub
- Java: Follow Spring Boot conventions and use meaningful variable names
- TypeScript/React: Use functional components with hooks
- Formatting: Run
mvn spotless:apply(backend) before committing - Commit Messages: Use clear, descriptive messages (e.g., "Fix booking date validation")
- π§ͺ Testing: Expand test coverage for backend services
- π Documentation: Improve API docs and user guides
- π¨ UI/UX: Enhance dashboard and marketplace design
- π Bug Fixes: Resolve open issues
- β¨ Features: Implement new functionality from the roadmap
Found a bug? Please open an issue with:
- Clear description of the problem
- Steps to reproduce
- Expected vs actual behavior
- Environment details (OS, Java version, browser)