# slmn-khn/ccl-assessment architecture

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

- Interactive diagram: https://gitdiagram.com/slmn-khn/ccl-assessment
- Repository: https://github.com/slmn-khn/ccl-assessment

## Overview

##### Project type and purpose
- This is a single-page application (SPA) built with Create React App, using TypeScript.
- It displays a list of users, supports searching & pagination, and shows details on demand.
- There is no in-repo backend; data calls are performed via utility functions (likely against an external REST API).

##### File structure
- public/… contains static HTML, manifest, and robots.txt for the served SPA.
- src/index.tsx is the React root. App.tsx is the top-level component.
- src/components/… holds all UI pieces:
- ErrorBoundary
- SearchBar
- UsersTable (with UserList)
- UserDetails
- A higher-order component for SearchAndPagination
- src/store/store.ts defines client-side state management (Redux or similar).
- src/utils/userOperations.ts contains API calls or data-fetching logic.
- src/const holds application constants; theme.ts holds styling tokens.
- src/utils/types.ts defines shared TypeScript types.

##### Insights from README
- Bootstrapped with CRA; standard build/test scripts.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Browser Host
    subgraph "Browser / Host"
        Browser(["Browser"]):::external
        Index["src/index.tsx\n(ReactDOM bootstrap)"]:::core
    end

    %% React Application
    subgraph "React App"
        %% UI Components
        subgraph "UI Components"
            App["App Component"]:::ui
            ErrorBoundary["ErrorBoundary"]:::ui
            SearchBar["SearchBar"]:::ui
            UsersTable["UsersTable"]:::ui
            UserList["UserList"]:::ui
            UserDetails["UserDetails"]:::ui
            HOC["SearchAndPagination HOC"]:::ui
        end

        %% State & Business Logic
        subgraph "State & Business Logic"
            Store["Store"]:::store
            APIClient["userOperations.ts\n(API Client)"]:::utils
            Types["types.ts"]:::utils
            Consts["constants"]:::utils
            Theme["theme.ts"]:::utils
        end
    end

    %% External Service
    ExternalAPI["External User API"]:::external

    %% Data Flow
    Browser -->|loads SPA| Index
    Index -->|mounts| App
    App -->|wrapped by| ErrorBoundary
    HOC -->|wraps| SearchBar
    HOC -->|wraps| UsersTable

    SearchBar -->|dispatch SEARCH_QUERY| Store
    UsersTable -->|dispatch PAGE_SELECT| Store
    UserDetails -->|dispatch DETAIL_REQUEST| Store

    Store -->|USERS_FETCH_REQUEST| APIClient
    APIClient -->|HTTP Request| ExternalAPI
    ExternalAPI -->|HTTP Response| APIClient
    APIClient -->|USERS_FETCH_SUCCESS/FAILURE| Store
    Store -->|update state| App
    Store -->|provide props| SearchBar
    Store -->|provide props| UsersTable
    Store -->|provide props| UserDetails

    %% Click Events
    click Index "https://github.com/slmn-khn/ccl-assessment/blob/main/src/index.tsx"
    click App "https://github.com/slmn-khn/ccl-assessment/blob/main/src/App.tsx"
    click ErrorBoundary "https://github.com/slmn-khn/ccl-assessment/blob/main/src/components/ErrorBoundary/index.tsx"
    click SearchBar "https://github.com/slmn-khn/ccl-assessment/blob/main/src/components/SearchBar/index.tsx"
    click UsersTable "https://github.com/slmn-khn/ccl-assessment/blob/main/src/components/UsersTable/index.tsx"
    click UserList "https://github.com/slmn-khn/ccl-assessment/blob/main/src/components/UsersTable/UserList.tsx"
    click UserDetails "https://github.com/slmn-khn/ccl-assessment/blob/main/src/components/UserDetails/index.tsx"
    click HOC "https://github.com/slmn-khn/ccl-assessment/blob/main/src/components/hoc/SearchAndPagination.tsx"
    click Store "https://github.com/slmn-khn/ccl-assessment/blob/main/src/store/store.ts"
    click APIClient "https://github.com/slmn-khn/ccl-assessment/blob/main/src/utils/userOperations.ts"
    click Types "https://github.com/slmn-khn/ccl-assessment/blob/main/src/utils/types.ts"
    click Consts "https://github.com/slmn-khn/ccl-assessment/blob/main/src/const/index.tsx"
    click Theme "https://github.com/slmn-khn/ccl-assessment/blob/main/src/theme.ts"

    %% Styles
    classDef ui fill:#D6EAF8,stroke:#1B4F72
    classDef store fill:#D5F5E3,stroke:#196F3D
    classDef utils fill:#FCF3CF,stroke:#7D6608
    classDef external fill:#FADBD8,stroke:#7B241C
    classDef core fill:#EBDEF0,stroke:#6C3483
```
