Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/JFKoryy/autopart-pro/llms.txt

Use this file to discover all available pages before exploring further.

AutoPart Pro is a full-stack web application built specifically for automotive parts retailers who need a single platform to manage their inventory, track sales, and serve customers through an integrated e-commerce experience. Rather than juggling spreadsheets for stock levels, a separate point-of-sale system, and a disconnected online storefront, AutoPart Pro unifies all three into one cohesive solution — with role-based access control ensuring every user sees exactly what they need and nothing more.

Tech Stack

AutoPart Pro is built on a modern, production-proven stack chosen for reliability and developer ergonomics:
LayerTechnology
Backend runtimeNode.js 18+
API frameworkExpress ^5.2.1
DatabaseMySQL 8 (mysql2 ^3.22.5)
Authenticationjsonwebtoken ^9.0.3 + bcryptjs ^3.0.3
Frontend frameworkReact ^19.0.0
Build toolVite ^6.4.3
StylingTailwind CSS ^4.0.0
RoutingReact Router DOM ^7.1.1
The backend is a CommonJS Express application that exposes a REST API, while the frontend is a Vite-powered React SPA that consumes it. The two halves are entirely decoupled — they communicate exclusively over HTTP, which makes independent deployment and scaling straightforward.

Key Features

AutoPart Pro ships with everything a growing auto parts shop needs on day one:
  • JWT authentication with roles — Every request to a protected endpoint is validated against a signed JWT. Three roles (admin, employee, client) govern what each user can see and do.
  • Full product CRUD with SKU tracking — Create, read, update, and delete products. Each product carries a unique SKU, brand, compatible vehicle list, price, stock count, category, description, and an optional image URL.
  • Configurable minimum stock alerts — Each product has a min_stock threshold. When stock falls to or below that threshold, the server emits a low-stock event via Node’s built-in EventEmitter, surfacing a console alert immediately.
  • Shopping cart and checkout — Clients browse products, add items to a persistent cart, and complete a checkout that records a real sale and automatically deducts stock from inventory.
  • Sales history with line-item detail — Every completed sale is stored with its associated sale_items, giving admins and employees a full breakdown of what was sold, at what price, and by whom.
  • Admin panel for user and role management — Administrators can view all registered users, assign roles, and maintain the workforce without touching the database directly.
  • Role-differentiated dashboards — Admins see full inventory controls and sales analytics; employees see inventory and sales workflows; clients see the storefront and their order history.

Architecture Overview

AutoPart Pro follows a classic decoupled REST API + React SPA architecture:
┌─────────────────────────────┐        HTTP/JSON       ┌──────────────────────────────┐
│   React SPA (Vite + Tailwind)│ ◄───────────────────► │  Express REST API (Node.js)  │
│   port 5173                  │                        │  port 5000                   │
│                              │                        │                              │
│  AuthContext / CartContext   │                        │  /api/auth                   │
│  pages / components          │                        │  /api/products               │
│  services (fetch wrappers)   │                        │  /api/sales                  │
└─────────────────────────────┘                        │  /api/users                  │
                                                        │  /api/health                 │
                                                        └──────────┬───────────────────┘
                                                                   │ mysql2
                                                        ┌──────────▼───────────────────┐
                                                        │  MySQL 8 (autopart_pro DB)   │
                                                        │  users · products · sales    │
                                                        │  sale_items                  │
                                                        └──────────────────────────────┘
The backend is organized as an MVC-style project: config/ handles the MySQL connection pool, models/ contain raw SQL queries, controllers/ hold business logic, middleware/ enforces authentication and role guards, routes/ wire HTTP verbs to controllers, and events/ holds the stock-alert EventEmitter. The frontend mirrors this separation: context/ manages global auth and cart state, services/ wrap all API calls, pages/ compose full views, and components/ provide reusable UI building blocks.

User Roles

Access in AutoPart Pro is governed by three roles stored in the users table:
RoleCapabilities
adminFull access — inventory CRUD, user management, sales history, admin panel
employeeInventory management, sales processing, and order history; no user administration
clientStorefront browsing, cart, checkout, and personal order history
Roles are encoded in the JWT payload on login and validated by the role-checking middleware on every protected route.

Explore the Docs

Quickstart

Clone the repo, seed the database, and have both servers running in under 10 minutes.

Architecture Overview

A deeper look at the MVC backend structure, React context patterns, and data flow.

Inventory Management

Product CRUD, SKU management, stock thresholds, and low-stock alert events.

API Reference

Complete endpoint reference for auth, products, sales, and users.

Build docs developers (and LLMs) love