# zesty-io/accounts-ui architecture

> Architecture diagram of the GitHub repository zesty-io/accounts-ui, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-10-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/zesty-io/accounts-ui
- Repository: https://github.com/zesty-io/accounts-ui

## Overview

##### Project type and purpose
- This is a single-page, full-stack front-end application (PWA) that provides an “account management” UI for the Zesty.io CMS.
- It uses a micro-frontend approach: a “shell” (routing, auth, global UI) plus multiple sub-apps (“account,” “blueprints,” “dashboard,” “properties,” “support,” “teams”) each built, bundled, and mounted separately.
- State is managed centrally via Redux. The design system is shared via an external package (`@zesty-io/core`).

##### File structure
- Top-level:
- `Dockerfile`, `app.yaml` → containerization & GCP deployment
- `.github/workflows` → CI/CD pipelines
- `ci/scripts` → local test setup, screenshots, secrets
- `cypress/` → end-to-end tests (fixtures, integration specs)
- `src/`:
- `src/shell/` → main shell app (routing, auth, notifications, error handling)
- `src/apps/…/` → six sub-applications, each with its own `package.json`, `webpack.config.js`, `src/index.js`, views, components and optionally a Redux sub-store
- `src/util/`, `src/vendors/` → shared utilities and third-party polyfills
- Build scripts in `bin/` orchestrate assembling and deploying bundles.

##### Extract insights from the README
- PWA focus → service worker, caching, lazy loading eventually.
- Global Redux store; design system follows atomic design.
- Error notifications via a global Notify component, error aggregation to Sentry.

##### Components
a. Main components
- User’s Browser (Client)
- CDN / Static Asset Hosting
- NGINX (proxy, TLS termination)
- Shell Application
- Sub-App Bundles (“account,” “blueprints,” etc.)
- Global Redux Store
- Backend API (Zesty.io CMS services)
- External Services:
– Auth (OAuth/JWT issuer)
– Sentry (error aggregation)
– CI/CD (GitHub Actions)
b. Relationships & data flows
- Browser → CDN → NGINX → serve `index.html` + shell bundle + all sub-app bundles (initial load)
- Shell handles routing, mounts sub-apps based on URL
- Sub-apps dispatch Redux actions → update global store → subscribe components
- Components invoke `src/util/request.js` → HTTP calls → backend API
- Errors bubble up → Notify component → display to user + send to Sentry
- CI pipeline builds Docker image → pushes to registry → deployed via GitHub Actions using `app.yaml` to GCP
c. Architectural patterns & design principles
- Micro-frontend: independent sub-app bundles hosted & welded by a shell
- Redux single-store pattern
- Atomic design for shared UI components
- PRPL pattern (future): initial push, render, pre-cache, lazy-load
d. Key technologies & frameworks
- React + Redux
- Webpack (per-app config)
- Cypress for e2e tests
- Docker, NGINX, GCP App Engine (`app.yaml`)
- GitHub Actions for CI (`ci.yaml`, `cd.yaml`)
- Sentry

