# geovanex24/react-calendar-app architecture

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

- Interactive diagram: https://gitdiagram.com/geovanex24/react-calendar-app
- Repository: https://github.com/geovanex24/react-calendar-app

## Overview

##### Project Type and Purpose
- This is a single‐page React/Vite “Calendar App” that provides user authentication and calendar event management.
- It doesn’t include its own backend; instead it talks to an external calendar API (configured via `.env`) and handles state and UI entirely in the browser.

##### File Structure Analysis
- Top-level:
- index.html & public/ – static assets and HTML template served by Vite
- vite.config.js, babel.config.cjs, ESLint/Jest configs – build & test pipeline
- package.json – lists dependencies (React, React Router, Redux Toolkit, etc.)
- src/:
- main.jsx – React entrypoint
- router/AppRouter.jsx – defines routes (Login vs. Calendar)
- api/calendarApi.js & api/index.js – HTTP layer for external Calendar service
- auth/pages/LoginPage.jsx – login UI
- calendar/pages/CalendarPage.jsx + calendar/components – calendar UI and modals
- store/… – Redux slices for auth, calendar, ui plus root store
- hooks/… – custom hooks (useAuthStore, useCalendarStore, useUiStore, useForm)
- helpers/… – utility functions (date conversion, localization, env reading)
- tests/ – unit & integration tests organized by feature

##### Key Architectural Patterns
- SPA (Single-Page Application) using React Router for page-level routing
- Flux pattern via Redux Toolkit: domain-specific slices (auth, calendar, ui)
- Feature-based folder structure for high cohesion
- Layered separation:
- Presentation (JSX components + CSS)
- State management (Redux slices + hooks)
- Data access (API module)
- Utilities (helpers)

