Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
85a4632
feat: scaffold Vite React app
bbeare22 Sep 11, 2025
b4e2380
feat(ui): AppShell layout, tokens, router, base pages
bbeare22 Sep 11, 2025
2cba900
feat(ui): Card and KPI components + dashboard layout
bbeare22 Sep 12, 2025
49dfa66
feat(recalls): express proxy + live OpenFDA recalls table
bbeare22 Sep 12, 2025
271d295
Updated title
bbeare22 Sep 12, 2025
53b0540
Fixed gitignore
bbeare22 Sep 12, 2025
26159c7
chore: add root .gitignore and clean node_modules
bbeare22 Sep 12, 2025
fbe60f6
Update to project
bbeare22 Sep 12, 2025
07ef1ab
feat(maintenance): form shell with mL↔oz converter and validation
bbeare22 Sep 12, 2025
0fe1e50
feat(machines): list with filters, MachineCard, and detail route
bbeare22 Sep 12, 2025
d01678b
feat(ui): color-code overdue list and add days-since chip on MachineCard
bbeare22 Sep 12, 2025
1e4bc7f
feat(ui): add glowing status dot to MachineCard
bbeare22 Sep 12, 2025
46bd8e9
feat(ui): reuse status dots across Dashboard and MachineCard
bbeare22 Sep 12, 2025
66e8adc
feat(recalls): add brand filter, loading skeleton, and empty state
bbeare22 Sep 13, 2025
cfbdb4d
feat(machines): read from /api/machines and support _id in UI
bbeare22 Sep 13, 2025
fe9a80e
feat(maintenance): backend routes + connect form to API and auto-upda…
bbeare22 Sep 13, 2025
4520b61
feat(dashboard): fetch live machines and add Log maintenance shortcut…
bbeare22 Sep 17, 2025
9e7bec0
feat(dashboard): add Recent Maintenance card alongside Overdue Descal…
bbeare22 Sep 17, 2025
f8db7bd
Add employeeId and sterilizationNumber to user model, register page, …
bbeare22 Sep 17, 2025
80ee894
Small styling update on Login/Register/Logout
bbeare22 Sep 17, 2025
154350e
feat(ui): toast notifications, loading skeletons, and unified card he…
bbeare22 Sep 18, 2025
3ea7b5d
feat(history): add CSV export with toast notifications to maintenance…
bbeare22 Sep 18, 2025
6b3dc37
Added 404 not found page and also updated the about page
bbeare22 Sep 19, 2025
ca24f09
Polish UI: fix MachineForm & Maintenance form overflow, button styles
bbeare22 Sep 19, 2025
5777a72
Added cycle integration and a few updates
bbeare22 Sep 19, 2025
8930f71
Add sterilizer cycles integration, cycle history page, and UI polish
bbeare22 Sep 19, 2025
eb074e0
feat: add sterilizer cycles logging, sterilizer-specific maintenance …
bbeare22 Sep 20, 2025
e38b054
chore: add env examples
bbeare22 Sep 21, 2025
c52135f
updated readme
bbeare22 Sep 21, 2025
ea64e19
Small fix/ polish
bbeare22 Sep 21, 2025
739f45f
Add screenshots and update README
bbeare22 Sep 21, 2025
0b420a7
screenshot fix
bbeare22 Sep 21, 2025
47b381d
small fix
bbeare22 Sep 21, 2025
8813b35
Add screenshots and fix README paths
bbeare22 Sep 21, 2025
fc2e4e2
final check before submit
bbeare22 Sep 21, 2025
4a965be
Refactor date handling: shared helpers + aligned forms
bbeare22 Sep 23, 2025
896cd96
Refactor: use apiFetch everywhere; date helpers; small cleanups
bbeare22 Sep 23, 2025
352a419
Refactor: centralize API via apiFetch + auth utils; date helpers
bbeare22 Sep 23, 2025
e548bd4
Add ErrorBoundary and wrap app to avoid hard crashes
bbeare22 Sep 23, 2025
927d633
UI: add accessible Modal and use it for Add/Edit Machine
bbeare22 Sep 23, 2025
b5f8598
refactor: move inline styles to separate CSS files across components …
bbeare22 Sep 23, 2025
bafe630
Preparing for deploy
bbeare22 Sep 24, 2025
9383579
Updated ReadME
bbeare22 Sep 24, 2025
fe3d8ea
feat: add RBAC for maintenance/cycles + supervisor-only machine manag…
bbeare22 Sep 26, 2025
1d4d935
feat: update spores, cycles, maintenance logging
bbeare22 Sep 26, 2025
685e630
Added PM page
bbeare22 Sep 27, 2025
1da2d7b
Add month-based CSV exports, fix dashboard KPIs with start/end filter…
bbeare22 Sep 30, 2025
6e1c2fb
Added Decon page
bbeare22 Sep 30, 2025
cd142c9
Updated decon Page
bbeare22 Sep 30, 2025
616a4f0
Added control BI testing
bbeare22 Oct 2, 2025
8acf059
Updated maintenance, added washer daily rack test/ washer weekly main…
bbeare22 Oct 2, 2025
3d68de7
Added transport page for logging transport trips and fuel use
bbeare22 Oct 3, 2025
1fbec28
Updated transport page to show monthly trip stats
bbeare22 Oct 3, 2025
609868e
Added audit section
bbeare22 Oct 7, 2025
0014984
Added server side audit function
bbeare22 Oct 9, 2025
006d57e
Add PDF exports and daily compliance reminders job
bbeare22 Oct 9, 2025
9566036
Clean reset
bbeare22 Oct 9, 2025
e6c1199
Add tablet friendly pass
bbeare22 Oct 10, 2025
718453a
Small fixes and polishing
bbeare22 Oct 14, 2025
0251c39
Small index.js fix
bbeare22 Oct 14, 2025
c7a3fb8
Add branded logo, favicon, and manifest for SPT + report enhancements
bbeare22 Oct 16, 2025
b332870
Fix: correct maintenance initials mapping in reports (PDF & CSV)
bbeare22 Oct 16, 2025
71b271b
Stop tracking env files; keep only sanitized .env.example
bbeare22 Oct 16, 2025
b400d28
Stop tracking env files; keep only sanitized .env.example
bbeare22 Oct 16, 2025
29e8705
add sanitized server .env.example
bbeare22 Oct 16, 2025
7a5b506
wrap routes with ErrorBoundary
bbeare22 Oct 16, 2025
499de22
small push
bbeare22 Oct 16, 2025
3eb7c51
client: remove unused boilerplate and dead files
bbeare22 Oct 16, 2025
ca4d57d
chore: add lightweight logger; quiet common console noise
bbeare22 Oct 16, 2025
9a5532e
chore: add root scripts and Prettier config; enable format-on-save
bbeare22 Oct 16, 2025
d7e53a7
chore: add ESLint (flat), lint scripts, and optional pre-commit hooks
bbeare22 Oct 16, 2025
d70b974
Update README.md
bbeare22 Oct 17, 2025
e77acc4
Update for demo mode
bbeare22 Oct 27, 2025
9ae0242
Add MIT License
bbeare22 Nov 2, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
node_modules
dist
build
coverage
apps/**/dist
apps/**/build
42 changes: 42 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# --- Node ---
node_modules/
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*

