AutoDealer Pro - Car Dealership Management System

A comprehensive, secure, and scalable car dealership website with user and admin functionality.

šŸš— Features

User Features

  • Browse and search cars by brand, model, year, price, mileage, fuel type
  • View detailed car specifications with image galleries
  • User registration and authentication (JWT-based)
  • Wishlist and car comparison functionality
  • Contact dealership and request test drives
  • Responsive mobile-first design

Admin Features

  • Complete admin dashboard for car inventory management
  • User account and inquiry management
  • Analytics and reporting on car views and leads
  • Role-based access control
  • Bulk operations and advanced filtering

Technical Features

  • RESTful API with comprehensive endpoints
  • JWT authentication with refresh tokens
  • Role-based authorization (user/admin)
  • Image upload and management
  • Advanced search and filtering
  • Responsive UI with Tailwind CSS
  • SQLite database (easily upgradeable to PostgreSQL)

šŸ—ļø Architecture

ā”œā”€ā”€ backend/
│   ā”œā”€ā”€ database/
│   │   ā”œā”€ā”€ migrations.ts    # Database schema and migrations
│   │   ā”œā”€ā”€ queries.ts       # Database query functions
│   │   └── README.md
│   ā”œā”€ā”€ routes/
│   │   ā”œā”€ā”€ auth.ts         # Authentication routes
│   │   ā”œā”€ā”€ cars.ts         # Car management routes
│   │   ā”œā”€ā”€ users.ts        # User management routes
│   │   ā”œā”€ā”€ admin.ts        # Admin-specific routes
│   │   └── static.ts       # Static file serving
│   ā”œā”€ā”€ middleware/
│   │   ā”œā”€ā”€ auth.ts         # JWT authentication middleware
│   │   └── validation.ts   # Request validation
│   ā”œā”€ā”€ utils/
│   │   ā”œā”€ā”€ jwt.ts          # JWT utilities
│   │   └── security.ts     # Security utilities
│   ā”œā”€ā”€ index.ts            # Main backend entry point
│   └── README.md
ā”œā”€ā”€ frontend/
│   ā”œā”€ā”€ components/
│   │   ā”œā”€ā”€ App.tsx         # Main app component
│   │   ā”œā”€ā”€ Layout/         # Layout components
│   │   ā”œā”€ā”€ Auth/           # Authentication components
│   │   ā”œā”€ā”€ Cars/           # Car-related components
│   │   ā”œā”€ā”€ Admin/          # Admin dashboard components
│   │   └── Common/         # Shared components
│   ā”œā”€ā”€ hooks/              # Custom React hooks
│   ā”œā”€ā”€ services/           # API service functions
│   ā”œā”€ā”€ types/              # TypeScript type definitions
│   ā”œā”€ā”€ utils/              # Frontend utilities
│   ā”œā”€ā”€ index.html          # Main HTML template
│   ā”œā”€ā”€ index.tsx           # Frontend entry point
│   ā”œā”€ā”€ style.css           # Global styles
│   └── README.md
ā”œā”€ā”€ shared/
│   ā”œā”€ā”€ types.ts            # Shared TypeScript types
│   ā”œā”€ā”€ constants.ts        # Shared constants
│   └── utils.ts            # Shared utility functions
└── README.md

šŸš€ Getting Started

  1. The backend runs on Hono framework with TypeScript
  2. Frontend uses React 18 with TypeScript and Tailwind CSS
  3. Database uses SQLite with comprehensive schema
  4. Authentication uses JWT with role-based access control

šŸ” Security Features

  • JWT authentication with refresh tokens
  • Role-based access control (user/admin)
  • Password hashing with bcrypt
  • Request validation and sanitization
  • CORS handling
  • Rate limiting protection
  • SQL injection prevention

šŸ“Š Database Schema

  • users: User accounts with roles and profiles
  • cars: Vehicle inventory with specifications
  • car_images: Multiple images per vehicle
  • wishlists: User saved cars
  • inquiries: Contact requests and test drive bookings
  • analytics: Page views and user interactions

šŸŽØ UI/UX Features

  • Mobile-first responsive design
  • Advanced search and filtering
  • Image galleries with zoom
  • Comparison tools
  • Real-time updates
  • Loading states and error handling
  • Accessibility compliance

šŸ”§ Admin Dashboard

  • Car inventory management (CRUD operations)
  • User account management
  • Inquiry and lead tracking
  • Analytics and reporting
  • Bulk operations
  • Role management

šŸ“± API Endpoints

Authentication

  • POST /api/auth/register - User registration
  • POST /api/auth/login - User login
  • POST /api/auth/refresh - Token refresh
  • POST /api/auth/logout - User logout

Cars

  • GET /api/cars - List cars with filtering
  • GET /api/cars/:id - Get car details
  • POST /api/cars - Add new car (admin)
  • PUT /api/cars/:id - Update car (admin)
  • DELETE /api/cars/:id - Delete car (admin)

Users

  • GET /api/users/profile - Get user profile
  • PUT /api/users/profile - Update profile
  • GET /api/users/wishlist - Get user wishlist
  • POST /api/users/wishlist/:carId - Add to wishlist

Admin

  • GET /api/admin/users - List all users
  • GET /api/admin/analytics - Get analytics data
  • GET /api/admin/inquiries - List inquiries

🌐 Deployment

The application is designed to be deployed on Val Town with:

  • Backend API serving on HTTP trigger
  • Frontend served as static files
  • SQLite database for data persistence
  • Environment variables for configuration