← Technical notes
Technical note2 diagrams

Frontend Architecture Refactoring & Component Standardization

Lead Frontend Engineer — reducing duplication across admin and agent experiences by moving toward a single source of truth for forms, lists, and shared UI.

TL;DR

Component-driven refactor: unified forms, shared library, RBAC across admin and agent portals — less duplication and faster maintenance.

live trace · After: component-drivenfrom the original diagram
Yes No Admin Agent REFACTORED: COMPONENT-DRIVEN AND DRY◆ Route /module/:id? SHARED COMPONENT LIBRARYShared activity log SHARED COMPONENT LIBRARYUnified list view DYNAMIC FORM◆ Has id param? DYNAMIC FORMEdit mode fetch and bind DYNAMIC FORMCreate mode empty form RBAC◆ Check user role RBACAdmin actions RBACAgent actions
  1. 01
    Refactored: component-driven and DRY◆ Route /module/:id?→ Has id param?→ Unified list view
  2. 02
    Shared component libraryShared activity log
  3. 03
    Shared component libraryUnified list view→ Check user role→ Shared activity log
  4. 04
    Dynamic form◆ Has id param?→ Edit mode fetch and bind [Yes]→ Create mode empty form [No]
  5. 05
    Dynamic formEdit mode fetch and bind→ Shared activity log
  6. 06
    Dynamic formCreate mode empty form→ Shared activity log
  7. 07
    RBAC◆ Check user role→ Admin actions [Admin]→ Agent actions [Agent]
  8. 08
    RBACAdmin actions
  9. 09
    RBACAgent actions
Challenge

DRY violations and heavy maintenance

The legacy UI had deep structural duplication: separate add vs edit components, parallel pages across admin and agent portals, and utility widgets copied into multiple trees. Even a simple label or validation tweak required touching many isolated files, which slowed delivery and increased regression risk.

Solution

Component-driven, unified surfaces

Led a refactor toward component-driven development : merged add/edit into one dynamic form keyed by route params (e.g. /:id ), collapsed duplicated portal pages into shared views with RBAC , and hoisted repeated pieces (such as activity logs) into a centralized shared library .

02

Impact

Materially shrank the surface area of the UI codebase and cut ongoing maintenance cost: fixes and visual tweaks increasingly land in one place , propagating consistently across both portals instead of chasing copies in siloed folders.

03

Architecture transformation

High-level view of structure before vs after. Diagrams are illustrative of the pattern, not a literal repo map.

All diagrams

Other views

ADMIN PORTALModule A list ADMIN PORTALModule A add page ADMIN PORTALModule A edit page ADMIN PORTALAdmin activity log AGENT PORTALModule A list duplicated AGENT PORTALAgent activity logduplicated
  1. 01
    Admin portalModule A list→ Module A add page→ Module A edit page
  2. 02
    Admin portalAdmin activity log
  3. 03
    Agent portalModule A list duplicated
  4. 04
    Agent portalAgent activity log duplicated
  5. 05
    Admin portalModule A add page
  6. 06
    Admin portalModule A edit page

← Technical notes on the home page