# Supply Chain Management System (SCMS)

**National Practical Exam 2025-2026** — ICT & Multimedia, Software Development  
**Company:** SupplyNet Ltd, Musanze District, Rwanda

---

## Project Structure

```
SCMS/
├── backend-project/     # Node.js + Express API
├── frontend-project/    # React.js + Tailwind CSS
├── database/
│   └── schema.sql       # MySQL database schema
└── docs/
    └── ERD.md           # Entity Relationship Diagram
```

> **Exam folder:** Copy this entire project into a folder named  
> `FirstName_LastName_National_Practical_Exam_2026` using your real name.

---

## Requirements Checklist

| Requirement | Status |
|-------------|--------|
| ERD with PK, FK, cardinalities | ✅ See `docs/ERD.md` |
| MySQL database `SCMS` | ✅ See `database/schema.sql` |
| backend-project (Node.js + Express) | ✅ |
| frontend-project (React.js + Tailwind) | ✅ |
| Menu: Supplier, Shipment, Delivery, Reports, Logout | ✅ |
| Responsive UI | ✅ |
| Insert on all 3 forms | ✅ |
| CRUD on Shipment & Delivery only | ✅ |
| User login & sign up (username/password) | ✅ |
| Axios integration | ✅ |
| Daily, Weekly, Monthly reports | ✅ |

---

## Prerequisites

- **Node.js** v18+ ([nodejs.org](https://nodejs.org))
- **MySQL** 8.0+ ([mysql.com](https://mysql.com))

---

## Setup Instructions

### 1. Create the Database

Open MySQL and run:

```bash
mysql -u root -p < database/schema.sql
```

Or paste the contents of `database/schema.sql` into MySQL Workbench and execute.

### 2. Configure Backend

```bash
cd backend-project
copy .env.example .env    # Windows
# Edit .env with your MySQL password
npm install
npm run seed              # Creates admin user
npm start                 # Runs on http://localhost:5000
```

**.env settings:**

```
PORT=5000
DB_HOST=localhost
DB_USER=root
DB_PASSWORD=your_mysql_password
DB_NAME=SCMS
JWT_SECRET=scms_secret_key_2026
```

### 3. Start Frontend

```bash
cd frontend-project
npm install
npm run dev               # Runs on http://localhost:5173
```

### 4. Login

Open **http://localhost:5173** in your browser.

| Username | Password  |
|----------|-----------|
| admin    | admin123  |

---

## API Endpoints

| Method | Endpoint | Description |
|--------|----------|-------------|
| POST | `/api/auth/login` | User login |
| POST | `/api/auth/register` | Create user account |
| GET | `/api/suppliers` | List suppliers |
| POST | `/api/suppliers` | Add supplier (Insert only) |
| GET | `/api/shipments` | List shipments |
| POST | `/api/shipments` | Create shipment |
| PUT | `/api/shipments/:id` | Update shipment |
| DELETE | `/api/shipments/:id` | Delete shipment |
| GET | `/api/deliveries` | List deliveries |
| POST | `/api/deliveries` | Create delivery |
| PUT | `/api/deliveries/:id` | Update delivery |
| DELETE | `/api/deliveries/:id` | Delete delivery |
| GET | `/api/reports/daily` | Daily report |
| GET | `/api/reports/weekly` | Weekly report |
| GET | `/api/reports/monthly` | Monthly report |

---

## Technology Stack

| Layer | Technology |
|-------|------------|
| Frontend | React.js, Tailwind CSS, Axios, React Router |
| Backend | Node.js, Express.js, JWT, bcryptjs |
| Database | MySQL |

---

## Exam Demo Flow

1. **Login** with admin credentials
2. **Supplier** — Register a new supplier (Insert)
3. **Shipment** — Create, edit, delete shipments linked to a supplier
4. **Delivery** — Record, update, delete deliveries linked to a shipment
5. **Reports** — Generate Daily, Weekly, and Monthly reports
6. **Logout** — End session

---

## Author

Replace with your name: **FirstName LastName**  
School Year: **2025-2026**
