How legbabe/access-key-management- works
Project type and purpose
• This is a full-stack Node.js web application (“Access Key Manager”) built to allow school IT personnel and Micro-Focus admins to manage license/access keys via a web UI and an HTTP endpoint.
• It follows an MVC–style structure: Express.js backend (controllers, routes, middleware, models), EJS templates for server-side rendering, and a public folder for static assets (CSS, JS, images).
• It exposes both browser-driven UI flows (signup, login, key management, password reset) and a machine-to-machine endpoint (/getActiveKey/:email) for external integration.
File structure
• Top level
– app.js (Express application entry point)
– package.json / package-lock.json
– vercel.json (deployment config)
• backend/
– controllers/ (auth_controller.js, key_controller.js)
– routes/ (auth_routes.js, key_routes.js)
– middleware/ (authMiddleware.js)
– models/ (user_model.js, token_model.js)
• public/ (static CSS, JS, images)
• views/ (EJS templates by role and function: signup, login, admin_home, key views, password reset)
• tests/ (Jest or Mocha tests for authentication flows)
README for additional insights
• Customer requirements for two personas: School IT Personnel and Micro-Focus Admin.
• Key features: signup/login, single-active-key constraint, view/revoke keys, reset password, machine endpoint.
Main components & their relationships
a. Client web browser
• Requests static HTML/CSS/JS (public/) and server-rendered pages (views/).
b. Web Server (app.js + Express)
• Routes incoming HTTP requests via auth_routes and key_routes.
• Runs middleware (authMiddleware) to protect routes.
• Invokes controller logic (signup/login/reset in auth_controller; generate/list/revoke in key_controller).
c. Data layer
• Models (user_model, token_model) abstract persistence with the database (e.g., Postgres, MySQL, Mongo).
d. External dependencies
• Email service (for account verification and password reset).
• Third-party integration via /getActiveKey/:email endpoint used by the school platform.
Architectural patterns & design principles
• MVC / Layered Architecture:
Presentation (views, public) → Application/Business Logic (controllers, services) → Data (models, database).
• Single Responsibility: each controller or middleware handles one concern.
• RESTful endpoints for key operations.
• Separation of concerns: static assets vs. dynamic views vs. API endpoints.
• Security: middleware for authentication, token-based sessions or JWT (implied by token_model).