# gpiiltd/wenaija_admin_app architecture

> Architecture diagram of the GitHub repository gpiiltd/wenaija_admin_app, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/gpiiltd/wenaija_admin_app
- Repository: https://github.com/gpiiltd/wenaija_admin_app

## Overview

##### Project type and purpose
- This is a front-end React single-page application (SPA) written in TypeScript.
- It provides a dashboard UI with authentication, user/role management, survey-reporting, leaderboard, institutions management, etc.
- It uses Redux Toolkit (slices & thunks) for state management, React Router for navigation, Tailwind CSS for styling, and a simple network module (https.ts) to call out to RESTful APIs.

##### File structure
- Top-level:
- public/ – static assets and index.html
- src/ – all application code
- .github/, .husky/, ESLint/Prettier configs – CI/CD and code-quality
- src/components/ – reusable UI components (buttons, cards, modals, charts…)
- src/pages/ – route-level page components (login, dashboard, users, institutions)
- src/navigation/ – React Router setup and route names
- src/features/ – Redux “ducks” (slice, service, thunk) organized by domain (auth, dashboard, reports, institutions, etc.)
- src/network/https.ts – centralized HTTP client for API calls
- src/state/store.ts – Redux store setup combining all slices
- src/config.ts – environment and API-endpoint configuration

