# akskettu-hub/full-stack-open-pokedex architecture

> Architecture diagram of the GitHub repository akskettu-hub/full-stack-open-pokedex, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-09-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/akskettu-hub/full-stack-open-pokedex
- Repository: https://github.com/akskettu-hub/full-stack-open-pokedex

## Overview

##### Project type and purpose
- This is primarily a single-page React frontend application (no separate backend code) that demonstrates CI/CD workflows.
- It includes:
- A React codebase (src/, public/)
- Unit tests (test/) and end-to-end tests (e2e-tests/)
- Build scripts (build_step.sh, start_step.sh)
- CI/CD pipelines implemented in GitHub Actions (.github/workflows/*.yml)

##### Main components
A. Developer Workstation
- Code editor & Local Git repository
- Local dev server (webpack dev server invoked by npm start)
- Local commands: install, start, test, eslint, build, start-prod

B. Source Code
- src/ folder: React components (App, PokemonList, PokemonPage, etc.) + custom hook (useApi.js) + styles.css
- public/index.html as the SPA entry point
- Configuration files: webpack.config.js, .babelrc, ESLint config

C. Test Suites
- Unit tests (test/*.jest.spec.jsx) run by Jest (`npm test`)
- E2E tests (e2e-tests/pokemon.spec.js) run by Playwright (`playwright.config.js`)

D. Build & Production
- build_step.sh produces a production-ready bundle under dist/ or build/
- start_step.sh serves the production bundle (`npm run start-prod`)

E. CI/CD Platform
- GitHub repository with three key workflows:
1. health_check.yml (repo health/status)
2. hello.yml (example workflow)
3. pipeline.yml (main CI/CD pipeline)
- Workflow steps: checkout → install dependencies → lint → unit tests → build → e2e tests → optionally deploy

##### Relationships and data flow
- Local development: Developer → (edit, commit) → Local Git → webpack dev server → Browser
- Testing: Local Git → Jest (unit) and Playwright (e2e) → pass/fail feedback
- CI pipeline: Git push → GitHub Actions (pipeline.yml)
- Step 1: actions/checkout
- Step 2: npm install
- Step 3: npm run eslint
- Step 4: npm test
- Step 5: npm run build
- Step 6: npm start-prod + Playwright e2e
- Step 7: [optional] deployment

##### Architectural patterns and design principles
- Component-driven UI: small reusable React components
- Separation of concerns:
- src/ for app logic, public/ for HTML shell
- test/ vs e2e-tests/ for different testing levels
- build vs dev environments controlled by webpack config
- CI as code: all workflows versioned under .github/workflows

##### Technologies and frameworks
- React (JSX)
- webpack (bundling & dev server)
- Babel (transpilation)
- Jest (unit testing)
- Playwright (end-to-end testing)
- ESLint (linting)
- GitHub Actions (CI/CD)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Local Development Environment
    subgraph "Local Development" 
        style LocalDevelopment fill:#D0E8FF,stroke:#333,stroke-width:1px
        Developer["Developer"]:::dev
        Editor["Code Editor\n& Local Git"]:::dev
        WebpackDev["Webpack Dev Server\n(npm start)"]:::dev
        BrowserLocal["Browser"]:::dev
        Editor -->|edit/commit| WebpackDev
        WebpackDev -->|serves SPA| BrowserLocal
    end
    click Editor "https://github.com/akskettu-hub/full-stack-open-pokedex/tree/main/src/"
    click WebpackDev "https://github.com/akskettu-hub/full-stack-open-pokedex/blob/main/package.json"

    %% Source Code and Configurations
    subgraph "Source Code & Config" 
        style SourceCode fill:#EDEDFE,stroke:#333,stroke-width:1px
        SRC["React Source Code\n(src/)"]:::config
        HTML["SPA Entry Point\n(public/index.html)"]:::config
        WebpackCfg["Webpack Config\n(webpack.config.js)"]:::config
        BabelCfg["Babel Config\n(.babelrc)"]:::config
        ESLintCfg["ESLint Config\n(.eslintrc.js)"]:::config
        SRC --> HTML
        SRC --> WebpackCfg
        SRC --> BabelCfg
        SRC --> ESLintCfg
    end
    click SRC "https://github.com/akskettu-hub/full-stack-open-pokedex/tree/main/src/"
    click HTML "https://github.com/akskettu-hub/full-stack-open-pokedex/blob/main/public/index.html"
    click WebpackCfg "https://github.com/akskettu-hub/full-stack-open-pokedex/blob/main/webpack.config.js"
    click BabelCfg "https://github.com/akskettu-hub/full-stack-open-pokedex/blob/main/.babelrc"
    click ESLintCfg "https://github.com/akskettu-hub/full-stack-open-pokedex/blob/main/.eslintrc.js"

    %% Test Suites
    subgraph "Test Suites" 
        style TestSuites fill:#EDEDFE,stroke:#333,stroke-width:1px
        UnitTests["Unit Tests (Jest)\n(test/)"]:::config
        E2ETests["E2E Tests (Playwright)\n(e2e-tests/)"]:::config
        PlaywrightCfg["Playwright Config\n(playwright.config.js)"]:::config
        UnitTests -->|run npm test| SRC
        E2ETests -->|run playwright| WebpackDev
        E2ETests --> PlaywrightCfg
    end
    click UnitTests "https://github.com/akskettu-hub/full-stack-open-pokedex/tree/main/test/"
    click E2ETests "https://github.com/akskettu-hub/full-stack-open-pokedex/tree/main/e2e-tests/"
    click PlaywrightCfg "https://github.com/akskettu-hub/full-stack-open-pokedex/blob/main/playwright.config.js"

    %% Build & Production Scripts
    subgraph "Build & Production" 
        style BuildProd fill:#FFDAB9,stroke:#333,stroke-width:1px
        BuildScript["build_step.sh\n(npm run build)"]:::prod
        StartScript["start_step.sh\n(npm run start-prod)"]:::prod
        PackageJSON["package.json"]:::config
        BuildScript -->|outputs| Artifact["Build Artifacts\n(dist/ or build/)"]:::artifact
        Artifact -->|served by| StartScript
        StartScript -->|serves SPA| BrowserLocal
    end
    click BuildScript "https://github.com/akskettu-hub/full-stack-open-pokedex/blob/main/build_step.sh"
    click StartScript "https://github.com/akskettu-hub/full-stack-open-pokedex/blob/main/start_step.sh"
    click PackageJSON "https://github.com/akskettu-hub/full-stack-open-pokedex/blob/main/package.json"

    %% CI/CD Pipeline
    subgraph "CI/CD Pipeline\n(GitHub Actions)" 
        style CICD fill:#DFF2BF,stroke:#333,stroke-width:1px
        GitHubRepo["GitHub Repository"]:::cicd
        HealthCheck["Health Check Workflow\n(.github/workflows/health_check.yml)"]:::cicd
        HelloWF["Hello Workflow\n(.github/workflows/hello.yml)"]:::cicd
        MainPipeline["Main Pipeline\n(.github/workflows/pipeline.yml)"]:::cicd
        ActionsRunner["Actions Runner"]:::cicd
        GitHubRepo --> HealthCheck
        GitHubRepo --> HelloWF
        GitHubRepo --> MainPipeline
        MainPipeline -->|checkout| ActionsRunner
        MainPipeline -->|install deps| ActionsRunner
        MainPipeline -->|lint| ActionsRunner
        MainPipeline -->|unit tests| ActionsRunner
        MainPipeline -->|build| ActionsRunner
        MainPipeline -->|e2e tests| ActionsRunner
        MainPipeline -->|deploy?| ActionsRunner
    end
    click HealthCheck "https://github.com/akskettu-hub/full-stack-open-pokedex/blob/main/.github/workflows/health_check.yml"
    click HelloWF "https://github.com/akskettu-hub/full-stack-open-pokedex/blob/main/.github/workflows/hello.yml"
    click MainPipeline "https://github.com/akskettu-hub/full-stack-open-pokedex/blob/main/.github/workflows/pipeline.yml"

    %% Relationships
    Developer -->|push code| GitHubRepo
    GitHubRepo -->|triggers| MainPipeline
    ActionsRunner -->|build artifact| Artifact
    ActionsRunner -->|test against| StartScript

    %% Styles
    classDef dev fill:#D0E8FF,stroke:#333,stroke-width:1px
    classDef cicd fill:#DFF2BF,stroke:#333,stroke-width:1px
    classDef prod fill:#FFDAB9,stroke:#333,stroke-width:1px
    classDef config fill:#EDEDFE,stroke:#333,stroke-width:1px
    classDef artifact fill:#FFE4E1,stroke:#333,stroke-width:1px
```
