# anupamgupt/notes-app architecture

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

- Interactive diagram: https://gitdiagram.com/anupamgupt/notes-app
- Repository: https://github.com/anupamgupt/notes-app

## Overview

##### Project Type and Purpose
- This is a single-page React application bootstrapped with Create React App.
- It serves as a notes-taking PWA, using Redux Toolkit for state management and Firebase (Hosting and Firestore/Auth) as its back end.

##### File Structure
- Top-level directories:
- public/ – static HTML, manifest.json (PWA), robots.txt
- src/ – React code split into components, assets, configuration, and global state (Redux slices).
- Key files/config:
- src/config/firebase.js – initializes Firebase services (Auth, Firestore).
- .github/workflows/*.yml – CI/CD pipelines that deploy to Firebase Hosting on PR merges.
- firebase.json, .firebaserc – Firebase Hosting configuration.

##### Extract Insights from README
- Default Create React App scripts: start, test, build, eject.
- No custom architecture details here, so rely on file structure for components/services boundaries.

##### Main Components & Their Interactions
a.   User’s Browser (Client)
- Loads index.html → bundles built by Webpack (via npm run build).
- Executes App.js, rendering React component tree.
b.   Presentation Layer (React Components)
- Landing, Navbar, NotesCard, MakeNotes, EditNotes, SingleCard, Pagination, Error.
- Each component triggers Redux actions for user events (add, fetch, update, delete notes).
c.   State Management (Redux Toolkit)
- store.jsx configures slices: AllnotesSlice, addNotesSlice, updateSlice, paginationSlice, modeSlice, errorSlice.
- Action → Reducer → Updated state → Triggers re-render of subscribed components.
d.   Service Layer (Firebase SDK)
- src/config/firebase.js exports initialized Firestore and Auth instances.
- Asynchronous calls to Firestore handle persistence (CRUD operations on notes).
e.   External Services
- Firebase Firestore: document database storing notes, possibly user data.
- Firebase Hosting: serves static assets and index.html.
- (Optionally) Firebase Auth: if user sign-in is enabled.
f.   CI/CD Pipeline
- GitHub Actions workflows watch for PR merges to main.
- On successful build, deploy contents of build/ to Firebase Hosting.

##### Architectural Patterns & Design Principles
- Container/Presenter separation: State lives in Redux, UI in presentational components.
- Unidirectional data flow: React → Redux actions → Reducers → State → React.
- PWA manifest enables offline support.
- CI/CD as code (GitHub Actions) automates build & deploy.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% CI/CD Layer
    subgraph "CI/CD (GitHub Actions)"
        direction TB
        PR_Pipeline{"Pull Request Pipeline"}:::ci
        Merge_Pipeline{"Merge to Main Pipeline"}:::ci
        PR_Pipeline -->|"on PR"| Merge_Pipeline
        click PR_Pipeline "https://github.com/anupamgupt/notes-app/blob/master/.github/workflows/firebase-hosting-pull-request.yml"
        click Merge_Pipeline "https://github.com/anupamgupt/notes-app/blob/master/.github/workflows/firebase-hosting-merge.yml"
    end

    Merge_Pipeline -->|"build & deploy"| FirebaseHosting

    %% Hosting & CDN Layer
    subgraph "Hosting & CDN (Firebase)" 
        direction TB
        FirebaseHosting([Cloud: Firebase Hosting]):::external
        click FirebaseHosting "https://github.com/anupamgupt/notes-app/blob/master/firebase.json"
        click FirebaseHosting "https://github.com/anupamgupt/notes-app/blob/master/.firebaserc"
    end

    FirebaseHosting -->|serves| Browser

    %% Client Application Layer
    subgraph "Client Application (Browser)" 
        direction TB
        Browser([User's Browser]):::ui
        IndexHTML["index.html"]:::ui
        click IndexHTML "https://github.com/anupamgupt/notes-app/blob/master/public/index.html"
        Manifest["manifest.json"]:::ui
        click Manifest "https://github.com/anupamgupt/notes-app/blob/master/public/manifest.json"
        Browser -->|loads| IndexHTML
        Browser -->|loads| Manifest
        IndexHTML -->|bootstraps| ReactRoot
    end

    %% React Application Layer
    subgraph "React Application" 
        direction TB
        ReactRoot(["src/index.js"]):::ui
        click ReactRoot "https://github.com/anupamgupt/notes-app/blob/master/src/index.js"
        AppJS(["src/App.js"]):::ui
        click AppJS "https://github.com/anupamgupt/notes-app/blob/master/src/App.js"
        AppCSS(["src/App.css"]):::ui
        click AppCSS "https://github.com/anupamgupt/notes-app/blob/master/src/App.css"
        ReactRoot -->|renders| AppJS
        AppJS -->|styles| AppCSS

        subgraph "Presentation Components" 
            direction TB
            Landing["Landing.jsx"]:::ui
            click Landing "https://github.com/anupamgupt/notes-app/blob/master/src/components/landing/Landing.jsx"
            Navbar["Navbar.jsx"]:::ui
            click Navbar "https://github.com/anupamgupt/notes-app/blob/master/src/components/navbar/Navbar.jsx"
            NotesCard["NotesCard.jsx"]:::ui
            click NotesCard "https://github.com/anupamgupt/notes-app/blob/master/src/components/notesCards/NotesCard.jsx"
            MakeNotes["MakeNotes.jsx"]:::ui
            click MakeNotes "https://github.com/anupamgupt/notes-app/blob/master/src/components/makeNotes/MakeNotes.jsx"
            EditNotes["EditNotes.jsx"]:::ui
            click EditNotes "https://github.com/anupamgupt/notes-app/blob/master/src/components/editNotes/EditNotes.jsx"
            SingleCard["SingleCard.jsx"]:::ui
            click SingleCard "https://github.com/anupamgupt/notes-app/blob/master/src/components/singleCard/SingleCard.jsx"
            Pagination["Pagination.jsx"]:::ui
            click Pagination "https://github.com/anupamgupt/notes-app/blob/master/src/components/pagination/Pagination.jsx"
            ErrorComp["Error.jsx"]:::ui
            click ErrorComp "https://github.com/anupamgupt/notes-app/blob/master/src/error/Error.jsx"
            AppJS --> Landing
            AppJS --> Navbar
            AppJS --> NotesCard
            AppJS --> MakeNotes
            AppJS --> EditNotes
            AppJS --> SingleCard
            AppJS --> Pagination
            AppJS --> ErrorComp
        end

        subgraph "Component Styles" 
            direction TB
            LCSS["landing.css"]:::ui
            click LCSS "https://github.com/anupamgupt/notes-app/blob/master/src/components/landing/landing.css"
            NavCSS["navbar.css"]:::ui
            click NavCSS "https://github.com/anupamgupt/notes-app/blob/master/src/components/navbar/navbar.css"
            NCSS["notesCard.css"]:::ui
            click NCSS "https://github.com/anupamgupt/notes-app/blob/master/src/components/notesCards/notesCard.css"
            MCSS["makeNotes.css"]:::ui
            click MCSS "https://github.com/anupamgupt/notes-app/blob/master/src/components/makeNotes/makeNotes.css"
            ECSS["editNotes.css"]:::ui
            click ECSS "https://github.com/anupamgupt/notes-app/blob/master/src/components/editNotes/editnotes.css"
            SCCSS["singleCard.css"]:::ui
            click SCCSS "https://github.com/anupamgupt/notes-app/blob/master/src/components/singleCard/singleCard.css"
            PCSS["pagination.css"]:::ui
            click PCSS "https://github.com/anupamgupt/notes-app/blob/master/src/components/pagination/pagination.css"
            ErrCSS["error.css"]:::ui
            click ErrCSS "https://github.com/anupamgupt/notes-app/blob/master/src/error/error.css"
        end
    end

    %% State Management Layer
    subgraph "State Management (Redux)" 
        direction TB
        Store["store.jsx"]:::state
        click Store "https://github.com/anupamgupt/notes-app/blob/master/src/store/store.jsx"
        AllNotes["AllnotesSlice.jsx"]:::state
        click AllNotes "https://github.com/anupamgupt/notes-app/blob/master/src/store/AllnotesSlice.jsx"
        AddNotes["addNotesSlice.jsx"]:::state
        click AddNotes "https://github.com/anupamgupt/notes-app/blob/master/src/store/addNotesSlice.jsx"
        UpdateNotes["updateSlice.jsx"]:::state
        click UpdateNotes "https://github.com/anupamgupt/notes-app/blob/master/src/store/updateSlice.jsx"
        PaginationSlice["paginationSlice.jsx"]:::state
        click PaginationSlice "https://github.com/anupamgupt/notes-app/blob/master/src/store/paginationSlice.jsx"
        ModeSlice["modeSlice.jsx"]:::state
        click ModeSlice "https://github.com/anupamgupt/notes-app/blob/master/src/store/modeSlice.jsx"
        ErrorSlice["errorSlice.jsx"]:::state
        click ErrorSlice "https://github.com/anupamgupt/notes-app/blob/master/src/store/errorSlice.jsx"
        AppJS -->|dispatch actions| Store
        Store --> AllNotes
        Store --> AddNotes
        Store --> UpdateNotes
        Store --> PaginationSlice
        Store --> ModeSlice
        Store --> ErrorSlice
        AllNotes -->|updates| AppJS
    end

    %% Service Layer
    subgraph "Service Layer (Firebase SDK)" 
        direction TB
        FirebaseConfig(["firebase.js"]):::external
        click FirebaseConfig "https://github.com/anupamgupt/notes-app/blob/master/src/config/firebase.js"
        Store -->|calls SDK| FirebaseConfig
    end

    %% Data Services Layer
    subgraph "Data Services (Firebase)" 
        direction TB
        Firestore[(Firestore)]:::external
        Auth([Auth]):::external
        FirebaseConfig -->|CRUD calls| Firestore
        FirebaseConfig -->|Auth calls| Auth
        Firestore -->|responses| Store
    end

    %% Assets
    Assets(["images.js"]):::ui
    click Assets "https://github.com/anupamgupt/notes-app/blob/master/src/assets/images/images.js"
    AppJS --> Assets

    %% Metadata & Gitignore
    subgraph "Repo Configuration"
        direction TB
        Readme["README.md"]:::external
        click Readme "https://github.com/anupamgupt/notes-app/blob/master/README.md"
        Gitignore[".gitignore"]:::external
        click Gitignore "https://github.com/anupamgupt/notes-app/blob/master/.gitignore"
    end

    %% Styles
    classDef ui fill:#cce5ff,stroke:#004085,color:#004085;
    classDef state fill:#fff3cd,stroke:#856404,color:#856404;
    classDef external fill:#d4edda,stroke:#155724,color:#155724;
    classDef ci fill:#ffe5b4,stroke:#b5651d,color:#b5651d;
```
