How one-project-one-month/node-utility-management-system works
Project type and purpose
• This is a backend-centric full-stack service (no dedicated frontend in this repo) for a utility management system.
• Purpose: expose a RESTful HTTP API (Express.js + TypeScript) to manage properties, tenants, billing, customer service, invoices and receipts.
File structure
• Top-level:
• src/index.ts: entry point – boots Express server, loads middleware, routes, Swagger docs.
• prisma/: schema.prisma, migrations, seed.ts – defines & evolves PostgreSQL schema via Prisma ORM.
• docker-compose.yml: spins up a PostgreSQL container.
• Layered directories under src/ following a classic MVC/Service-layered monolith:
• routes/ → defines Express routes and versioned base path (/api/v1/…)
• controllers/ → HTTP handlers (one per resource)
• services/ → business logic, orchestrates data operations & domain rules
• lib/prismaClient.ts → single Prisma client instance for all DB access
• common/ → shared utilities (logging, CORS, JWT auth, password hashing, rate-limiting)
• middlewares/ → auth, validation (Zod), error handling
• validations/ → Zod schemas per endpoint
• docs/ → OpenAPI/Swagger config, component schemas and example responses
• helpers/ → one-off utility functions
• Key config/build files: tsconfig.json, package.json, Makefile, docker-compose.yml, .env example
Insights from README
• Core tech: Node.js (v22+), Express, TypeScript, PostgreSQL + Prisma ORM, Zod for validation, JWT + bcrypt for auth.
• Deployment: containerized DB and app on Render; Swagger UI available under /docs.
• Multi-role (Admin/Staff/Tenant) RBAC.
• CRUD endpoints for Users, Rooms, Tenants, Contracts, Bills, Invoices, Customer Services, Receipts, Total Units, Analytics.