A simple maintenance management system with:
- Authentication (signup/login)
- Equipment inventory (with technician assignment)
- Teams (company + technicians)
- New maintenance request creation
- Calendar view for scheduled work
- Dashboard with live-ish stats (Socket.IO)
This repo has two apps:
server/— Node.js + Express + PostgreSQL APIclient/— React + Vite + Tailwind UI
- Node.js 18+ (recommended)
- PostgreSQL 13+ (local)
- pgAdmin (optional, for DB UI)
In pgAdmin (or psql), create the database:
CREATE DATABASE maintenance_db;Create/verify server/.env:
DB_USER=postgres
DB_HOST=localhost
DB_DATABASE=maintenance_db
DB_PASSWORD=12345678
DB_PORT=5432
PORT=5000
CLIENT_ORIGIN=http://localhost:5173
JWT_SECRET=change_me_in_productionServer:
cd server
npm installClient:
cd ../client
npm installIf Windows PowerShell blocks
npmscripts, run PowerShell as your user and do:Set-ExecutionPolicy -Scope CurrentUser RemoteSignedThen reopen the terminal.
Start the server:
cd server
npm run devStart the client:
cd client
npm run devOpen:
Your DB name is maintenance_db.
In pgAdmin, find the tables here:
Servers → PostgreSQL → Databases → maintenance_db → Schemas → public → Tables
Important tables:
users— all users (employees, technicians, portal users)equipment— equipment inventorymaintenance_requests— requests/ticketsteams— teams (name + company)team_members— join table mapping teams → technicians
The server auto-runs server/schema.sql on startup to create/upgrade tables.
The Technician dropdowns are loaded from users with role = 'technician'.
Recommended method:
- Use the Signup page to create a user.
- In pgAdmin Query Tool (database
maintenance_db) run:
UPDATE users
SET role = 'technician'
WHERE email = 'tech1@example.com';Go to Teams (sidebar):
- Create a team with Team Name, Company, and one initial technician member.
- Add more technicians using Add Member.
Go to Equipment (sidebar):
- Click NEW
- Fill Name + Serial Number
- Select Technician (required)
- Save
Go to New Request (sidebar):
- Select Maintenance For:
- Equipment → choose an equipment
- Work Center → choose a work center
- Select Team Name (from Teams)
- Technician dropdown will show:
- all technicians if no team selected
- only technicians from the selected team
- Fill Notes/Instructions and optional Scheduled Start
- Click SAVE
Go to Calendar:
- Shows requests by scheduled start (or created date)
Go to Dashboard:
- Shows critical equipment count, technician load, open requests
- Shows recent activities
Auth:
POST /api/auth/signupPOST /api/auth/login
Users:
GET /api/users?role=technician(used by technician dropdowns)
Teams:
GET /api/teamsPOST /api/teamsPOST /api/teams/:id/members
Equipment:
GET /api/equipmentPOST /api/equipment(requirestechnician_id)
Requests:
GET /api/requestsPOST /api/requests
- Tables not visible in pgAdmin: refresh the database tree, and ensure you are inside
maintenance_db. userstable missing: start the server once; it runsschema.sqlon boot.- CORS issues: ensure
CLIENT_ORIGINinserver/.envmatches your Vite URL.