# Supply Chain Management System (SCMS)

**Developer:**  
**Organization:** SupplyNet Ltd — Musanze District, Rwanda  
**Exam:** National Practical Exam 2026

---

## Folder Structure

```
Yann_Kamali_National_Practical_Exam_2026/
├── backend-project/     # Node.js + Express + MongoDB
├── frontend-project/    # React.js + Tailwind CSS + Axios
└── README.md
```

---

## Entity Relationship Diagram (ERD)

### Entities

| Entity | Attributes | Primary Key |
|--------|-----------|-------------|
| **Supplier** | supplierCode, supplierName, telephone, address, email | supplierCode |
| **Shipment** | shipmentNumber, shipmentDate, shipmentStatus, destination | shipmentNumber |
| **Delivery** | deliveryCode, deliveryDate, quantityDelivered, deliveryStatus | deliveryCode |
| **User** | username, email, password | _id (MongoDB) |

### Relationships & Cardinalities

```
    ┌──────────────┐         1 : M          ┌──────────────┐         1 : M          ┌──────────────┐
    │   SUPPLIER   │ ──────────────────────>│   SHIPMENT   │ ──────────────────────>│   DELIVERY   │
    ├──────────────┤      supplies          ├──────────────┤      contains          ├──────────────┤
    │ PK supplierCode                     │ PK shipmentNumber                     │ PK deliveryCode
    │    supplierName                     │ FK supplierCode                       │ FK shipmentNumber
    │    telephone                        │    shipmentDate                       │    deliveryDate
    │    address                          │    shipmentStatus                     │    quantityDelivered
    │    email                            │    destination                        │    deliveryStatus
    │ FK user (owner)                     │ FK user (owner)                       │ FK user (owner)
    └──────────────┘                       └──────────────┘                       └──────────────┘

    Each procurement officer (User) owns their own Supplier, Shipment, and Delivery records.
```

---

## Features Implemented

| Feature | Description |
|---------|-------------|
| MongoDB database **SCMS** | Supplier, Shipment, Delivery collections |
| Session authentication | Username + password login |
| Per-user data isolation | Each user sees only their own records |
| Full CRUD | All three entities with Edit/Delete/Retrieve buttons |
| Auto-generated IDs | SUP0001, SHP0001, DLV0001 |
| Dashboard | Personal stats and quick links |
| Reports | Daily, weekly, monthly |
| Forgot password | Email reset link (SMTP or dev console link) |
| Dark brown UI | Tailwind CSS, responsive design |
| Menu | Dashboard, Supplier, Shipment, Delivery, Reports, Logout |

---

## Setup

### Prerequisites
- Node.js v18+
- MongoDB running on `mongodb://127.0.0.1:27017`

### Backend
```bash
cd backend-project
npm install
npm start
```

### Frontend
```bash
cd frontend-project
npm install
npm run dev
```

Open **http://localhost:5173** — Register with username, email, and password.

### Email (password reset)
Add SMTP settings to `backend-project/.env`. Without SMTP, the reset link appears on screen and in the backend console.

---

© 2026 SupplyNet Ltd
