Backend service for OpsTrack, a tactical operations tracking platform built to showcase secure REST API design, PostgreSQL data modeling, and production-ready Node.js practices.
The OpsTrack API is a role-aware task and operator management service built with Express.js and PostgreSQL. It provides authentication, authorization, task lifecycle management, audit visibility, and administrative user controls behind a hardened HTTP surface.
This backend is the primary engineering focus of the project and is designed to emphasize:
- SQL-first relational modeling
- secure authentication and RBAC
- environment validation and deployment discipline
- service hardening for real hosting environments
- API Base:
https://opstrack.onrender.com
Pre-seeded verified credentials for role validation:
- Email:
k.mills@opstrack.mil - Password:
password123 - Role:
ADMIN
- Email:
j.miller@opstrack.mil - Password:
password123 - Role:
MEMBER
The backend uses a normalized PostgreSQL schema with explicit one-to-many relationships and database-side automation.
Highlights:
- raw SQL querying through repository/service separation
- relational joins across operators, tasks, notes, and audit trails
- trigger-driven timestamp maintenance for task updates
- indexing for common task and audit access paths
Security is treated as a first-class design constraint.
Highlights:
- JWT-based authentication for protected routes
- Role-Based Access Control (RBAC) separating
ADMINandMEMBER - clearance-aware access behavior across privileged operations
- bcrypt-backed password verification in the application flow
- strict request validation using Zod schemas
The HTTP surface is hardened for internet-facing deployment.
Highlights:
helmetfor defensive response headers- global rate limiting for API traffic
- more aggressive authentication throttling on the login choke point
- strict CORS origin control for the frontend deployment
- structured request identification for traceability
The service is designed to behave cleanly in hosted environments.
Highlights:
- startup environment validation before boot
- PostgreSQL connection pooling
/healthzand/readyzhealth endpoints- graceful shutdown handling for
SIGTERMandSIGINT - structured logging for operational visibility
- Runtime: Node.js
- Framework: Express
- Database: PostgreSQL / Neon Serverless
- Validation: Zod
- Authentication: JWT + bcrypt
- Deployment: Render
users- operator identity, rank, role, clearance, account statetasks- operational task records and assignment metadatatask_notes- one-to-many notes attached to tasksaudit_logs- immutable action history for critical activity tracking
users (1) ───< tasks.assigned_to
users (1) ───< task_notes.operator_id
users (1) ───< audit_logs.operator_id
tasks (1) ───< task_notes.task_id
tasks (1) ───< audit_logs.task_id
POST /api/auth/login- authenticate operator and return JWT
GET /api/tasksPOST /api/tasksPATCH /api/tasks/:idDELETE /api/tasks/:idGET /api/tasks/audit-logs
GET /api/usersPOST /api/usersPATCH /api/users/:idDELETE /api/users/:id
GET /healthzGET /readyz
npm installcp .env.example .envMinimum configuration:
PORT=5000
JWT_SECRET=replace_with_long_random_secret
CORS_ORIGIN=http://localhost:5173
DATABASE_URL=postgresql://user:password@host/database?sslmode=require
DB_SSL=trueRun init.sql once against your database to create tables, indexes, triggers, and seed data.
npm run devnpm start- run production servernpm run dev- run with nodemonnpm test- integration test suitenpm run smoke- local smoke validationnpm run smoke:remote -- <base-url>- deployed smoke validationnpm run demo:check- test + smoke bundle
- Runtime: Node
- Build Command:
npm install - Start Command:
npm start - Node Version:
>=18
NODE_ENV=productionPORT=5000DATABASE_URL=<neon-connection-string>DB_SSL=trueJWT_SECRET=<long-random-secret>CORS_ORIGIN=<frontend-url>
npm run smoke:remote -- https://<api-domain>Expected health results:
{"status":"ok"}
{"status":"ready"}This project includes:
- route-level integration coverage
- authentication and authorization checks
- not-found and validation-path testing
- smoke validation against live deployments
Run locally:
npm test
npm run smoke- Do not commit
.envor live secrets. - Rotate JWT and database credentials after public demos.
- Keep
CORS_ORIGINmatched exactly to the deployed frontend URL.