# r-park/todo-react-redux architecture

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

- Interactive diagram: https://gitdiagram.com/r-park/todo-react-redux
- Repository: https://github.com/r-park/todo-react-redux

## Overview

##### Project type and purpose
- This is a single-page, full-stack style web application (a Todo app) built with Create React App, React Redux, React Router, and Firebase as a backend-as-a-service.
- Its main purpose is to demonstrate a fully reactive Todo list with undo/undelete, authentication via Firebase OAuth, and real-time data persistence in Firebase Realtime Database, all wrapped up as a PWA.

##### File structure
- Top-level artifacts:
- public/ — static assets & PWA manifest
- src/ — React source code
- .firebaserc, firebase.json — Firebase project & hosting config
- circle.yml — CI configuration
- src/ is subdivided into:
- auth, tasks, notification modules (actions, reducers, selectors, tests)
- firebase/ — wrappers around Firebase SDK (config, initialization, lists)
- views/ — React components (atomic button, header, task-list, pages)
- store.js, reducers.js, history.js — Redux store setup and routing integration
- Build & deployment scripts are defined in package.json; tests co-located next to modules.

##### README for additional insights
- Confirms tech stack: CRA, React Redux, React Router, Redux Thunk, Firebase SDK, Immutable, Reselect, SASS.
- Outlines CI via CircleCI badge and deployment via Firebase CLI.
- Mentions service worker registration for PWA capabilities.

##### Elements
– UI → Dispatcher → Thunk → Firebase SDK → Database / Auth
– Database events → SDK callbacks → Reducers → UI
– Git push → CircleCI → build → Firebase deploy
– Blue for client-side (UI, store, service worker)
– Green for Firebase services
– Orange for CI/CD pipeline
– Clouds for external services

##### Detailed breakdown
- Frontend Layer:
– index.html → index.js → App component → Route components (SignInPage, TasksPage)
– Atomic UI components (button, header, task-item, etc.)
– Redux modules (auth, tasks, notification) wired into store.js
– Middleware: Redux Thunk
– Reselect selectors feeding props to components
- Backend Layer (Firebase):
– config.js loads project credentials
– firebase-list.js wraps Realtime Database CRUD
– auth.js handles user session and guards routes
- PWA Layer:
– register-service-worker.js registers the service worker generated by CRA
- CI/CD Layer:
– circle.yml defines test and build jobs
– firebase.json & .firebaserc define hosting target
- Testing:
– Spec files alongside reducers, actions, components (Jest tests)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Layer
    subgraph "Client (Browser)" 
        direction TB
        Browser["Browser / PWA"]:::client
        ServiceWorker["Service Worker"]:::client
        subgraph "React UI" 
            direction TB
            Views["Views & Components"]:::client
        end
        subgraph "Redux Store" 
            direction TB
            Store["store.js / reducers.js / history.js"]:::client
            AuthMod["Auth Module"]:::client
            TasksMod["Tasks Module"]:::client
            NotifMod["Notification Module"]:::client
        end
        subgraph "Firebase SDK Wrappers" 
            direction TB
            FirebaseWr["firebase/config.js, firebase-list.js, firebase.js, index.js"]:::client
        end
    end

    %% Firebase Backend
    subgraph "Firebase Services" 
        direction TB
        AuthService["Firebase Auth"]:::firebase
        DB["Firebase Realtime DB"]:::firebase
    end

    %% CI/CD Pipeline
    subgraph "CI/CD Pipeline"
        direction TB
        Git["Git Repo"]:::ci
        CircleCI["CircleCI"]:::ci
        Hosting["Firebase Hosting"]:::ci
    end

    %% Data Flows
    Browser -->|"loads index.html"| Views
    Views -->|"dispatch action"| AuthMod
    Views -->|"dispatch action"| TasksMod
    Views -->|"dispatch action"| NotifMod
    AuthMod -->|"calls firebase.auth()"| FirebaseWr
    TasksMod -->|"calls firebase-list"| FirebaseWr
    FirebaseWr -->|"SDK call"| AuthService
    FirebaseWr -->|"SDK call"| DB
    DB -->|"on('value') callback"| TasksMod
    AuthService -->|"onAuthStateChanged callback"| AuthMod
    Store -->|"state updates"| Views
    ServiceWorker -->|"caches assets"| Views

    Git -->|"push"| CircleCI
    CircleCI -->|"build & deploy"| Hosting
    Hosting -->|"serves app"| Browser

    %% Click Events
    click Views "https://github.com/r-park/todo-react-redux/tree/master/src/views"
    click Store "https://github.com/r-park/todo-react-redux/blob/master/src/store.js"
    click AuthMod "https://github.com/r-park/todo-react-redux/tree/master/src/auth"
    click TasksMod "https://github.com/r-park/todo-react-redux/tree/master/src/tasks"
    click NotifMod "https://github.com/r-park/todo-react-redux/tree/master/src/notification"
    click FirebaseWr "https://github.com/r-park/todo-react-redux/tree/master/src/firebase"
    click ServiceWorker "https://github.com/r-park/todo-react-redux/blob/master/src/utils/register-service-worker.js"
    click CircleCI "https://github.com/r-park/todo-react-redux/blob/master/circle.yml"
    click Hosting "https://github.com/r-park/todo-react-redux/blob/master/firebase.json"

    %% Styles
    classDef client fill:#D6EFFF,stroke:#009,stroke-width:1px
    classDef firebase fill:#DFFFE0,stroke:#080,stroke-width:1px
    classDef ci fill:#FFF0D6,stroke:#E85,stroke-width:1px
```
