# 4geeksacademy/fs-pt-anafiguereo-contact_list architecture

> Architecture diagram of the GitHub repository 4geeksacademy/fs-pt-anafiguereo-contact_list, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-09-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/4geeksacademy/fs-pt-anafiguereo-contact_list
- Repository: https://github.com/4geeksacademy/fs-pt-anafiguereo-contact_list

## Overview

##### Project type and purpose
- This is a front-end “multi-page” Single Page Application (SPA) template built with React, Vite, and React Router.
- Its primary purpose is to serve as a boilerplate for students to bootstrap new React websites with built-in state management (Context + useReducer), routing, API service utilities, and Vercel deployment.

##### File structure
- Top-level config files:
- vite.config.js — Vite bundler configuration
- eslint.cjs — linting rules
- vercel.json — deployment settings
- . env.example — environment variable template
- .devcontainer/ & .gitpod.yml — dev-container setups
- Public entry point: index.html
- Source code under src/:
- assets/ — images and static files
- components/ — reusable UI building blocks (Card, Navbar, Footer, Form, ScrollToTop)
- hooks/ — custom React hooks (useGlobalReducer)
- pages/ — route-mapped pages (Home, AddContact, Single, Demo, Layout)
- services/ — API‐interaction layer (apiServices.js)
- store.js — initial state and reducer setup
- routes.jsx — React Router definitions
- main.jsx — app entry, context provider, and router injection

