# correamarques/react-mid-dev-test architecture

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

- Interactive diagram: https://gitdiagram.com/correamarques/react-mid-dev-test
- Repository: https://github.com/correamarques/react-mid-dev-test

## Overview

##### Project type and purpose
- This is a front-end Single Page Application (SPA) built with React and Vite.
- It implements eight small calculator-style exercises (factorial, prime numbers, palindrome, etc.) to demonstrate mid-level React skills.
- It includes unit tests (React Testing Library/Vitest or Jest) and end-to-end tests (Cypress).

##### File structure
- Top level:
- index.html + public/ → static assets
- src/ → application source code
- cypress/ → E2E tests and fixtures
- config files: vite.config.ts, tsconfig.json, package.json, Cypress config, ESLint, etc.
- src/ subdivides into:
- components/shared/ → reusable UI pieces (Header, NavigationBar)
- pages/ → one page component per exercise + Home
- utils/ → test-helper utilities
- main.tsx → entry point mounting <App/>
- App.tsx → router/navigation hub
- Build/deploy: Vite dev server serves the bundled SPA; `npm run dev` starts it.
- Testing:
- Unit tests alongside components/pages (App.test.tsx, Header.test.tsx, etc.)
- Cypress E2E under cypress/e2e/*.cy.ts with fixtures & support files

##### README
- Describes how to install (npm install) and run the dev server (npm run dev).
- Explains how to launch Cypress in headless or interactive mode.
- Lists each exercise’s user story (calculator, prime checker, etc.).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Build/Dev Environment
    DeveloperEnv["Developer Environment<br/>(IDE, Node.js, NPM, Configs)"]:::build
    ViteDev["Vite Dev Server/Bundler"]:::build

    DeveloperEnv -->|"npm run dev"| ViteDev
    ViteDev -->|"serves/bundles"| Browser

    %% Runtime Client
    Browser["Browser / Client<br/>(Static Assets)"]:::runtime
    ReactApp["React SPA Application"]:::runtime

    ViteDev --> Browser
    Browser -->|"loads"| ReactApp

    subgraph "React SPA Application"
        AppShell["App Shell<br/>(App.tsx + Router)"]:::runtime
        SharedComp["Shared Components<br/>(Header, NavigationBar)"]:::runtime
        Pages["Pages / Exercises<br/>(8 Calculator Pages)"]:::runtime
        Utils["Utility Functions"]:::runtime

        ReactApp --> AppShell
        ReactApp --> SharedComp
        ReactApp --> Pages
        ReactApp --> Utils
    end

    %% Testing Layers
    DeveloperEnv -->|"npm test"| UnitRunner
    DeveloperEnv -->|"npm run cy"| E2ERunner

    UnitRunner["Unit Test Runner<br/>(Vitest/Jest + RTL)"]:::test
    E2ERunner["E2E Test Runner<br/>(Cypress)"]:::test

    UnitRunner -->|"executes tests in"| ReactApp
    E2ERunner -->|"drives"| Browser

    %% Click Events
    click DeveloperEnv "https://github.com/correamarques/react-mid-dev-test/blob/main/.eslintrc.cjs"
    click ViteDev "https://github.com/correamarques/react-mid-dev-test/blob/main/vite.config.ts"
    click Browser "https://github.com/correamarques/react-mid-dev-test/blob/main/index.html"
    click AppShell "https://github.com/correamarques/react-mid-dev-test/blob/main/src/App.tsx"
    click SharedComp "https://github.com/correamarques/react-mid-dev-test/blob/main/src/components/shared/Header.tsx"
    click Pages "https://github.com/correamarques/react-mid-dev-test/blob/main/src/pages/Home.tsx"
    click Utils "https://github.com/correamarques/react-mid-dev-test/blob/main/src/utils/test-utils.tsx"
    click UnitRunner "https://github.com/correamarques/react-mid-dev-test/blob/main/src/test/setup.ts"
    click E2ERunner "https://github.com/correamarques/react-mid-dev-test/blob/main/cypress.config.ts"

    %% Styles
    classDef build fill:#8fbc8f,stroke:#333,color:#000
    classDef runtime fill:#87cefa,stroke:#333,color:#000
    classDef test fill:#ffa07a,stroke:#333,color:#000
```
