This guide walks you through every step required to run AutoPart Pro on your local machine — from cloning the repository to making your first authenticated API call. The entire process takes under 10 minutes on a machine that already has Node.js and MySQL installed.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 enforces CORS at the server level. By default, only
http://localhost:5173 and http://192.168.1.165:5173 are listed as allowed origins in backend/src/app.js. If you access the frontend from any other origin — including a different port or a remote IP — the browser will block API requests with a CORS error. Update the origin array in app.js and restart the backend server if you need to allow additional origins.Prerequisites
Before you begin, make sure the following are installed and accessible on your
PATH:- Node.js 18 or later — verify with
node -v - npm (bundled with Node.js) — verify with
npm -v - MySQL 8 or later — verify with
mysql --version
root user, but any sufficiently privileged account works.Clone the Repository
Clone the AutoPart Pro repository from GitHub and enter the project root:The repository contains two top-level directories —
backend/ and frontend/ — that are developed and run independently.Set Up the Database
AutoPart Pro ships with a single SQL file that creates the database, all tables, and a test connection record. Run it against your MySQL server:Enter your MySQL root password when prompted. The script creates the
A
autopart_pro database (if it does not already exist) and provisions the following tables:| Table | Purpose |
|---|---|
users | Registered users with hashed passwords and an admin | employee | client role |
products | Parts catalog — SKU, name, brand, compatible vehicles, price, stock, min_stock threshold, category, description, and optional image URL |
sales | Sale header records linked to the purchasing user, with a total and a pending | completed | cancelled status |
sale_items | Line items for each sale — product, quantity, and unit price at time of purchase |
test_connection table is also created and seeded with a single row as a sanity-check that the script ran successfully.Configure the Backend Environment
Create a Populate it with the following variables, replacing the placeholder values with your own:See the Environment Variables reference for a full description of every variable and guidance on choosing a secure
.env file inside the backend/ directory. This file is read by dotenv at startup and must be present before you start the server:JWT_SECRET.Install Dependencies and Start the Backend
Install Node.js dependencies and start the Express development server:The backend now listens on port 5000 and exposes the API under the
npm run dev launches the server with nodemon, so file changes automatically restart the process during development. On a successful start you will see:/api prefix.Configure the Frontend Environment
Open a second terminal, return to the project root, and create a Add the following variable, pointing the frontend at the local backend:Vite only exposes environment variables prefixed with
.env file inside frontend/:VITE_ to the browser bundle — any other variables in this file are ignored at build time.Install Dependencies and Start the Frontend
From the Vite starts on port 5173 by default. You will see output similar to:Open
frontend/ directory, install dependencies and start the Vite development server:http://localhost:5173 in your browser to view the AutoPart Pro UI.Verify the Backend is Running
With the backend server running, confirm the health endpoint responds correctly:Expected response:A
200 OK with "status": "ON" confirms that the Express server started successfully and the process is healthy. The timestamp will reflect the current server time.Make Your First Authenticated API Call
AutoPart Pro’s protected endpoints require a Bearer token obtained by logging in. First, register a new user account:A successful registration returns the new user record. Next, log in to receive a JWT:The response includes a
token field. Copy that value and use it as a Bearer token to call any protected endpoint — for example, listing all products: