CPSS is a production-ready, enterprise-style 8-in-1 Chemical Engineering SaaS simulation platform with:
- Backend: Node.js + Express + MySQL (
mysql2/promise) - Auth: JWT + bcrypt
- Frontend: React (Vite) + Tailwind + lucide-react
- Design: Scientific glassmorphism dark interface
- Modules: Plume, Heat Exchanger, Pipe Flow, CSTR, Flash, Ergun, Fenske, PID
- Resilience: Automatic local math fallback when backend is unreachable
cpss1-project/
├── backend/
│ ├── middleware/
│ │ └── auth.js
│ ├── package.json
│ └── server.js
├── frontend/
│ ├── src/
│ │ └── App.jsx
│ └── package.json
└── README.md
- Node.js 18+
- MySQL 8+
Create the DB once in MySQL (name can be changed through env):
CREATE DATABASE cpss1;backend/server.js auto-creates:
userstablesimulationstable with JSON columns
cd backend
npm installCreate .env in backend/:
PORT=5000
DB_HOST=localhost
DB_USER=root
DB_PASSWORD=your_mysql_password
DB_NAME=cpss1
JWT_SECRET=replace_with_long_random_secretRun backend:
npm run devcd frontend
npm install
npm run devVite default URL is usually http://localhost:5173.
The frontend expects backend at:
http://localhost:5000
If needed, update API_BASE in frontend/src/App.jsx.
POST /api/auth/registerPOST /api/auth/login
POST /api/plumePOST /api/heatexchangerPOST /api/pipeflowPOST /api/cstrPOST /api/flashPOST /api/ergunPOST /api/fenskePOST /api/pid
GET /api/history(returns last 20 simulations for logged-in user)
Every frontend fetch call is wrapped with try/catch.
If backend calls fail:
- Calculations run locally in JavaScript using the same formulas.
- Results are still shown to the user.
- Badge appears: Local Fallback Mode: Backend Unreachable. Results not saved.
- Move secrets to secure secret manager or deployment env vars.
- Put backend behind HTTPS reverse proxy (Nginx/Cloud LB).
- Restrict CORS origins in
backend/server.js. - Add rate limiting and request validation for public deployments.
- Add CI/CD checks and integration tests before release.