Documentation
Required Software & Downloads
Node.js (version 16+ recommended)
Download and install.
Required to run the backend (Node + Express) and install dependencies.
npm (bundled with Node) or yarn
Used to install libraries like express, cors, pg (for the backend) and React (for the frontend).
Git (optional, but recommended)
Helpful for cloning/pushing the project to GitHub.
SSH Tunnel Script (if off‐campus)
E.g., tunnel_scripta.bat on Windows, forwarding localhost:9999 to the remote DB server’s 5432.
(Optional) DBeaver
For managing/inspecting the database visually, if desired.
Environment Variables
Create a .env file in the backend/ folder (ensure it is in .gitignore). Required variables:
DB_HOST=localhost DB_PORT=9999 DB_NAME=db_202425z_va_prj_blisscoredb DB_USER=***REDACTED*** DB_PASS=***REDACTED*** JWT_SECRET=***REDACTED*** CORS_ORIGIN=http://localhost:3000 RATE_LIMIT_WINDOW_MS=900000 RATE_LIMIT_MAX=50 PORT=5000 JWT_EXPIRES=3600
Steps to Install & Run
1) Backend (Node)
Open a terminal in the backend/ folder. Install dependencies:
npm install npm install helmet express-rate-limit bcrypt jsonwebtoken dotenv
(Optional: npm i -D nodemon for auto-restart in development.)
Apply database enhancements (views, triggers, functions, indexes):
node scripts/applyEnhancements.js
Seed demo data:
node scripts/seedDemoData.js
Launch the backend server:
node index.js
The backend runs at http://localhost:5000 .
2) Frontend (React)
Open a terminal in the frontend/ folder. Install dependencies:
npm install
Start the dev server:
npm start
The frontend runs at http://localhost:3000 .
Useful Scripts
node scripts/applyEnhancements.js – applies views, triggers, functions, indexes from blisscore_enhancements.sql.
node scripts/seedDemoData.js – seeds the database with demo users/classes.
node scripts/runReports.js – generates JSON reports for top spenders, class utilization, training popularity.
node scripts/explainQueries.js – runs EXPLAIN/ANALYZE for query plans and indexes.
node scripts/runProof.js – tests transactions, triggers, and book_class() functionality.
Access the Application
Open browser at http://localhost:3000 to see the React app.
React communicates with the Node backend via endpoints like /api/register-student or /api/book-class.
The Node backend connects to the PostgreSQL database (locally or via SSH tunnel).