How muhammadmahi585/nust-e-bill-system works
Project Type & Purpose
• This is a full-stack web application called “NUST E-Bill System” for managing electricity billing for residential and commercial users.
• Frontend: Static HTML/CSS/JS pages for landing, login, user dashboard, admin dashboard, billing pages, customer management pages, meter & tariff configuration.
• Backend: Node.js with Express.js serving routes, business-logic modules, and static assets.
• Database: MySQL storing users, bills, tariffs, meter readings.
File Structure Analysis
• Top-level web pages & assets (HTML, CSS, JS) alongside server.js and business modules (tarrif.js, billLog.js, prevPage.js, customerPage.js, loginPage.js).
• node_modules, package.json → Node.js/Express server.
• images/ contains screenshots for documentation.
• Duplicate NUST_EBill-master/ folder appears to mirror the same pages; treat it as an archive or legacy copy.
• No formal MVC folders, but each JS file under root acts as a controller/business logic for its corresponding page.
Key README Insights
• Role-based authentication (users vs. admins).
• Dynamic tariff calculations based on consumption.
• SQL integration for persisting user, billing, and tariff data.
• No external third-party services (e.g., payment gateways) are shown in code; payments may be managed in SQL or stubbed.
a. Main Components:
• Web Browser (Client)
• Frontend Static Layer
• Landing, Login, Customer, Bill Log, Admin Menu, Add/Update/Delete Customer, Meter, Tariff pages
• Backend Application Server (Express.js)
• Route handlers: server.js
• Business modules: loginPage.js, customerPage.js, billLog.js, tarrif.js, etc.
• MySQL Database
b. Relationships & Data Flow:
• Browser ←→ Static HTML/CSS/JS (client-side routing or form submits)
• Browser JS issues HTTP requests (GET/POST) to Express API endpoints
• Express routes invoke business modules → perform SQL queries → respond to client
c. Architectural Patterns:
• Layered architecture: Presentation (HTML/CSS/JS) → Application (Express routes + JS modules) → Data (MySQL)
• Role-based access control enforced in route middleware (implied by login module)
d. Key Technologies:
• Express.js for HTTP server & routing
• Node.js modules for each functional area
• MySQL for relational persistence
• Vanilla JavaScript for frontend interactivity