Context
The frontend is currently implemented as a vanilla JavaScript MVP with a large, monolithic app.js file.
While this approach is suitable for early development, it introduces risks regarding:
- Maintainability
- Readability
- Testability
- Future feature growth (auth, BUAK, compliance, notifications)
A full framework rewrite is not desired at this stage.
Goal
Refactor the existing vanilla JavaScript codebase into a modular structure while:
- Keeping vanilla JS
- Avoiding any framework introduction
- Preserving existing behavior and functionality
This refactor is a structural improvement only.
Scope
Modularization
Split the current monolithic frontend logic into clear responsibility-based modules, e.g.:
app.js – application bootstrap only
api.js – backend / fetch calls
auth.js – authentication & session handling
state.js – shared application state
ui.js – DOM rendering logic
events.js – event listeners and handlers
config.js – constants and configuration
rules.js – business and validation logic
(File names are indicative; exact structure may vary.)
Technical Requirements
- Use native ES modules (
type="module")
- No build step required
- No framework or library introduction
- No change in user-facing behavior
- No functional refactoring beyond separation of concerns
Architecture Requirements
- Business logic must be separated from DOM manipulation
- No direct backend calls inside UI rendering code
- Shared state must be explicit and centralized
- Future migration to a build step or framework must remain possible
Acceptance Criteria
Out of Scope
- UI redesign
- Framework migration (React, Vue, etc.)
- Build tooling introduction
- Automated testing (separate issue)
Notes
This issue prepares the frontend codebase for future growth while keeping development speed high.
It is a prerequisite for later improvements such as bundling, minification, and testing.
Context
The frontend is currently implemented as a vanilla JavaScript MVP with a large, monolithic
app.jsfile.While this approach is suitable for early development, it introduces risks regarding:
A full framework rewrite is not desired at this stage.
Goal
Refactor the existing vanilla JavaScript codebase into a modular structure while:
This refactor is a structural improvement only.
Scope
Modularization
Split the current monolithic frontend logic into clear responsibility-based modules, e.g.:
app.js– application bootstrap onlyapi.js– backend / fetch callsauth.js– authentication & session handlingstate.js– shared application stateui.js– DOM rendering logicevents.js– event listeners and handlersconfig.js– constants and configurationrules.js– business and validation logic(File names are indicative; exact structure may vary.)
Technical Requirements
type="module")Architecture Requirements
Acceptance Criteria
app.jsis reduced to bootstrap logicOut of Scope
Notes
This issue prepares the frontend codebase for future growth while keeping development speed high.
It is a prerequisite for later improvements such as bundling, minification, and testing.