A full-stack web application for managing scrap auto parts — connecting scrap dealers with customers. Built with Next.js, TypeScript, and MariaDB/MySQL.
- Customer Portal: Search parts, book appointments, manage wishlist
- Dealer Portal: Manage inventory, handle bookings, maintain part catalog
- Database Triggers: Auto-booking, wishlist notifications, booking status updates
- Persistent Storage: All data stored in MariaDB/MySQL (not in-memory)
- Node.js (v18 or higher) — Download
- pnpm — Install with:
npm install -g pnpm - MariaDB or MySQL — Either one works!
- Windows: Download MySQL Installer or MariaDB MSI
- Mac:
brew install mysqlorbrew install mariadb - Linux:
sudo apt install mariadb-serverorsudo dnf install mariadb-server
git clone <your-repo-url>
cd DBMSpnpm install-
Make sure your MySQL/MariaDB server is running:
- Windows: Open Services app → find MySQL/MariaDB → Start
- Linux:
sudo systemctl start mariadborsudo systemctl start mysql - Mac:
brew services start mysqlorbrew services start mariadb
-
Run the setup script to create the database, tables, triggers, and sample data:
On Linux/Mac:
mysql -u root -p < setup.sqlOn Windows (Command Prompt):
mysql -u root -p < setup.sqlOn Windows (PowerShell):
Get-Content setup.sql | mysql -u root -p
It will ask for your MySQL/MariaDB root password. Enter it and press Enter.
-
Copy the example env file:
cp .env.example .env
On Windows (Command Prompt):
copy .env.example .env -
Open
.envand set your database password:DB_HOST=localhost DB_PORT=3306 DB_USER=root DB_PASSWORD=your_actual_password_here DB_NAME=AutoPartsDB
pnpm devOpen http://localhost:3000 in your browser. Done! 🎉
| Name | Role | Notes |
|---|---|---|
| Menka Devi | Customer | Active customer from Delhi |
| Savitri Devi | Customer | Active customer from Mumbai |
| Mewa Singh | Customer | Active customer from Jaipur |
| Meera Bai | Customer | Active customer from Ahmedabad |
| Ramachandra | Dealer | Has 2 garages in Delhi |
| Mohandas | Dealer | Has 1 garage in Mumbai |
| Bhaskar | Dealer | Has 1 garage in Jaipur |
DBMS/
├── app/
│ ├── api/ # Backend API routes (talk to MariaDB)
│ │ ├── auth/login/ # POST - user authentication
│ │ ├── bookings/ # GET/POST/PUT - booking management
│ │ ├── catalogs/ # GET/POST - part catalog
│ │ ├── customers/ # GET - customer list
│ │ ├── dealers/ # GET - dealer list
│ │ ├── garages/ # GET - garage list
│ │ ├── parts/ # GET/POST/PUT - parts inventory
│ │ └── wishlist/ # GET/POST/DELETE - wishlist
│ ├── customer/ # Customer-facing pages
│ └── dealer/ # Dealer-facing pages
├── components/ # Reusable React components
├── lib/
│ ├── db.ts # Database connection pool
│ ├── data.ts # TypeScript interfaces & helpers
│ └── store.ts # Auth state (Zustand)
├── setup.sql # Database schema + sample data
├── .env.example # Template for environment variables
└── package.json
The app uses 7 tables and 3 triggers:
Tables: SCRAP_DEALER, GARAGE, PART_CATALOG, PART_ITEM, CUSTOMER, BOOKING, WISHLIST
Triggers:
Auto_Book_Part_Item— Marks part as "Booked" when a booking is createdUpdate_Part_On_Booking_Status— Updates part status when booking is completed/cancelledNotify_Wishlist_On_Availability— Notifies wishlist when a matching part becomes available
→ Check your password in .env. Make sure it matches your MySQL/MariaDB root password.
→ Make sure MySQL/MariaDB is running. On Windows, check the Services app. On Linux: sudo systemctl status mariadb.
→ You forgot to run setup.sql. Run: mysql -u root -p < setup.sql
→ Both work identically. MariaDB is a fork of MySQL. The SQL syntax is the same.