# andrelux-ua/goit-react-hw-08 architecture

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

- Interactive diagram: https://gitdiagram.com/andrelux-ua/goit-react-hw-08
- Repository: https://github.com/andrelux-ua/goit-react-hw-08

## Overview

##### Project type and purpose
- This is a front-end single-page application (SPA) built with React and Vite.
- It implements user authentication and contact management, using Redux for state.
- There is no server or database code in this repo; it calls out to external REST-style APIs (auth & contacts).

##### File structure
- Top level
- index.html, public/, vite.config.js – your build and static-assets server via Vite (and in prod, Vercel).
- src/ – all application code:
– assets/ (images, audio)
– components/ – reusable UI pieces (AppBar, Forms, Lists, Modals, Loader, Navigation, etc.)
– pages/ – routed view components (Home, Login, Registration, Contacts, 404)
– redux/ – global state: store.js plus feature subfolders (auth, contacts, filters). Each has slice.js, operations.js (thunks), selectors.js.
– main.jsx – React entry point mounting `<App />` into the DOM.

##### Elements
– Clear labels: “Browser”, “Vite Dev Server”, “React Components”, “Redux Store”, “Auth API”, “Contacts API”, etc.
- User → Components → Store → Thunks → External API → Store → Components → User.
- Dev workflow: File change → Vite HMR → Browser reload.
- Green for state layer (store & slices).
- Orange for network (API endpoints).
- Grey for build/deploy infrastructure (Vite, Vercel).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Infrastructure
    subgraph "Infrastructure (Grey)" 
        VITE["Vite Dev Server & Build Config"]:::infra
        VERCEL["Vercel Deployment Config"]:::infra
        HTML["Static HTML Entry"]:::infra
    end
    VITE --> BROWSER
    VERCEL --> BROWSER
    HTML --> BROWSER

    %% Client
    BROWSER["Browser (Client)"]:::client --> APP

    %% React Application
    subgraph "React Application"
        APP["Root App Component"]:::app

        %% Presentation Layer
        subgraph "Presentation Layer (Blue)"
            MAIN["React Entry Point"]:::app
            LAYOUTS["Layout & Routing Wrapper"]:::ui
            NAV["Navigation UI"]:::ui
            APPBAR["App Bar UI"]:::ui
            AUTHNAV["Authentication Navigation"]:::ui
            USERMENU["User Menu"]:::ui
            PRIVROUTE["Private Route Guard"]:::ui
            RESTROUTE["Restricted Route Guard"]:::ui
            LOADER["Loader (spinner) UI"]:::ui
            CONFIRM["Confirmation Modal UI"]:::ui
            SEARCH["Search Box UI"]:::ui
            CONTACTLIST["Contact List UI"]:::ui
            CONTACTITEM["Single Contact Item UI"]:::ui
            CONTACTFORM["Contact Form UI"]:::ui
            EDITFORM["Edit Contact Form UI"]:::ui
            LOGINFORM["Login Form UI"]:::ui
            REGFORM["Registration Form UI"]:::ui
            %% Pages
            subgraph "Pages"
                HOMEPAGE["Home Page"]:::ui
                LOGINPAGE["Login Page"]:::ui
                REGPAGE["Registration Page"]:::ui
                CONTACTSPAGE["Contacts Page"]:::ui
                NOTFOUND["404 Not Found Page"]:::ui
            end
        end

        %% State Layer
        subgraph "State Layer (Green)"
            STORE["Global Redux Store"]:::state
            subgraph "Auth Feature"
                AUTH_SLICE["Auth State Slice"]:::state
                AUTH_OPS["Auth Async Operations"]:::state
                AUTH_SEL["Auth Selectors"]:::state
            end
            subgraph "Contacts Feature"
                CONTACTS_SLICE["Contacts State Slice"]:::state
                CONTACTS_OPS["Contacts Async Operations"]:::state
                CONTACTS_SEL["Contacts Selectors"]:::state
            end
            subgraph "Filters Feature"
                FILTERS_SLICE["Filters State Slice"]:::state
                FILTERS_SEL["Filters Selectors"]:::state
            end
        end

        %% Network Layer
        subgraph "Network Layer (Orange)"
            API["API Thunks"]:::network
            AUTHAPI["Auth API"]:::external
            CONTACTSAPI["Contacts API"]:::external
        end

        %% Connections within React App
        APP --> MAIN
        APP --> LAYOUTS
        LAYOUTS --> NAV
        LAYOUTS --> APPBAR
        LAYOUTS --> AUTHNAV
        LAYOUTS --> USERMENU
        LAYOUTS --> PRIVROUTE
        LAYOUTS --> RESTROUTE

        MAIN --> HOMEPAGE
        MAIN --> LOGINPAGE
        MAIN --> REGPAGE
        MAIN --> CONTACTSPAGE
        MAIN --> NOTFOUND

        HOMEPAGE --> LOADER
        LOGINPAGE --> LOGINFORM
        REGPAGE --> REGFORM
        CONTACTSPAGE --> CONTACTLIST
        CONTACTLIST --> CONTACTITEM
        CONTACTSPAGE --> SEARCH
        CONTACTSPAGE --> CONTACTFORM
        CONTACTSPAGE --> EDITFORM
        CONTACTSPAGE --> CONFIRM

        %% Data Flow
        LOADER --> STORE
        LOGINFORM --> STORE
        REGFORM --> STORE
        CONTACTFORM --> STORE
        EDITFORM --> STORE
        PRIVROUTE --> STORE
        RESTROUTE --> STORE

        STORE --> AUTH_OPS
        STORE --> CONTACTS_OPS
        STORE --> FILTERS_SLICE

        AUTH_OPS --> API
        CONTACTS_OPS --> API

        API --> AUTHAPI
        API --> CONTACTSAPI

        AUTHAPI --> AUTH_OPS
        CONTACTSAPI --> CONTACTS_OPS

        AUTH_OPS --> AUTH_SLICE
        CONTACTS_OPS --> CONTACTS_SLICE

        AUTH_SLICE --> STORE
        CONTACTS_SLICE --> STORE
        FILTERS_SLICE --> STORE

        STORE --> AUTH_SEL
        STORE --> CONTACTS_SEL
        STORE --> FILTERS_SEL

        AUTH_SEL --> LOADER
        CONTACTS_SEL --> CONTACTLIST
        FILTERS_SEL --> SEARCH
    end

    %% Separate Demo SPA
    subgraph "Separate Demo SPA (my-app)" 
        DEMO["my-app/src"]:::demo
    end

    %% Click Events
    click VITE "https://github.com/andrelux-ua/goit-react-hw-08/blob/main/vite.config.js"
    click VERCEL "https://github.com/andrelux-ua/goit-react-hw-08/blob/main/vercel.json"
    click HTML "https://github.com/andrelux-ua/goit-react-hw-08/blob/main/index.html"
    click MAIN "https://github.com/andrelux-ua/goit-react-hw-08/blob/main/src/main.jsx"
    click APP "https://github.com/andrelux-ua/goit-react-hw-08/blob/main/src/components/App/App.jsx"
    click LAYOUTS "https://github.com/andrelux-ua/goit-react-hw-08/blob/main/src/components/Layouts/Layouts.jsx"
    click NAV "https://github.com/andrelux-ua/goit-react-hw-08/blob/main/src/components/Navigation/Navigation.jsx"
    click APPBAR "https://github.com/andrelux-ua/goit-react-hw-08/blob/main/src/components/AppBar/AppBar.jsx"
    click AUTHNAV "https://github.com/andrelux-ua/goit-react-hw-08/blob/main/src/components/AuthNav/AuthNav.jsx"
    click USERMENU "https://github.com/andrelux-ua/goit-react-hw-08/blob/main/src/components/UserMenu/UserMenu.jsx"
    click LOGINFORM "https://github.com/andrelux-ua/goit-react-hw-08/blob/main/src/components/LoginForm/LoginForm.jsx"
    click REGFORM "https://github.com/andrelux-ua/goit-react-hw-08/blob/main/src/components/RegistrationForm/RegistrationForm.jsx"
    click CONTACTFORM "https://github.com/andrelux-ua/goit-react-hw-08/blob/main/src/components/ContactForm/ContactForm.jsx"
    click EDITFORM "https://github.com/andrelux-ua/goit-react-hw-08/blob/main/src/components/EditContactForm/EditContactForm.jsx"
    click CONTACTLIST "https://github.com/andrelux-ua/goit-react-hw-08/blob/main/src/components/ContactList/ContactList.jsx"
    click CONTACTITEM "https://github.com/andrelux-ua/goit-react-hw-08/blob/main/src/components/Contact/Contact.jsx"
    click CONFIRM "https://github.com/andrelux-ua/goit-react-hw-08/blob/main/src/components/ConfirmModal/ConfirmModal.jsx"
    click LOADER "https://github.com/andrelux-ua/goit-react-hw-08/blob/main/src/components/Loader/Loader.jsx"
    click SEARCH "https://github.com/andrelux-ua/goit-react-hw-08/blob/main/src/components/SearchBox/SearchBox.jsx"
    click PRIVROUTE "https://github.com/andrelux-ua/goit-react-hw-08/blob/main/src/components/PrivateRoute/PrivateRoute.jsx"
    click RESTROUTE "https://github.com/andrelux-ua/goit-react-hw-08/blob/main/src/components/RestrictedRoute/RestrictedRoute.jsx"
    click HOMEPAGE "https://github.com/andrelux-ua/goit-react-hw-08/blob/main/src/pages/HomePage/HomePage.jsx"
    click LOGINPAGE "https://github.com/andrelux-ua/goit-react-hw-08/blob/main/src/pages/LoginPage/LoginPage.jsx"
    click REGPAGE "https://github.com/andrelux-ua/goit-react-hw-08/blob/main/src/pages/RegistrationPage/RegistrationPage.jsx"
    click CONTACTSPAGE "https://github.com/andrelux-ua/goit-react-hw-08/blob/main/src/pages/ContactsPage/ContactsPage.jsx"
    click NOTFOUND "https://github.com/andrelux-ua/goit-react-hw-08/blob/main/src/pages/NotFoundPage/NotFoundPage.jsx"
    click STORE "https://github.com/andrelux-ua/goit-react-hw-08/blob/main/src/redux/store.js"
    click AUTH_SLICE "https://github.com/andrelux-ua/goit-react-hw-08/blob/main/src/redux/auth/slice.js"
    click AUTH_OPS "https://github.com/andrelux-ua/goit-react-hw-08/blob/main/src/redux/auth/operations.js"
    click AUTH_SEL "https://github.com/andrelux-ua/goit-react-hw-08/blob/main/src/redux/auth/selectors.js"
    click CONTACTS_SLICE "https://github.com/andrelux-ua/goit-react-hw-08/blob/main/src/redux/contacts/slice.js"
    click CONTACTS_OPS "https://github.com/andrelux-ua/goit-react-hw-08/blob/main/src/redux/contacts/operations.js"
    click CONTACTS_SEL "https://github.com/andrelux-ua/goit-react-hw-08/blob/main/src/redux/contacts/selectors.js"
    click FILTERS_SLICE "https://github.com/andrelux-ua/goit-react-hw-08/blob/main/src/redux/filters/slice.js"
    click FILTERS_SEL "https://github.com/andrelux-ua/goit-react-hw-08/blob/main/src/redux/filters/selectors.js"
    click DEMO "https://github.com/andrelux-ua/goit-react-hw-08/tree/main/my-app/src"

    %% Styles
    classDef infra fill:#cccccc,stroke:#333,stroke-width:1px;
    classDef client fill:#ddddff,stroke:#333,stroke-width:1px;
    classDef app fill:#bbbbee,stroke:#333,stroke-width:1px;
    classDef ui fill:#aaddff,stroke:#333,stroke-width:1px;
    classDef state fill:#bbffbb,stroke:#333,stroke-width:1px;
    classDef network fill:#ffdd99,stroke:#333,stroke-width:1px;
    classDef external fill:#ffcc99,stroke:#333,stroke-width:1px;
    classDef demo fill:#e0e0e0,stroke:#333,stroke-width:1px;
```
