# Customer Information Management System (CIMS) - MERN

This project is a MERN stack web application for Beauty Warehouse to manage:

- User account, login, logout (session-based)
- Products (create, read, update, delete)
- Orders (create, read, update, delete)
- Customers (create, read, update, delete)
- Daily report of orders made by customers

## 1) Backend setup

```bash
cd backend
npm install
```

Create `.env` from `.env.example`:

```bash
PORT=5000
MONGO_URI=mongodb://127.0.0.1:27017/customer_info //CHANGE ACCORDINGLY 
SESSION_SECRET=change_me
CLIENT_URL=http://localhost:5173
```

Run backend:

```bash
npm run dev
```

## 2) Frontend setup

```bash
cd frontend
npm install
npm run dev
```

Frontend URL:

`http://localhost:5173`

Backend URL:

`http://localhost:5000`

## Notes

- Login is session-based using `express-session` + `connect-mongo`.
- Referential integrity is enforced in API logic:
  - Customer references valid product and order.
  - Product/order cannot be deleted if linked to a customer.
