# modelearth/team architecture

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

- Interactive diagram: https://gitdiagram.com/modelearth/team
- Repository: https://github.com/modelearth/team

## Overview

##### Project Type and Purpose
- MemberCommons is a full-stack JAM Stack collaboration platform.
- The frontend is purely static (HTML/CSS/vanilla JS). The backend is a Rust monolith (Actix-web + SQLx) exposing a JSON/REST API.
- It integrates a PostgreSQL database (SuiteCRM schema) and external AI services (Google Gemini) and OAuth providers for authentication.

##### File-Structure Analysis
- Top-level “css/”, “js/”, “img/”, “index.html” etc. → static frontend.
- “src/” folder with Cargo.toml and Rust files → back-end service using Actix-web.
- “admin/”, “projects/”, “preferences/” → static sub-apps or modules served by the same static host.
- “config/settings.example.js” & “.env.example” → runtime configuration for API endpoints, OAuth, DB URLs.
- “sql/” scripts → DB schema and utility SQL.
- No separate microservices—common monolith with modular Rust source files (main.rs, import.rs, recommendations.rs, insights.rs).

##### Key Insights from README
- Frontend: Static hosting, no bundler, mobile-first responsive design, pure JS modules for search, projects, surveys.
- Backend: Actix-web routes, SQLx for async Postgres, JWT + OAuth for auth.
- AI: Google Gemini queries from backend or via JS client (through backend proxy).
- DB: PostgreSQL on Azure/Google Cloud, SuiteCRM schema for contacts/projects.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Tier
    subgraph "Frontend Tier" 
        direction TB
        Browser["Client Browser\n(Desktop/Mobile)"]:::frontend
        StaticHost["Static Asset Server"]:::frontend
        AdminApp["Admin Sub-Application"]:::frontend
        ProjectsApp["Projects Sub-Application"]:::frontend
        PrefsApp["Preferences Sub-Application"]:::frontend
        ConfigStatic["settings.example.js\nnavigation.json"]:::config
    end

    %% Backend Tier
    subgraph "Backend Tier"
        direction TB
        RustService["Actix-web API\n(SQLx, serde)"]:::backend
        Router["HTTP Router & Main (main.rs)"]:::backend
        ImportModule["Data Import Module\n(import.rs)"]:::backend
        InsightsSub["AI Insights Modules"]:::backend
        ClaudeModule["claude_insights.rs"]:::backend
        GeminiModule["gemini_insights.rs"]:::backend
        RecModule["Recommendations Module\n(recommendations.rs)"]:::backend
        ConfigBackend[".env.example\nCargo.toml\nCargo.lock"]:::config
        DBLayer["Database Access Layer\n(SQLx)"]:::backend
    end

    %% Database
    DB["PostgreSQL DB\n(SuiteCRM schema)"]:::database

    %% External Services
    subgraph "External Services"
        direction TB
        GeminiAPI["Google Gemini AI Service"]:::external
        OAuth["OAuth Providers\n(Google, GitHub, LinkedIn)"]:::external
    end

    %% Connections
    Browser -->|"HTTP GET\nindex.html, CSS, JS"| StaticHost
    StaticHost --> AdminApp
    StaticHost --> ProjectsApp
    StaticHost --> PrefsApp
    StaticHost --> ConfigStatic

    Browser -->|"REST API calls (JSON)"| RustService
    RustService -->|"routes via"| Router
    Router --> ImportModule
    Router --> InsightsSub
    InsightsSub --> ClaudeModule
    InsightsSub --> GeminiModule
    Router --> RecModule
    RustService --> DBLayer
    DBLayer -->|"SQL queries"| DB

    RustService -->|"HTTP calls"| GeminiAPI
    Browser -->|"OAuth redirects"| OAuth
    RustService -->|"OAuth server-to-server"| OAuth

    ConfigStatic --> StaticHost
    ConfigBackend --> RustService

    %% Click Events
    click StaticHost "https://github.com/modelearth/team/blob/main//index.html"
    click CSS "https://github.com/modelearth/team/tree/main//css/"
    click JS "https://github.com/modelearth/team/tree/main//js/"
    click IMG "https://github.com/modelearth/team/tree/main//img/"
    click AdminApp "https://github.com/modelearth/team/tree/main//admin/"
    click ProjectsApp "https://github.com/modelearth/team/tree/main//projects/"
    click PrefsApp "https://github.com/modelearth/team/tree/main//preferences/"
    click ConfigStatic "https://github.com/modelearth/team/blob/main//config/settings.example.js"
    click ConfigStatic "https://github.com/modelearth/team/blob/main//config/navigation.json"
    click RustService "https://github.com/modelearth/team/tree/main//src/"
    click ConfigBackend "https://github.com/modelearth/team/blob/main//.env.example"
    click ConfigBackend "https://github.com/modelearth/team/blob/main//Cargo.toml"
    click ConfigBackend "https://github.com/modelearth/team/blob/main//Cargo.lock"
    click Router "https://github.com/modelearth/team/blob/main//src/main.rs"
    click ImportModule "https://github.com/modelearth/team/blob/main//src/import.rs"
    click ClaudeModule "https://github.com/modelearth/team/blob/main//src/claude_insights.rs"
    click GeminiModule "https://github.com/modelearth/team/blob/main//src/gemini_insights.rs"
    click RecModule "https://github.com/modelearth/team/blob/main//src/recommendations.rs"
    click DBLayer "https://github.com/modelearth/team/tree/main//sql/"
    click DB "https://github.com/modelearth/team/tree/main//admin/sql/"

    %% Styles
    classDef frontend fill:#d5f5e3,stroke:#1e824c,color:#1e824c;
    classDef backend fill:#d6eaf8,stroke:#2874a6,color:#2874a6;
    classDef database fill:#ebebe0,stroke:#7f8c8d,color:#7f8c8d;
    classDef external fill:#f9e79f,stroke:#d68910,color:#d68910;
    classDef config fill:#f5eef8,stroke:#8e44ad,color:#8e44ad;
```
