# grevondenson/richreact architecture

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

- Interactive diagram: https://gitdiagram.com/grevondenson/richreact
- Repository: https://github.com/grevondenson/richreact

## Overview

##### Project type and purpose
- This is a React single-page application (SPA) that serves educational content (courses, eBooks, question papers, videos, etc.)
- Although it contains only front-end code, it leverages Firebase for authentication, data persistence (Firestore), and file storage.

##### File structure
- Top-level “public” folder → static assets and index.html (hosted by a static file server or Firebase Hosting).
- “src” folder → main React application:
- src/index.js, src/App.js → entry point and root component of the SPA
- src/components → all UI components (Home, Dashboard, Resources, Videos, Ebooks, etc.)
- src/contexts/AuthContext.js → React Context for user authentication state
- src/services/firestore.js, src/services/storage.js → wrappers around Firebase Firestore & Storage APIs
- src/firebase.js → Firebase SDK initialization and configuration

##### README for additional insights
- (No content in README, but package.json lists dependencies: react, react-router, firebase, etc.)

## Diagram (Mermaid)

```mermaid
flowchart TD
    direction TB

    User["User Browser"]:::user
    Host["Static Hosting / CDN"]:::hosting

    subgraph "React SPA"
        direction TB
        Entry["index.js"]:::app
        Root["App.js"]:::app

        subgraph "UI Components"
            direction TB
            Home["Home"]:::ui
            Login["Login"]:::ui
            Dashboard["Dashboard"]:::ui
            Resources["Resources"]:::ui
            Videos["Videos"]:::ui
            Ebooks["eBooks"]:::ui
            Protected["ProtectedRoute"]:::ui
        end

        subgraph "Context & Services"
            direction TB
            AuthCtx["AuthContext"]:::service
            FireSvc["FirestoreService"]:::service
            StorSvc["StorageService"]:::service
        end

        FirebaseInit["firebase.js"]:::service
    end

    subgraph "Firebase Services"
        direction TB
        Auth["Firebase Auth"]:::backend
        Firestore["Cloud Firestore"]:::database
        Storage["Cloud Storage"]:::database
    end

    User -->|"loads SPA"| Host
    Host -->|"serves index.html"| Entry
    Entry --> Root

    Root --> Home
    Root --> Login
    Root --> Dashboard
    Root --> Resources
    Root --> Videos
    Root --> Ebooks
    Root --> Protected
    Root --> FirebaseInit

    Home --> AuthCtx
    Login --> AuthCtx
    Protected --> AuthCtx
    Dashboard --> FireSvc
    Resources --> FireSvc
    Videos --> StorSvc
    Ebooks --> StorSvc

    AuthCtx -->|"signIn(), signOut()"| Auth
    FireSvc -->|"readCollection(), writeDoc()"| Firestore
    StorSvc -->|"uploadFile(), downloadFile()"| Storage

    click Entry "https://github.com/grevondenson/richreact/blob/main/src/index.js"
    click Root "https://github.com/grevondenson/richreact/blob/main/src/App.js"
    click Home "https://github.com/grevondenson/richreact/blob/main/src/components/Home.js"
    click Login "https://github.com/grevondenson/richreact/blob/main/src/components/login.js"
    click Dashboard "https://github.com/grevondenson/richreact/blob/main/src/components/Dashboard.js"
    click Resources "https://github.com/grevondenson/richreact/blob/main/src/components/Resources.js"
    click Videos "https://github.com/grevondenson/richreact/blob/main/src/components/video.js"
    click Ebooks "https://github.com/grevondenson/richreact/blob/main/src/components/Ebooks.js"
    click Protected "https://github.com/grevondenson/richreact/blob/main/src/components/ProtectedRoute.js"
    click AuthCtx "https://github.com/grevondenson/richreact/blob/main/src/contexts/AuthContext.js"
    click FirebaseInit "https://github.com/grevondenson/richreact/blob/main/src/firebase.js"
    click FireSvc "https://github.com/grevondenson/richreact/blob/main/src/services/firestore.js"
    click StorSvc "https://github.com/grevondenson/richreact/blob/main/src/services/storage.js"
    click Host "https://github.com/grevondenson/richreact/blob/main/public/index.html"

    classDef ui fill:#D0E8F2,stroke:#333,color:#000
    classDef service fill:#DFF2BF,stroke:#333,color:#000
    classDef backend fill:#F4A460,stroke:#333,color:#000
    classDef database fill:#FFD700,stroke:#333,color:#000
    classDef hosting fill:#DDDDDD,stroke:#333,color:#000
    classDef app fill:#AFCBFF,stroke:#333,color:#000
    classDef user fill:#CCCCCC,stroke:#333,color:#000
```
