Project report / GBB Report
Building a report access portal for MDAs
A closer look at how I put organization-bound report access, administration, and activity records together in one application.
One place to organize reports by MDA.
GBB Report is organized around ministries, departments, and agencies (MDAs). Each MDA has a record containing report titles, destination URLs, and active states. A user account belongs to one MDA, so the portal can present that organization’s configured report links after sign-in.
The application organizes those destinations in an authenticated dashboard. Report content stays at the configured URLs. That distinction shaped the data model and the user journey: administrators manage organizations and accounts; users choose from the links attached to their organization.
A small, explicit set of boundaries.
I split the application into a React client and an Express API. The client owns the dashboards and report selection. The API handles sign-in, role checks, validation, administration, and persistence through Mongoose models in MongoDB.
Admin and user dashboards, report selection
Authentication, role gates, controllers, services
Users, admins, MDAs, and activity records
The client uses Zustand for authentication state and TanStack Query for administrative requests. On the server, route middleware checks JWTs and roles before protected controllers run. The data model keeps the user-to-MDA relationship explicit, while each MDA contains its configured report links.
In MongoDB, a user stores an mdaId reference. The MDA document stores its report list, and each report has a title, URL, and active flag. Admin accounts and activity records have separate models. This gives the application a direct path from a signed-in user to the report entries shown in their dashboard.
Configuration leads to access.
Configure
An administrator creates an MDA with at least one report title and URL, then creates user accounts associated with that MDA. Admin routes also support updates, deletion, and account management.
Sign in
The API verifies a user’s password and checks that both the user and their MDA are active. It returns a token and the MDA’s active report entries for the dashboard.
Open a report
The client lets the user select an active report and attempts to display its URL in a sandboxed iframe. It remembers the selection for the browser session. The error state also includes a link to open the report in a new tab.
A separate administration area manages users, MDAs, and admin accounts. Admin-only endpoints provide CSV or JSON exports of user and MDA data. Superadmin routes expose activity records with filters and pagination. I also included migration scripts for the user, MDA, and admin collections.
Where the boundaries need care.
Keeping reports at external URLs makes the portal a focused access layer. It also means the embedded experience depends on each destination allowing framing. The API validates HTTP and HTTPS URLs; I would review trusted destinations before expanding the system’s use. The portal protects its own routes, while the external systems remain responsible for protecting their report content.
Successful admin mutations pass through activity logging, and the system can export those records. The current logger writes after the response as a best-effort operation and captures request details. I would review redaction and delivery guarantees before treating it as a complete audit trail.
The admin screens fetch complete user and MDA lists before filtering and paginating them in the browser. Activity records use server-side filters and pagination. If the organization data grows, I would apply that server-side approach to the management lists too.