# --- Build outputs ---
dist/
build/
.out/
.next/
.vercel/

# --- Env files (don’t commit secrets) ---
*.env
**/.env
/apps/**/.env
/apps/**/.env.local
/apps/**/.env.*.local

# --- Logs ---
*.log
logs/
*.pid
*.seed
*.pid.lock

# --- Editor/OS ---
.DS_Store
Thumbs.db
.idea/
.vscode/*
!.vscode/settings.json

# --- Coverage/testing ---
coverage/
*.lcov

# --- Misc ---
*.cache
*.tmp
8 changes: 8 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
node_modules
dist
build
coverage
*.log
apps/**/dist
apps/**/build
apps/**/.vite
7 changes: 7 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"printWidth": 100,
"singleQuote": true,
"trailingComma": "es5",
"semi": true,
"arrowParens": "always"
}
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"files.insertFinalNewline": true,
"files.trimTrailingWhitespace": true
}
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2025 Brett Beare

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
285 changes: 284 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,284 @@
# Sterile Processing Tracker
# 🧼 Sterile Processing Tracker (SPT)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • You need to deploy the app, and show the link in Readme

> **Reviewer Note:**
> This project is fully deployed and ready for live testing.

**Frontend (React/Vite):**
🔗 https://spt-front.onrender.com

**Backend (Express/MongoDB API):**
🔗 https://spt-api-w5vi.onrender.com

When logged out, only the **Dashboard** is visible.
To access **Machines**, **Maintenance**, **Cycles**, and **Detail** views, please register or log in.

---

## 🧭 Overview

A modern full-stack web app for tracking sterile processing equipment, maintenance, and sterilizer cycles (loads).
Built with **React (Vite)**, **Express**, **MongoDB**, and **JWT authentication**.

---

## 🌐 Live Demo

| Service | URL |
| -------------------------------- | ---------------------------------------------------------------------- |
| 🖥️ Frontend (React/Vite) | [https://spt-front.onrender.com](https://spt-front.onrender.com) |
| ⚙️ Backend (Express/MongoDB API) | [https://spt-api-w5vi.onrender.com](https://spt-api-w5vi.onrender.com) |

---

## 🚀 Features

### Machines

- Add / edit / delete washers, sterilizers, ultrasonics (auth required)
- Machine detail: recent maintenance & cycles (auth required)

### Maintenance

- Washer / Ultrasonic descale with daily & time-based tracking (auth required)
- Sterilizers: **Daily Inspection** and **Quarterly Cleaning** (auth required)
- Maintenance history view & export

### Sterilizer Cycles

- Log sterilizer loads, test types, and results (auth required)
- Track cycles by date, load type, and operator

### Dashboard

- KPIs for today’s sterilizer cycles & recent maintenance
- Real-time load tracking overview (public)

### Authentication

- Register / Login / Logout with JWT
- Protected routes for all critical data
- Session persistence via `localStorage` token

### UI/UX

- Toast notifications
- Reusable card layouts
- Loading skeletons
- Consistent CSS-based dashboard layout

---

## 🧱 Monorepo Layout

```
apps/
├─ server/ → Express API + MongoDB
└─ client/ → React client (Vite)
```

---

## 🧩 Run Locally

### 1. Install Dependencies (from root)

```bash
npm install
```

### 2. Copy `.env.example` → `.env` and update values

Example for local development:

```bash
# apps/server/.env
PORT=3001
CLIENT_URL=http://localhost:5173
MONGO_URL=mongodb://localhost:27017/spt
JWT_SECRET=your-secret-key
JWT_EXPIRES_IN=7d
```

```bash
# apps/client/.env
VITE_API_URL=http://localhost:3001
```

### 3. (Optional) Seed Demo Data

```bash
node apps/server/scripts/seed.js
```

### 4. Start Both Servers (two terminals)

```bash
# Terminal 1: Express API
npm run dev:server # Runs on http://localhost:3001

# Terminal 2: React client
npm run dev:web # Runs on http://localhost:5173
```

---

## 🏗️ Build for Production

```bash
# Build web client
npm run build:web

# Start Express API (after build)
npm run start:server
```

---

## 🧰 Useful Scripts

| Command | Description |
| -------------- | ------------------------------- |
| `dev:server` | Run Express API with nodemon |
| `dev:web` | Start Vite dev server |
| `build:web` | Build production-ready client |
| `start:server` | Run API in production mode |
| `seed` | Populate MongoDB with demo data |

---

## 🔑 API Overview

### **Auth**

| Method | Endpoint | Description |
| ------ | -------------------- | -------------------------------------------------------------------------- |
| `POST` | `/api/auth/register` | Create new user _(email, password, name, employeeId, sterilizationNumber)_ |
| `POST` | `/api/auth/login` | Authenticate existing user |
| `GET` | `/api/auth/me` | Fetch logged-in user profile (JWT required) |

### **Machines**

| Method | Endpoint | Description |
| -------- | ------------------- | ------------------------- |
| `GET` | `/api/machines` | Get all machines |
| `GET` | `/api/machines/:id` | Get machine by ID |
| `POST` | `/api/machines` | Create new machine (auth) |
| `PUT` | `/api/machines/:id` | Update machine (auth) |
| `DELETE` | `/api/machines/:id` | Delete machine (auth) |

### **Maintenance**

| Method | Endpoint | Description |
| ------ | ----------------------------------- | ------------------------- |
| `GET` | `/api/maintenance?machineId=&date=` | Fetch maintenance records |
| `POST` | `/api/maintenance` | Log maintenance activity |
| `GET` | `/api/maintenance/history` | Fetch maintenance history |

### **Cycles**

| Method | Endpoint | Description |
| -------- | ----------------- | -------------------- |
| `GET` | `/api/cycles` | List cycles |
| `POST` | `/api/cycles` | Log sterilizer cycle |
| `GET` | `/api/cycles/:id` | Get cycle detail |
| `DELETE` | `/api/cycles/:id` | Delete a cycle |

> **Auth required:** All write operations.
> **Header:** `Authorization: Bearer <token>`

---

## 🧿 Security & Validation

- Server-side validation with **Zod + Mongoose schemas**
- Endpoints protected by **JWT**
- CORS restricted to `CLIENT_URL`
- **Helmet** middleware enabled for HTTP security headers
- Sensitive config via `.env` (never committed)

---

## 🗃️ Database Indexes

| Collection | Index |
| --------------- | ----------------------------------- |
| **Maintenance** | `{ machineId: 1, performedAt: -1 }` |
| **Cycles** | `{ machineId: 1, startedAt: -1 }` |

Indexes ensure efficient lookups by machine and date.

---

## 🧠 Usage Guide

1. **Login with demo user** _(or register a new account)_

- Use seeded demo data or create your own.
- When logged out, only the Dashboard is visible.

2. **Access Restricted Views**

- Machines, Maintenance, Cycles, and Detail pages require login.

3. **Dashboard KPIs**

- Today’s sterilizer cycles and recent maintenance appear in real-time.

4. **Machine Detail View**

- Log or view maintenance and sterilizer cycles by machine.

5. **Cycle & Maintenance History**

- Export reports via CSV from "View All…" pages.

6. **Reports & Recall Tracking**
- Track historical loads and maintenance schedules with filters.

---

### ❤️ Made with care

Created to streamline and modernize sterile processing operations — from washer to sterilizer — with data-driven visibility.

---

### Dashboard

![Dashboard](screenshots/dashboard.jpg)

### Machines

![Machines](screenshots/machines.jpg)

### Machine Detail — Washer

![Machine Detail — Washer](screenshots/machine-detail-washer.jpg)

### Machine Detail — Sterilizer

![Machine Detail — Sterilizer](screenshots/machine-detail-sterilizer.jpg)

### Log Maintenance Form

![Log Maintenance](screenshots/log-maintenance.jpg)

### Log Cycle Form

![Log Cycle](screenshots/log-cycle.jpg)

### Maintenance History (with CSV export)

![Maintenance History](screenshots/maintenance-history.jpg)

### Cycles History (with CSV export)

![Cycles History](screenshots/cycles-history.jpg)

### Login

![Login](screenshots/login.jpg)

### Register

![Register](screenshots/register.jpg)
1 change: 1 addition & 0 deletions apps/client/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VITE_API_URL=http://localhost:3001
Loading