##### Detail
- Build/deploy mechanisms (CI/CD, Docker, app.yaml) as separate infrastructure nodes
- Error handling flow (Notify → Sentry)
- Configuration scripts and local-testing tools (Cypress, CI scripts) off to one side as supporting processes

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client Flow
    Browser["User's Browser"]:::frontend
    CDN["CDN / Static Asset Hosting"]:::infra
    NGINX["NGINX Proxy & TLS"]:::infra
    Browser -->|"GET index.html & bundles"| CDN
    CDN -->|"Forward request"| NGINX

    %% Shell and Sub-Apps
    subgraph "Front-End Shell & Apps"
        direction TB
        ShellApp["Shell Application"]:::frontend
        GlobalStore["Global Redux Store"]:::frontend
        subgraph "Sub-Applications"
            direction TB
            Account["Account Sub-App"]:::frontend
            Blueprints["Blueprints Sub-App"]:::frontend
            Dashboard["Dashboard Sub-App"]:::frontend
            Properties["Properties Sub-App"]:::frontend
            Support["Support Sub-App"]:::frontend
            Teams["Teams Sub-App"]:::frontend
        end
    end
    NGINX -->|"Serves bundles"| ShellApp
    ShellApp -->|"mounts"| Account
    ShellApp -->|"mounts"| Blueprints
    ShellApp -->|"mounts"| Dashboard
    ShellApp -->|"mounts"| Properties
    ShellApp -->|"mounts"| Support
    ShellApp -->|"mounts"| Teams
    ShellApp -->|"dispatch(...) / subscribe"| GlobalStore
    Account -->|"dispatch / subscribe"| GlobalStore
    Blueprints -->|"dispatch / subscribe"| GlobalStore
    Dashboard -->|"dispatch / subscribe"| GlobalStore
    Properties -->|"dispatch / subscribe"| GlobalStore
    Support -->|"dispatch / subscribe"| GlobalStore
    Teams -->|"dispatch / subscribe"| GlobalStore

    %% Shared Utilities
    subgraph "Shared Utilities & Vendors"
        direction TB
        Util["HTTP Utilities (request.js)"]:::frontend
        Vendors["Polyfills & Vendors"]:::frontend
    end
    ShellApp -->|"imports"| Util
    Account -->|"imports"| Util
    Properties -->|"imports"| Util
    ShellApp -->|"imports"| Vendors

    %% Backend API
    Backend["Backend API (Zesty.io CMS)"]:::backend
    Util -->|"HTTP calls"| Backend
    Backend -->|"responses"| GlobalStore

    %% Error Handling
    Notify["Global Notify Component"]:::frontend
    Sentry["Sentry (Error Aggregation)"]:::external
    ShellApp -->|"error events"| Notify
    Account -->|"error events"| Notify
    Notify -->|"display + send"| Sentry

    %% CI/CD & Deployment
    subgraph "CI/CD & Deployment"
        direction TB
        GitHub["GitHub Actions (CI/CD)"]:::infra
        Docker["Dockerfile"]:::infra
        Registry["Container Registry"]:::infra
        GCP["GCP App Engine (app.yaml)"]:::infra
    end
    GitHub -->|"build & test"| Docker
    Docker -->|"push image"| Registry
    Registry -->|"deploy"| GCP

    %% Build & Test Scripts
    Bin["Build Orchestration Scripts"]:::infra
    Cypress["E2E Tests (Cypress)"]:::infra
    GitHub -->|"invokes"| Bin
    GitHub -->|"runs tests"| Cypress

    %% Click Events
    click ShellApp "https://github.com/zesty-io/accounts-ui/tree/master/src/shell/"
    click Account "https://github.com/zesty-io/accounts-ui/tree/master/src/apps/account/"
    click Blueprints "https://github.com/zesty-io/accounts-ui/tree/master/src/apps/blueprints/"
    click Dashboard "https://github.com/zesty-io/accounts-ui/tree/master/src/apps/dashboard/"
    click Properties "https://github.com/zesty-io/accounts-ui/tree/master/src/apps/properties/"
    click Support "https://github.com/zesty-io/accounts-ui/tree/master/src/apps/support/"
    click Teams "https://github.com/zesty-io/accounts-ui/tree/master/src/apps/teams/"
    click GlobalStore "https://github.com/zesty-io/accounts-ui/blob/master/src/shell/store/index.js"
    click AccountStore "https://github.com/zesty-io/accounts-ui/blob/master/src/apps/account/src/store/index.js"
    click PropertiesStore "https://github.com/zesty-io/accounts-ui/tree/master/src/apps/properties/src/store/"
    click TeamsStore "https://github.com/zesty-io/accounts-ui/tree/master/src/apps/teams/src/store/"
    click Util "https://github.com/zesty-io/accounts-ui/blob/master/src/util/request.js"
    click Vendors "https://github.com/zesty-io/accounts-ui/tree/master/src/vendors/"
    click CI "https://github.com/zesty-io/accounts-ui/blob/master/.github/workflows/ci.yaml"
    click CD "https://github.com/zesty-io/accounts-ui/blob/master/.github/workflows/cd.yaml"
    click Docker "https://github.com/zesty-io/accounts-ui/tree/master/Dockerfile"
    click Nginx "https://github.com/zesty-io/accounts-ui/blob/master/etc/nginx.conf"
    click GCP "https://github.com/zesty-io/accounts-ui/blob/master/app.yaml"
    click Bin "https://github.com/zesty-io/accounts-ui/tree/master/bin/"
    click Cypress "https://github.com/zesty-io/accounts-ui/tree/master/cypress/"

    %% Styles
    classDef frontend fill:#8FBFE0,stroke:#333,stroke-width:1px
    classDef backend fill:#A6D785,stroke:#333,stroke-width:1px
    classDef infra fill:#CCCCCC,stroke:#333,stroke-width:1px
    classDef external fill:#F3C78E,stroke:#333,stroke-width:1px
```