##### README
- It confirms the SPA nature, Node/npm scripts for dev and build, and documents one component’s API (Button).

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Browser/Client"
        Browser["User Browser"]:::external
    end
    Browser --> ReactApp

    subgraph "React Application"
        subgraph "Entry Point"
            Index["index.tsx"]:::frontend
            App["App.tsx"]:::frontend
        end
        subgraph "Routing Layer"
            Router["Router.tsx"]:::frontend
            RouteNames["RouteNames.ts"]:::frontend
        end
        subgraph "Pages Layer"
            PagesFolder["Pages (src/Pages/)"]:::frontend
        end
        subgraph "UI Components Layer"
            ComponentsFolder["Components (src/Components/)"]:::frontend
        end
        subgraph "State Management"
            Store["store.ts"]:::state
            StateIndex["index.ts"]:::state
            subgraph "Slices & Thunks"
                authSlice["authSlice.ts"]:::state
                authService["authService.ts"]:::state
                authThunks["authThunks.ts"]:::state

                dashboardSlice["dashboardSlice.ts"]:::state
                dashboardService["dashboardService.ts"]:::state
                dashboardThunk["dashboardThunk.ts"]:::state

                institutionSlice["institutionManagementSlice.ts"]:::state
                institutionService["institutionManagementService.ts"]:::state
                institutionThunk["institutionManagementThunk.ts"]:::state

                leaderboardSlice["leaderboardSlice.ts"]:::state
                leaderboardService["leaderboardService.ts"]:::state
                leaderboardThunk["leaderboardThunk.ts"]:::state

                rbacSlice["rbacSlice.ts"]:::state
                rbacService["rbacServices.ts"]:::state
                rbacThunks["rbacThunks.ts"]:::state

                communityTaskSlice["communityTaskSlice.ts"]:::state
                communityTaskService["communityTaskService.ts"]:::state
                communityTaskThunk["communityTaskThunk.ts"]:::state

                healthSurveySlice["healthInstitutionSurveySlice.ts"]:::state
                healthSurveyService["healthInstitutionSurveyService.ts"]:::state
                healthSurveyThunk["healthInstitutionSurveyThunk.ts"]:::state

                userManagementSlice["userManagementSlice.ts"]:::state
                userManagementService["userManagementService.ts"]:::state
                userManagementThunk["userManagementThunk.ts"]:::state
            end
        end
        subgraph "Network Layer"
            https["https.ts"]:::network
        end
        config["config.ts"]:::frontend
    end

    ReactApp -->|initializes via| Index
    Index --> App
    App --> Router
    Router -->|routes to| PagesFolder
    PagesFolder -->|uses| ComponentsFolder
    ComponentsFolder -->|dispatch actions| Store
    PagesFolder -->|dispatch actions| Store
    Store -->|invokes thunks| authThunks
    Store --> dashboardThunk
    Store --> institutionThunk
    Store --> leaderboardThunk
    Store --> rbacThunks
    Store --> communityTaskThunk
    Store --> healthSurveyThunk
    Store --> userManagementThunk
    authThunks -->|calls| https
    dashboardThunk --> https
    institutionThunk --> https
    leaderboardThunk --> https
    rbacThunks --> https
    communityTaskThunk --> https
    healthSurveyThunk --> https
    userManagementThunk --> https
    https --> ExternalAPI
    ExternalAPI --> Database

    classDef frontend fill:#D0E8FF,stroke:#0366D6,stroke-width:1px
    classDef state fill:#E0FFD8,stroke:#228A00,stroke-width:1px
    classDef network fill:#FFD8D8,stroke:#D91E18,stroke-width:1px
    classDef external fill:#E8E8E8,stroke:#999,stroke-width:1px

    ExternalAPI["External REST API"]:::external
    Database[(Database)]:::external

    click Index "https://github.com/gpiiltd/wenaija_admin_app/blob/staging/src/index.tsx"
    click App "https://github.com/gpiiltd/wenaija_admin_app/blob/staging/src/App.tsx"
    click Router "https://github.com/gpiiltd/wenaija_admin_app/blob/staging/src/Navigation/Router.tsx"
    click RouteNames "https://github.com/gpiiltd/wenaija_admin_app/blob/staging/src/Navigation/RouteNames.ts"
    click ComponentsFolder "https://github.com/gpiiltd/wenaija_admin_app/tree/staging/src/Components/"
    click PagesFolder "https://github.com/gpiiltd/wenaija_admin_app/tree/staging/src/Pages/"
    click Store "https://github.com/gpiiltd/wenaija_admin_app/blob/staging/src/state/store.ts"
    click StateIndex "https://github.com/gpiiltd/wenaija_admin_app/blob/staging/src/state/index.ts"
    click https "https://github.com/gpiiltd/wenaija_admin_app/blob/staging/src/network/https.ts"
    click config "https://github.com/gpiiltd/wenaija_admin_app/blob/staging/src/config.ts"
    click authSlice "https://github.com/gpiiltd/wenaija_admin_app/blob/staging/src/features/auth/authSlice.ts"
    click authService "https://github.com/gpiiltd/wenaija_admin_app/blob/staging/src/features/auth/authService.ts"
    click authThunks "https://github.com/gpiiltd/wenaija_admin_app/blob/staging/src/features/auth/authThunks.ts"
    click dashboardSlice "https://github.com/gpiiltd/wenaija_admin_app/blob/staging/src/features/dashboard/dashboardSlice.ts"
    click dashboardService "https://github.com/gpiiltd/wenaija_admin_app/blob/staging/src/features/dashboard/dashboardService.ts"
    click dashboardThunk "https://github.com/gpiiltd/wenaija_admin_app/blob/staging/src/features/dashboard/dashboardThunk.ts"
    click institutionSlice "https://github.com/gpiiltd/wenaija_admin_app/blob/staging/src/features/institutions/institutionManagementSlice.ts"
    click institutionService "https://github.com/gpiiltd/wenaija_admin_app/blob/staging/src/features/institutions/institutionManagementService.ts"
    click institutionThunk "https://github.com/gpiiltd/wenaija_admin_app/blob/staging/src/features/institutions/institutionManagementThunk.ts"
    click leaderboardSlice "https://github.com/gpiiltd/wenaija_admin_app/blob/staging/src/features/leaderboard/leaderboardSlice.ts"
    click leaderboardService "https://github.com/gpiiltd/wenaija_admin_app/blob/staging/src/features/leaderboard/leaderboardService.ts"
    click leaderboardThunk "https://github.com/gpiiltd/wenaija_admin_app/blob/staging/src/features/leaderboard/leaderboardThunk.ts"
    click rbacSlice "https://github.com/gpiiltd/wenaija_admin_app/blob/staging/src/features/rbac/rbacSlice.ts"
    click rbacService "https://github.com/gpiiltd/wenaija_admin_app/blob/staging/src/features/rbac/rbacServices.ts"
    click rbacThunks "https://github.com/gpiiltd/wenaija_admin_app/blob/staging/src/features/rbac/rbacThunks.ts"
    click communityTaskSlice "https://github.com/gpiiltd/wenaija_admin_app/blob/staging/src/features/reports/communityTaskManagement/communityTaskSlice.ts"
    click communityTaskService "https://github.com/gpiiltd/wenaija_admin_app/blob/staging/src/features/reports/communityTaskManagement/communityTaskService.ts"
    click communityTaskThunk "https://github.com/gpiiltd/wenaija_admin_app/blob/staging/src/features/reports/communityTaskManagement/communityTaskThunk.ts"
    click healthSurveySlice "https://github.com/gpiiltd/wenaija_admin_app/blob/staging/src/features/reports/healthInstututionSurveyManagement/healthInstitutionSurveySlice.ts"
    click healthSurveyService "https://github.com/gpiiltd/wenaija_admin_app/blob/staging/src/features/reports/healthInstututionSurveyManagement/healthInstitutionSurveyService.ts"
    click healthSurveyThunk "https://github.com/gpiiltd/wenaija_admin_app/blob/staging/src/features/reports/healthInstututionSurveyManagement/healthInstitutionSurveyThunk.ts"
    click userManagementSlice "https://github.com/gpiiltd/wenaija_admin_app/blob/staging/src/features/usersManagement/userManagementSlice.ts"
    click userManagementService "https://github.com/gpiiltd/wenaija_admin_app/blob/staging/src/features/usersManagement/userManagementService.ts"
    click userManagementThunk "https://github.com/gpiiltd/wenaija_admin_app/blob/staging/src/features/usersManagement/userManagementThunk.ts"
```
