# insaneodyssey26/family-fund architecture

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

- Interactive diagram: https://gitdiagram.com/insaneodyssey26/family-fund
- Repository: https://github.com/insaneodyssey26/family-fund

## Overview

##### Project type and purpose
- This is a full-stack, single-page web application (“FamilyFund”) built with React+TypeScript on the frontend and Firebase as a Backend-as-a-Service.
- Its purpose is collaborative family financial management: secure login, resource browsing, profile management, real-time updates via Firestore, and file storage.

##### File structure
- Top-level:
- index.html, public/ → static assets served by Vite and hosting
- src/ → client application code
- src/components/ → reusable UI pieces (Navbar, Sidebar, ResourceCard, etc.)
- src/pages/ → route components (Home, Login, Resources, Profile, etc.)
- src/contexts/ → React Context providers for global state (AuthContext)
- src/services/ → wrappers around Firebase SDK (contactService, firestoreService)
- src/config/firebase.ts → Firebase initialization
- styles/ & assets → CSS Modules and static assets
- routing: React Router v6 in App.tsx
- build & deploy: Vite config + environment variables (.env.example)

##### README for additional insights
- Tech stack: React, TS, CSS Modules, React Router, Context API, Firebase (Auth, Firestore, Storage), Vite.
- Key features: authentication, real-time DB, responsive UI.