##### Data Flow & Interactions
1. User navigates → React Router renders LoginPage or CalendarPage
2. On login: LoginPage dispatches auth action → API call to auth endpoint → success sets token in store
3. After auth: CalendarPage mounts → dispatch fetchEvents thunk → calendarApi.getEvents → external API → events stored in calendarSlice
4. User adds/edits/deletes event → dispatch appropriate action → calendarApi call → on success update calendarSlice → UI re-renders
5. Helpers (convertToDate, calendarLocalizer) format data for the calendar component

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Browser Layer
    Browser["Browser / User Agent"]:::external
    Browser -->|"loads index.html"| HTML
    click HTML "https://github.com/geovanex24/react-calendar-app/blob/main/index.html"

    %% Config & Build Layer
    subgraph "Build & Config" 
        Vite["vite.config.js"]:::config
        Babel["babel.config.cjs"]:::config
        ESLint["eslint.config.js"]:::config
        JestConfig["jest.config.cjs"]:::config
        JestSetup["jest.setup.js"]:::config
    end
    Browser -->|"serves static assets"| Vite

    %% React Entry
    Entry["main.jsx"]:::ui
    click Entry "https://github.com/geovanex24/react-calendar-app/blob/main/src/main.jsx"
    CalendarApp["CalendarApp.jsx"]:::ui
    click CalendarApp "https://github.com/geovanex24/react-calendar-app/blob/main/src/CalendarApp.jsx"
    Browser --> Entry
    Entry --> CalendarApp

    %% Router Layer
    subgraph "Routing Layer"
        RouterIndex["router/index.js"]:::ui
        click RouterIndex "https://github.com/geovanex24/react-calendar-app/blob/main/src/router/index.js"
        AppRouter["AppRouter.jsx"]:::ui
        click AppRouter "https://github.com/geovanex24/react-calendar-app/blob/main/src/router/AppRouter.jsx"
    end
    CalendarApp --> RouterIndex
    RouterIndex --> AppRouter

    %% UI Layer
    subgraph "UI Layer" 
        LoginPage["LoginPage.jsx"]:::ui
        click LoginPage "https://github.com/geovanex24/react-calendar-app/blob/main/src/auth/pages/LoginPage.jsx"
        LoginStyles["LoginPage.css"]:::ui
        click LoginStyles "https://github.com/geovanex24/react-calendar-app/blob/main/src/auth/pages/LoginPage.css"
        CalendarPage["CalendarPage.jsx"]:::ui
        click CalendarPage "https://github.com/geovanex24/react-calendar-app/blob/main/src/calendar/pages/CalendarPage.jsx"
        subgraph "Calendar Components"
            EventItem["CalendarEvent.jsx"]:::ui
            click EventItem "https://github.com/geovanex24/react-calendar-app/blob/main/src/calendar/components/CalendarEvent.jsx"
            EventModal["CalendarModal.jsx"]:::ui
            click EventModal "https://github.com/geovanex24/react-calendar-app/blob/main/src/calendar/components/CalendarModal.jsx"
            FabAdd["FabAddNew.jsx"]:::ui
            click FabAdd "https://github.com/geovanex24/react-calendar-app/blob/main/src/calendar/components/FabAddNew.jsx"
            FabDelete["FabDelete.jsx"]:::ui
            click FabDelete "https://github.com/geovanex24/react-calendar-app/blob/main/src/calendar/components/FabDelete.jsx"
            Navbar["Navbar.jsx"]:::ui
            click Navbar "https://github.com/geovanex24/react-calendar-app/blob/main/src/calendar/components/Navbar.jsx"
        end
    end
    AppRouter --> LoginPage
    AppRouter --> CalendarPage
    CalendarPage --> EventItem
    CalendarPage --> EventModal
    CalendarPage --> FabAdd
    CalendarPage --> FabDelete
    CalendarPage --> Navbar

    %% Styles
    Styles["styles.css"]:::ui
    click Styles "https://github.com/geovanex24/react-calendar-app/blob/main/src/styles.css"
    CalendarApp --> Styles

    %% State Management Layer
    subgraph "State Management" 
        StoreInit["store/store.js"]:::state
        click StoreInit "https://github.com/geovanex24/react-calendar-app/blob/main/src/store/store.js"
        StoreIndex["store/index.js"]:::state
        click StoreIndex "https://github.com/geovanex24/react-calendar-app/blob/main/src/store/index.js"
        AuthSlice["authSlice.js"]:::state
        click AuthSlice "https://github.com/geovanex24/react-calendar-app/blob/main/src/store/auth/authSlice.js"
        CalendarSlice["calendarSlice.js"]:::state
        click CalendarSlice "https://github.com/geovanex24/react-calendar-app/blob/main/src/store/calendar/calendarSlice.js"
        UiSlice["uiSlice.js"]:::state
        click UiSlice "https://github.com/geovanex24/react-calendar-app/blob/main/src/store/ui/uiSlice.js"
        subgraph "Custom Hooks"
            AuthHook["useAuthStore.js"]:::state
            click AuthHook "https://github.com/geovanex24/react-calendar-app/blob/main/src/hooks/useAuthStore.js"
            CalendarHook["useCalendarStore.js"]:::state
            click CalendarHook "https://github.com/geovanex24/react-calendar-app/blob/main/src/hooks/useCalendarStore.js"
            UiHook["useUiStore.js"]:::state
            click UiHook "https://github.com/geovanex24/react-calendar-app/blob/main/src/hooks/useUiStore.js"
            FormHook["useForm.js"]:::state
            click FormHook "https://github.com/geovanex24/react-calendar-app/blob/main/src/hooks/useForm.js"
            HooksIndex["hooks/index.js"]:::state
            click HooksIndex "https://github.com/geovanex24/react-calendar-app/blob/main/src/hooks/index.js"
        end
    end
    CalendarPage -->|dispatch actions| StoreInit
    LoginPage -->|dispatch actions| StoreInit
    StoreInit --> StoreIndex
    StoreIndex --> AuthSlice
    StoreIndex --> CalendarSlice
    StoreIndex --> UiSlice
    AuthSlice --> AuthHook
    CalendarSlice --> CalendarHook
    UiSlice --> UiHook

    %% Helpers Layer
    subgraph "Helpers & Utilities"
        EnvVar["getEnvVariables.js"]:::helper
        click EnvVar "https://github.com/geovanex24/react-calendar-app/blob/main/src/helpers/getEnvVariables.js"
        DateConv["convertToDate.js"]:::helper
        click DateConv "https://github.com/geovanex24/react-calendar-app/blob/main/src/helpers/convertToDate.js"
        Localizer["calendarLocalizer.js"]:::helper
        click Localizer "https://github.com/geovanex24/react-calendar-app/blob/main/src/helpers/calendarLocalizer.js"
        MsgLoader["getMessages.js"]:::helper
        click MsgLoader "https://github.com/geovanex24/react-calendar-app/blob/main/src/helpers/getMessages.js"
        HelpersIndex["helpers/index.js"]:::helper
        click HelpersIndex "https://github.com/geovanex24/react-calendar-app/blob/main/src/helpers/index.js"
    end
    CalendarApi --> EnvVar
    CalendarPage --> DateConv
    CalendarPage --> Localizer

    %% API Layer
    subgraph "API Layer"
        ApiIndex["api/index.js"]:::api
        click ApiIndex "https://github.com/geovanex24/react-calendar-app/blob/main/src/api/index.js"
        CalendarApi["calendarApi.js"]:::api
        click CalendarApi "https://github.com/geovanex24/react-calendar-app/blob/main/src/api/calendarApi.js"
    end
    CalendarSlice -->|"thunks (fetchEvents, createEvent, ...)"| ApiIndex
    ApiIndex --> CalendarApi

    %% External Services
    subgraph "External Services"
        ExtCalendar["External Calendar API"]:::external
        ExtAuth["Auth Provider"]:::external
    end
    CalendarApi -->|-- call getEvents/create/update/delete --| ExtCalendar
    AuthSlice -->|-- call auth endpoint --| ExtAuth
    ExtCalendar -->|-- response events --| CalendarSlice
    ExtAuth -->|-- response token --| AuthSlice

    %% Styles
    classDef ui fill:#D0E8FF,stroke:#0C63E4,color:#000
    classDef state fill:#DFF5D1,stroke:#3C763D,color:#000
    classDef api fill:#FFE4B3,stroke:#C56F00,color:#000
    classDef external fill:#E6D5FF,stroke:#5E2A7E,color:#000
    classDef config fill:#F0F0F0,stroke:#666,color:#000
    classDef helper fill:#FFF4E5,stroke:#C77C00,color:#000
```
