How vaibhavkamtekar/library-management-system works
Purpose and Deployment Shape
NMITD Library System is an on-premises visitor/attendance management application for students, staff, guests, and administrators. It ships as a React frontend plus Node.js backend, with Windows launchers, installer automation, MySQL setup/migration scripts, PM2 process management, and backup/restore operations.
Key operational artifacts: Backend/server.js, pm2.config.js, installer/NMITD-Library-Setup.iss, LibrarySystem.vbs.
Application Entry Points
The browser client starts at frontend/src/index.js and composes routing/UI in frontend/src/App.js. It is served separately or alongside the API depending on deployment setup.
The API service starts in Backend/server.js, initializes database connectivity through Backend/db.js, mounts domain route modules, and runs scheduled auto-exit behavior from Backend/jobs/autoExitJob.js.
Frontend Portal and Session UX
frontend/src/App.js is the top-level client coordinator. Shared portal framing and operational navigation are represented by frontend/src/components/PortalShell.js and frontend/src/components/OperationalLayout.js.
The application exposes distinct role/workflow screens:
• Public and walk-in flow: frontend/src/components/Home.js, frontend/src/components/GuestEntry.js
• Student/staff entry flow: frontend/src/components/StudentEntry.js, frontend/src/components/StaffEntry.js
• Active visit in/out operation: frontend/src/components/InOut.js
• Admin authentication and administration: frontend/src/components/AdminLogin.js, frontend/src/components/AdminDashboard.js
Client-to-server calls are centralized in frontend/src/api.js, forming the primary frontend/backend boundary.
Backend API Domains
The Express route layer separates business capabilities by actor and operation:
• Student operations: Backend/routes/studentRoutes.js
• Staff operations: Backend/routes/staffRoutes.js
• Guest and visit lifecycle operations: Backend/routes/guestRoutes.js, Backend/routes/visitRoutes.js
• Administrative controls and student maintenance: Backend/routes/adminRoutes.js, Backend/routes/adminStudentRoutes.js
Backend/server.js is the composition boundary for these HTTP domains; route handlers are expected to own request validation, authorization, and persistence-oriented workflow execution.
Visit Lifecycle and Automation
The central control flow is entry registration → active visit tracking → explicit exit or scheduled closure. Entry-facing React components submit requests through frontend/src/api.js; backend visit-oriented routes persist and retrieve state using Backend/db.js.
Backend/jobs/autoExitJob.js provides a server-side corrective path for visits that remain open, decoupled from a user actively operating the browser. This makes the backend—not the UI—the authority for final visit state.
Persistence and Database Operations
Backend/db.js is the application database access boundary. Database schema evolution is operationalized under database/migrations, with installation and upgrade orchestration in installer/scripts/init-database.ps1 and installer/scripts/migrate-database.ps1.
The repository strongly indicates MySQL as the production datastore via installer/scripts/detect-mysql.ps1. Backup, restore, and pre-update protection are external operational flows: scripts/backup.bat, scripts/restore.bat, and installer/scripts/pre-update-backup.bat.
Packaging, Runtime, and Infrastructure
The runtime stack is Node.js/Express for the API (Backend/package.json) and React for the client (frontend/package.json). PM2 manages the deployed server process through pm2.config.js.
Windows is the primary deployment target: the Inno Setup definition installer/NMITD-Library-Setup.iss packages the system; service lifecycle scripts include installer/scripts/install-service.bat and installer/scripts/uninstall-service.bat. Local-user launch behavior is supported by LaunchBrowser.vbs and LibrarySystem.vbs.
Main entry points: server.js Express server · db.js Database access · OperationalLayout.js Operational layout · api.js API client
Components 19
React Client
- Client entry
frontend/src/index.js - App routing
frontend/src/App.js - Portal shell
frontend/src/components/PortalShell.js - Operational layout
frontend/src/components/OperationalLayout.js - Entry screens · Home, guest, student, and staff entry screens.
frontend/src/components/GuestEntry.js - In/out screen
frontend/src/components/InOut.js - Admin screens · Login and dashboard administration.
frontend/src/components/AdminDashboard.js - API client
frontend/src/api.js
Node.js API
- Express server
Backend/server.js - Actor routes · Student, staff, guest, and admin operations.
Backend/routes/studentRoutes.js - Visit routes
Backend/routes/visitRoutes.js - Auto-exit job · Closes visits left active without browser action.
Backend/jobs/autoExitJob.js
Data Operations
- Database access
Backend/db.js - Schema migrations
database/migrations - Database setup · Initialization and migration orchestration.
installer/scripts/init-database.ps1 - Backup and restore
scripts/backup.bat
Windows Deployment
- PM2 process manager
pm2.config.js - Inno Setup installer
installer/NMITD-Library-Setup.iss - Windows launchers
LibrarySystem.vbs
Connections 23
- Client entry → App routing
- App routing → Portal shell
- Portal shell → Operational layout
- Operational layout → Entry screens
- Operational layout → In/out screen
- Operational layout → Admin screens
- Entry screens → API client: register entry
- In/out screen → API client: view / exit visit
- Admin screens → API client: admin requests
- API client → Express server: HTTP
- Express server → Actor routes: mounts
- Express server → Visit routes: mounts
- Express server → Auto-exit job: schedules
- Actor routes → Database access: persist workflows
- Visit routes → Database access: active visit state
- Auto-exit job → Database access: close open visits
- Database setup → Schema migrations: applies
- Schema migrations → Database access: evolves schema
- Backup and restore → Database access: protects data
- PM2 process manager → Express server: manages
- Inno Setup installer → PM2 process manager: deploys runtime
- Inno Setup installer → Database setup: provisions database
- Windows launchers → Express server: opens local system