# Stock Inventory Management System - TODO

## Step 1: Database
- [ ] Create `schema.sql` with all required tables, PK/FK constraints, timestamps, and indexes.

## Step 2: Backend
- [ ] Create `backend/package.json` and install deps in instructions.
- [ ] Implement `backend/server.js` (single-file backend) with:
  - [ ] Express setup
  - [ ] MySQL connection pool
  - [ ] JWT auth (bcrypt hashing on register)
  - [ ] Role-based access middleware (Admin/Manager/Clerk)
  - [ ] CRUD APIs: users (auth), categories, products, suppliers
  - [ ] Purchase flow: create purchase draft w/ items, approve with transaction, stock IN + stock_movements
  - [ ] Sales flow: create sale with items, transactional stock deduction (prevent negative), stock OUT + stock_movements
  - [ ] Reports APIs: stock, sales (daily/monthly), profit, low-stock, purchases, stock-movements
  - [ ] Error handling and consistent JSON responses

## Step 3: Frontend
- [ ] Tailwind setup in `frontend/` (config + postcss + index.css directives)
- [ ] Install frontend deps: react-router-dom, axios
- [ ] Implement routing + protected routes
- [ ] Build pages: Login, Dashboard, Products, Categories, Suppliers, Purchases, Sales (POS), Reports
- [ ] Implement Axios API client with JWT handling
- [ ] UI wiring for all CRUD and report endpoints

## Step 4: Run Instructions
- [ ] Provide clear run steps: import schema, configure env, start backend + frontend

## Step 5: Sanity Checks
- [ ] Validate purchase/sales transactions and stock integrity
- [ ] Validate role restrictions
- [ ] Validate all report endpoints output

