# sophiaullrich/futureforgeproject architecture

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

- Interactive diagram: https://gitdiagram.com/sophiaullrich/futureforgeproject
- Repository: https://github.com/sophiaullrich/futureforgeproject

## Overview

##### Project type and purpose
- This is a full-stack, web-based collaboration platform (“Go Bear Career Task Teams”) built on React (frontend) and Node.js/Express (backend), with Firebase (Auth, Firestore/Realtime DB, Cloud Messaging) as the data and identity layer. It’s hosted on Vercel. Its primary goal is to let users form teams, assign tasks, track progress, and earn gamified rewards.

##### File structure
- Top-level directories:
- frontend – React app, user interface, client-side routing, Firebase JS SDK.
- backend – Express server, REST endpoints for chat, dashboard, profile, tasks, notifications, rewards; uses Firebase Admin SDK.
- Config files: .env (secrets), vercel.json (deployment), package.json (dependencies), .gitignore
- Patterns: clear separation of concerns (API controllers, routes, services), chat uses a dedicated server module (chatServer.js), notifications routed through notification.service.js.

##### README
- Confirms React + Node.js/Express + Firebase stack.
- Mentions system architecture: “Frontend (Client), Backend (Server), Database.”

a. Main components
- User Devices (Web browsers on desktop/mobile)
- Vercel CDN & Edge Network (serves the React SPA)
- Frontend Application (React)
- Backend API Server (Node.js/Express + WebSocket)
- Firebase Services:
– Firebase Authentication
– Firestore & Realtime Database
– Firebase Cloud Messaging (FCM)
- External Dependencies (optional monitoring/logging)

b. Relationships & interactions
1. User → Vercel CDN (HTTPS GET) → React SPA
2. React SPA → Firebase Auth (JS SDK over TLS) for sign-in, token issuance
3. React SPA → Firestore/Realtime DB (JS SDK over TLS) for real-time data reads/writes (tasks, teams, rewards)
4. React SPA → Backend REST endpoints (HTTPS) for operations requiring server logic (profile, dashboard, notifications, rewards)
5. React SPA → WebSocket to Backend ChatServer for real-time team chat
6. Backend Server → Firebase Admin SDK → Firestore/Realtime DB (secure internal traffic)
7. Backend Server → Firebase Cloud Messaging API (to push notifications to clients)

c. Architectural patterns & principles
- Separation of concerns:
- UI & client logic (React) vs. server logic (Express controllers/services)
- Real-time communication (WebSocket) isolated from RESTful endpoints
- Firebase SDK on client, Admin SDK on server (principle of least privilege)
- Scalability via Vercel’s serverless functions / Edge network
- Security: HTTPS everywhere, JWT tokens from Firebase Auth, middleware authentication in Express

d. Key technologies & frameworks
- React, React Router, React Context (AuthContext)
- Express.js, socket.io (assumed)
- Firebase: Authentication, Firestore, Realtime DB, Cloud Messaging
- Hosting: Vercel (frontend & backend)

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Public Internet"
        UD["User Device"]:::client
    end

    subgraph "Vercel Edge"
        CDN["Vercel CDN/Edge"]:::edge
        SPA["React SPA"]:::client
    end

    subgraph "Vercel Serverless Functions"
        API["Express API @ Vercel"]:::server
        Chat["WebSocket ChatServer"]:::server
    end

    subgraph "Google Cloud (Firebase)"
        Auth["Firebase Authentication"]:::firebase
        DB["Firestore & Realtime DB"]:::firebase
        FCM["Firebase Cloud Messaging"]:::firebase
    end

    UD -->|"HTTPS GET"| CDN
    CDN -->|"serves SPA"| SPA

    SPA -->|"signIn/ID token"| Auth
    SPA -->|"CRUD via JS SDK"| DB
    SPA -->|"calls /profile, /tasks, /dashboard, /notifications"| API
    SPA -->|"WSS handshake & messages"| Chat

    API -->|"Admin SDK secure reads/writes"| DB
    API -->|"push notifications API"| FCM

    classDef client fill:#CCE5FF,stroke:#004085
    classDef edge fill:#D4EDDA,stroke:#155724
    classDef server fill:#FFE5B4,stroke:#FF8C00
    classDef firebase fill:#E2D7F9,stroke:#5D3FD3

    click SPA "https://github.com/sophiaullrich/futureforgeproject/blob/main/frontend/src/App.jsx"
    click Auth "https://github.com/sophiaullrich/futureforgeproject/blob/main/frontend/src/Firebase.js"
    click API "https://github.com/sophiaullrich/futureforgeproject/blob/main/backend/src/index.js"
    click Chat "https://github.com/sophiaullrich/futureforgeproject/blob/main/backend/src/chat/chatServer.js"
    click DB "https://github.com/sophiaullrich/futureforgeproject/blob/main/backend/src/firebase.js"
```