##### Elements
- Blue for UI components
- Green for state & service layers
- Orange for external services (Firebase Auth, Firestore, Storage)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Presentation Layer
    subgraph "Presentation Layer"
        direction TB
        IndexHTML["index.html"]:::static
        PublicAssets["public/"]:::static
        MainEntry["src/main.tsx"]:::static
        ViteEnv["src/vite-env.d.ts"]:::static
    end

    %% UI Layer
    subgraph "UI Layer" 
        direction TB
        subgraph "Shared Layout & Navigation"
            direction TB
            Navbar["Navbar"]:::ui
            Sidebar["Sidebar"]:::ui
            Layout["Layout"]:::ui
            Logo["Logo"]:::ui
            ScrollProgress["ScrollProgressLine"]:::ui
            WelcomePopup["WelcomePopup"]:::ui
        end
        subgraph "Resource Display"
            direction TB
            ResourceCard["ResourceCard"]:::ui
            FeaturedResources["FeaturedResources"]:::ui
        end
        subgraph "Routing & Pages"
            direction TB
            AppRouter["App.tsx (Router)"]:::ui
            HomePage["Home"]:::ui
            ResourcesPage["Resources"]:::ui
            ResourceDetail["ResourceDetail"]:::ui
            CategoryResources["CategoryResources"]:::ui
            RegisterResource["RegisterResource"]:::ui
            ContactPage["Contact"]:::ui
            AboutPage["About"]:::ui
            Instructors["Instructors"]:::ui
            InstructorDetail["InstructorDetail"]:::ui
            ProfilePage["Profile"]:::ui
            LoginPage["Login"]:::ui
            RegisterPage["Register"]:::ui
            SignupPage["Signup"]:::ui
            NotFound["NotFound"]:::ui
        end
    end

    %% State & Service Layer
    subgraph "Application Layer"
        direction TB
        AuthContext["AuthContext"]:::state
        subgraph "Service Abstractions"
            direction TB
            FirestoreService["firestoreService"]:::service
            ContactService["contactService"]:::service
        end
    end

    %% Configuration & Build
    subgraph "Configuration & Build"
        direction TB
        FirebaseConfig["firebase.ts"]:::config
        EnvExample[".env.example"]:::config
        ViteConfig["vite.config.ts"]:::config
    end

    %% Backend & Hosting
    subgraph "Backend & Hosting"
        direction TB
        FirebaseAuth["Firebase Auth"]:::external
        FirestoreDB["Firestore"]:::external
        FirebaseStorage["Storage"]:::external
        Hosting["Hosting/CDN"]:::external
    end

    %% Connections
    IndexHTML -->|served to| MainEntry
    PublicAssets -->|assets for| MainEntry
    MainEntry -->|mounts| AppRouter
    AppRouter -->|renders| Navbar
    AppRouter -->|renders| Sidebar
    AppRouter -->|routes to| HomePage
    AppRouter -->|routes to| ResourcesPage
    AppRouter -->|routes to| ResourceDetail
    AppRouter -->|routes to| CategoryResources
    AppRouter -->|routes to| RegisterResource
    AppRouter -->|routes to| ContactPage
    AppRouter -->|routes to| AboutPage
    AppRouter -->|routes to| Instructors
    AppRouter -->|routes to| InstructorDetail
    AppRouter -->|routes to| ProfilePage
    AppRouter -->|routes to| LoginPage
    AppRouter -->|routes to| RegisterPage
    AppRouter -->|routes to| SignupPage
    AppRouter -->|routes to| NotFound

    HomePage -->|uses| ResourceCard
    HomePage -->|uses| FeaturedResources

    Navbar -->|uses| Logo
    Navbar -->|uses| ScrollProgress
    HomePage -->|may show| WelcomePopup

    AppRouter -->|provides| AuthContext
    AuthContext -->|provides state to| HomePage
    AuthContext -->|provides state to| ProfilePage
    AuthContext -->|provides state to| LoginPage

    HomePage -->|calls| FirestoreService
    ResourcesPage -->|calls| FirestoreService
    ResourceDetail -->|calls| FirestoreService
    CategoryResources -->|calls| FirestoreService
    RegisterResource -->|calls| FirestoreService
    ContactPage -->|calls| ContactService

    FirestoreService -->|SDK init via| FirebaseConfig
    ContactService -->|SDK init via| FirebaseConfig
    FirebaseConfig -->|reads| EnvExample
    ViteConfig -->|builds| MainEntry

    FirestoreService -->|reads/writes| FirestoreDB
    ContactService -->|sends email via| FirebaseAuth
    FirestoreDB <-->|"real-time onSnapshot"| HomePage
    RegisterResource -->|uploads files to| FirebaseStorage

    Hosting -->|serves| IndexHTML
    Hosting -->|serves| PublicAssets
    Hosting -->|deploys| ViteConfig

    %% Click Events
    click IndexHTML "https://github.com/insaneodyssey26/family-fund/blob/main/index.html"
    click PublicAssets "https://github.com/insaneodyssey26/family-fund/tree/main/public/"
    click MainEntry "https://github.com/insaneodyssey26/family-fund/blob/main/src/main.tsx"
    click ViteEnv "https://github.com/insaneodyssey26/family-fund/blob/main/src/vite-env.d.ts"
    click Navbar "https://github.com/insaneodyssey26/family-fund/blob/main/src/components/Navbar.tsx"
    click Sidebar "https://github.com/insaneodyssey26/family-fund/blob/main/src/components/Sidebar.tsx"
    click Layout "https://github.com/insaneodyssey26/family-fund/blob/main/src/components/Layout.tsx"
    click Logo "https://github.com/insaneodyssey26/family-fund/blob/main/src/components/Logo.tsx"
    click ScrollProgress "https://github.com/insaneodyssey26/family-fund/blob/main/src/components/ScrollProgressLine.tsx"
    click WelcomePopup "https://github.com/insaneodyssey26/family-fund/blob/main/src/components/WelcomePopup.tsx"
    click ResourceCard "https://github.com/insaneodyssey26/family-fund/blob/main/src/components/ResourceCard.tsx"
    click FeaturedResources "https://github.com/insaneodyssey26/family-fund/blob/main/src/components/FeaturedResources.tsx"
    click AppRouter "https://github.com/insaneodyssey26/family-fund/blob/main/src/App.tsx"
    click HomePage "https://github.com/insaneodyssey26/family-fund/blob/main/src/pages/Home.tsx"
    click ResourcesPage "https://github.com/insaneodyssey26/family-fund/blob/main/src/pages/Resources.tsx"
    click ResourceDetail "https://github.com/insaneodyssey26/family-fund/blob/main/src/pages/ResourceDetail.tsx"
    click CategoryResources "https://github.com/insaneodyssey26/family-fund/blob/main/src/pages/CategoryResources.tsx"
    click RegisterResource "https://github.com/insaneodyssey26/family-fund/blob/main/src/pages/RegisterResource.tsx"
    click ContactPage "https://github.com/insaneodyssey26/family-fund/blob/main/src/pages/Contact.tsx"
    click AboutPage "https://github.com/insaneodyssey26/family-fund/blob/main/src/pages/About.tsx"
    click Instructors "https://github.com/insaneodyssey26/family-fund/blob/main/src/pages/Instructors.tsx"
    click InstructorDetail "https://github.com/insaneodyssey26/family-fund/blob/main/src/pages/InstructorDetail.tsx"
    click ProfilePage "https://github.com/insaneodyssey26/family-fund/blob/main/src/pages/Profile.tsx"
    click LoginPage "https://github.com/insaneodyssey26/family-fund/blob/main/src/pages/Login.tsx"
    click RegisterPage "https://github.com/insaneodyssey26/family-fund/blob/main/src/pages/Register.tsx"
    click SignupPage "https://github.com/insaneodyssey26/family-fund/blob/main/src/pages/Signup.tsx"
    click NotFound "https://github.com/insaneodyssey26/family-fund/blob/main/src/pages/NotFound.tsx"
    click AuthContext "https://github.com/insaneodyssey26/family-fund/blob/main/src/contexts/AuthContext.tsx"
    click FirestoreService "https://github.com/insaneodyssey26/family-fund/blob/main/src/services/firestoreService.ts"
    click ContactService "https://github.com/insaneodyssey26/family-fund/blob/main/src/services/contactService.ts"
    click FirebaseConfig "https://github.com/insaneodyssey26/family-fund/blob/main/src/config/firebase.ts"
    click EnvExample "https://github.com/insaneodyssey26/family-fund/blob/main/.env.example"
    click ViteConfig "https://github.com/insaneodyssey26/family-fund/blob/main/vite.config.ts"

    %% Styles
    classDef ui fill:#D0E8FF,stroke:#007BFF,color:#000
    classDef state fill:#DFFFE0,stroke:#28A745,color:#000
    classDef service fill:#E8FFE8,stroke:#20C997,color:#000
    classDef config fill:#FFF4D0,stroke:#FFC107,color:#000
    classDef static fill:#F0F0F0,stroke:#6C757D,color:#000
    classDef external fill:#FFE8D0,stroke:#FD7E14,color:#000
```