##### README for additional insights
- Describes Context + useReducer “store” pattern as global state.
- Suggests use of Vite for bundling and Vercel for hosting.
- Mentions how pages map one-to-one with routes.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Development Environment
    subgraph "Development Environment"
        DevMachine["Developer Machine & CI"]:::build
        ESLint["eslint.cjs"]:::build
        ViteConfig["vite.config.js"]:::build
        EnvTemplate[".env.example"]:::build
        DevContainer[".devcontainer/ & .gitpod.yml"]:::build
    end

    DevMachine -->|runs lint| ESLint
    DevMachine -->|uses config| ViteConfig
    DevMachine -->|provides env template| EnvTemplate
    DevMachine -->|sets up container| DevContainer
    DevMachine -->|"npm run dev"| ViteDev["Vite Dev Server"]:::build
    ViteDev -->|serves| indexHTML["index.html"]:::static

    %% Production Build & Deployment
    ViteBuild["Production Build (Vite)"]:::build
    ViteBuild -->|output static assets| indexHTML
    ViteBuild -->|deploy| Vercel["Vercel CDN"]:::external

    %% User Browser Runtime
    indexHTML -->|load| Browser["User Browser"]:::runtime
    Vercel -->|serves| Browser

    subgraph "React App Runtime"
        main["src/main.jsx\n(Context Provider + App Init)"]:::runtime
        Router["src/routes.jsx\n(React Router)"]:::runtime
        subgraph "Page Components"
            Home["Home.jsx"]:::runtime
            AddContact["AddContact.jsx"]:::runtime
            Single["Single.jsx"]:::runtime
            Demo["Demo.jsx"]:::runtime
            Layout["Layout.jsx"]:::runtime
        end
        subgraph "UI Components"
            Card["Card.jsx"]:::runtime
            Footer["Footer.jsx"]:::runtime
            Form["Form.jsx"]:::runtime
            Navbar["Navbar.jsx"]:::runtime
            ScrollToTop["ScrollToTop.jsx"]:::runtime
        end
        Hooks["src/hooks/useGlobalReducer.jsx"]:::runtime
        Store["src/store.js"]:::runtime
        Services["src/services/apiServices.js"]:::runtime
        Assets["src/assets/"]:::static
        Styles["src/index.css"]:::static
        ExternalAPI["External REST API"]:::external
    end

    Browser -->|executes| main
    main -->|wraps| Router
    Router -->|"renders routes"| Home
    Router -->|"renders routes"| AddContact
    Router -->|"renders routes"| Single
    Router -->|"renders routes"| Demo
    Router -->|"renders routes"| Layout

    Home -->|uses UI| Card
    Home -->|uses UI| Navbar
    AddContact -->|uses UI| Form
    Single -->|uses UI| Card
    Demo -->|uses UI| ScrollToTop
    Layout -->|uses UI| Footer

    Card -->|dispatches| Store
    Form -->|dispatches| Store
    Navbar -->|dispatches| Store
    ScrollToTop -->|dispatches| Store
    Hooks -->|provides hook| Store
    main -->|provides context| Store

    Card -->|calls| Services
    Form -->|calls| Services
    Services -->|fetches| ExternalAPI

    Browser -->|loads static| Assets
    Browser -->|loads styles| Styles

    %% Click Events
    click ViteConfig "https://github.com/4geeksacademy/fs-pt-anafiguereo-contact_list/blob/master/vite.config.js"
    click ESLint "https://github.com/4geeksacademy/fs-pt-anafiguereo-contact_list/blob/master/eslint.cjs"
    click EnvTemplate "https://github.com/4geeksacademy/fs-pt-anafiguereo-contact_list/blob/master/.env.example"
    click DevContainer "https://github.com/4geeksacademy/fs-pt-anafiguereo-contact_list/blob/master/.devcontainer/devcontainer.json"
    click DevContainer "https://github.com/4geeksacademy/fs-pt-anafiguereo-contact_list/blob/master/.gitpod.yml"
    click indexHTML "https://github.com/4geeksacademy/fs-pt-anafiguereo-contact_list/blob/master/index.html"
    click Home "https://github.com/4geeksacademy/fs-pt-anafiguereo-contact_list/blob/master/src/pages/Home.jsx"
    click AddContact "https://github.com/4geeksacademy/fs-pt-anafiguereo-contact_list/blob/master/src/pages/AddContact.jsx"
    click Single "https://github.com/4geeksacademy/fs-pt-anafiguereo-contact_list/blob/master/src/pages/Single.jsx"
    click Demo "https://github.com/4geeksacademy/fs-pt-anafiguereo-contact_list/blob/master/src/pages/Demo.jsx"
    click Layout "https://github.com/4geeksacademy/fs-pt-anafiguereo-contact_list/blob/master/src/pages/Layout.jsx"
    click Card "https://github.com/4geeksacademy/fs-pt-anafiguereo-contact_list/blob/master/src/components/Card.jsx"
    click Footer "https://github.com/4geeksacademy/fs-pt-anafiguereo-contact_list/blob/master/src/components/Footer.jsx"
    click Form "https://github.com/4geeksacademy/fs-pt-anafiguereo-contact_list/blob/master/src/components/Form.jsx"
    click Navbar "https://github.com/4geeksacademy/fs-pt-anafiguereo-contact_list/blob/master/src/components/Navbar.jsx"
    click ScrollToTop "https://github.com/4geeksacademy/fs-pt-anafiguereo-contact_list/blob/master/src/components/ScrollToTop.jsx"
    click Hooks "https://github.com/4geeksacademy/fs-pt-anafiguereo-contact_list/blob/master/src/hooks/useGlobalReducer.jsx"
    click Store "https://github.com/4geeksacademy/fs-pt-anafiguereo-contact_list/blob/master/src/store.js"
    click main "https://github.com/4geeksacademy/fs-pt-anafiguereo-contact_list/blob/master/src/main.jsx"
    click Router "https://github.com/4geeksacademy/fs-pt-anafiguereo-contact_list/blob/master/src/routes.jsx"
    click Services "https://github.com/4geeksacademy/fs-pt-anafiguereo-contact_list/blob/master/src/services/apiServices.js"
    click Assets "https://github.com/4geeksacademy/fs-pt-anafiguereo-contact_list/tree/master/src/assets/"
    click Styles "https://github.com/4geeksacademy/fs-pt-anafiguereo-contact_list/blob/master/src/index.css"
    click Vercel "https://github.com/4geeksacademy/fs-pt-anafiguereo-contact_list/blob/master/vercel.json"

    %% Styles
    classDef build fill:#AED6F1,stroke:#21618C,color:#1B2631
    classDef runtime fill:#A9DFBF,stroke:#196F3D,color:#1B2631
    classDef external fill:#F5B041,stroke:#B9770E,color:#1B2631
    classDef static fill:#D5DBDB,stroke:#7B7D7D,color:#1B2631
```
