Back to Projects

Government Service Portal

Backend Lead & System Architect • Ongoing

In Active Development

Government Service Portal Banner

Overview

A centralized digital platform designed to eliminate long queues, paperwork, and fragmented government services.

Citizens can apply for, track, and complete government services online, while agencies gain real-time visibility and auditable workflows.

About the Project

This platform modernizes how citizens interact with government services by replacing manual, paper-based processes with a structured digital workflow. Applications move predictably across agencies, approvals are traceable, and service delivery becomes measurable rather than opaque.

A major focus of the project has been architectural evolution rather than surface-level rewrites. I led the transition from a traditional React SPA into a Next.js Backend-for-Frontend (BFF) architecture to improve performance, security, and long-term maintainability.

The data layer was migrated from MySQL to PostgreSQL to better support dynamic, form-driven services using JSONB, while introducing Prisma ORM for type-safe data access without sacrificing query performance.

Architecture & Engineering

  • Backend-for-Frontend (BFF) architecture using Next.js as a secure orchestration layer over the core Express service.
  • Clear separation between public citizen workflows and internal administrative operations using route groups and middleware.
  • Unit of Work pattern to guarantee ACID compliance for complex, multi-step service applications.
  • Repository-based data access layer to isolate business logic from database implementation details.

Key Challenges

Dynamic, Multi-Agency Form Management

Problem Each government agency requires different application structures, making hardcoded schemas impractical. A traditional EAV model in MySQL was difficult to query and maintain.

Solution Migrated to PostgreSQL and designed a JSONB-backed form system where agencies define structured form metadata. Indexed fields preserve query performance while allowing flexible, agency-specific workflows.

Zero-Downtime Data Layer Migration

Problem Replacing the database engine and ORM on an active system carried high risk. A full rewrite would have stalled development and introduced regressions.

Solution Used dependency injection and repository abstractions to introduce Prisma-based repositories alongside legacy implementations. This enabled a gradual, low-risk migration without modifying core business services.

Public vs. Administrative Security Boundaries

Problem The initial SPA architecture mixed public and administrative logic in the same client bundle, increasing the risk of accidental exposure.

Solution Re-architected the frontend using Next.js App Router with explicit `(public)` and `(admin)` route groups. Administrative layouts, middleware, and data loaders are fully isolated and never shipped to unauthorized clients.

Retrospective

  • 01.Architecture Enables Change

    Early investment in repository abstractions and dependency injection transformed a risky database migration into a controlled, incremental upgrade rather than a rewrite.

  • 02.Why BFF Matters for Government Systems

    The BFF approach allowed authentication and authorization to remain fully server-controlled. Sensitive sessions stay HttpOnly and secure, while the UI benefits from faster, server-rendered data access.

Technologies Used

frontend

Next.js (App Router)TypeScriptTailwind CSSTanStack Query

backend

Node.jsExpress.jsTSyringe (IoC)

database

PostgreSQLPrisma ORM