# pranav-kunjir/simplechat architecture

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

- Interactive diagram: https://gitdiagram.com/pranav-kunjir/simplechat
- Repository: https://github.com/pranav-kunjir/simplechat

## Overview

##### Project type and purpose
- This is a full-stack web application scaffolded with “npm create convex” using React on the frontend, Vite as the build and dev server, Tailwind for styling, and Convex for backend data storage, server logic, and authentication.
- The README outlines that Convex provides both the database and serverless functions, plus an integrated “Convex Auth” flow.

##### File structure
Top-level files and folders:
- src/ : React app code (App.tsx, UI components, CSS, entry point main.tsx)
- public/ & index.html : static assets and HTML template
- convex/ : backend logic
- schema.ts (database schema)
- myFunctions.ts (serverless mutation/queries)
- auth.ts & auth.config.ts (authentication)
- http.ts (optional custom HTTP endpoints)
- _generated/ (Convex-generated TypeScript bindings for API and server)
- setup.mjs, package.json, tsconfig*.json, vite.config.ts : build, type, and deployment configuration

##### README for additional insights
- Technology stack confirmed: React + Vite + Tailwind + Convex + Convex Auth
- No other microservices or external APIs are mentioned, so this is a single back-end service provided by Convex.

##### Detail without overcomplicating
- How Convex Auth integrates alongside standard function calls
- Avoid drawing every UI component; group them under “React UI” but list major pages (signin.tsx, chatSidebar.tsx, messages.tsx)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    subgraph "Frontend Layer"
        direction TB
        Browser["User Browser"]:::frontend
        subgraph "Vite Dev Server / Static Host"
            direction TB
            ViteConfig["vite.config.ts"]:::frontend
            IndexHTML["index.html"]:::frontend
            PublicDir["public/"]:::frontend
        end
        subgraph "React SPA (src/)"
            direction TB
            Main["main.tsx"]:::frontend
            App["App.tsx"]:::frontend
            Sidebar["chatSidebar.tsx"]:::frontend
            MessagesFE["messages.tsx"]:::frontend
            SigninFE["signin.tsx"]:::frontend
        end
        subgraph "Styling (Tailwind CSS)"
            direction TB
            IndexCSS["index.css"]:::frontend
            SigninCSS["signin.css"]:::frontend
        end
        Browser -->|"loads index.html"| IndexHTML
        IndexHTML -->|"serves assets"| PublicDir
        Browser --> ViteConfig
        ViteConfig --> Main
        Main --> App
        App --> Sidebar
        App --> MessagesFE
        App --> SigninFE
        App --> IndexCSS
        SigninFE --> SigninCSS
        App -->|"uses client"| ConvexClient
    end

    %% API Bindings
    subgraph "Client–Server Contract"
        direction TB
        ConvexClient["Convex Client Bindings"]:::contract
        APIJS["api.js"]:::contract
        APITS["api.d.ts"]:::contract
        ServerJS["server.js"]:::contract
        ServerTS["server.d.ts"]:::contract
        DataModel["dataModel.d.ts"]:::contract
    end
    ConvexClient --> APIJS
    ConvexClient --> APITS
    ConvexClient --> ServerJS
    ConvexClient --> ServerTS
    ConvexClient --> DataModel

    %% Backend Layer
    subgraph "Backend Layer"
        direction TB
        subgraph "Convex Serverless Functions"
            direction TB
            Functions["myFunctions.ts"]:::logic
        end
        subgraph "Convex HTTP Endpoints"
            direction TB
            HTTP["http.ts"]:::logic
        end
        subgraph "Convex Auth Engine"
            direction TB
            AuthBoot["auth.ts"]:::auth
            AuthConfig["auth.config.ts"]:::auth
        end
        subgraph "Convex Database"
            direction TB
            Schema["schema.ts"]:::persistence
        end
        ConvexClient --> Functions
        ConvexClient --> HTTP
        ConvexClient --> AuthBoot
        Functions --> Schema
        HTTP --> Schema
        AuthBoot --> Schema
        AuthBoot -->|"issues tokens"| App
    end

    %% Click Events
    click ViteConfig "https://github.com/pranav-kunjir/simplechat/blob/main/vite.config.ts"
    click IndexHTML "https://github.com/pranav-kunjir/simplechat/blob/main/index.html"
    click PublicDir "https://github.com/pranav-kunjir/simplechat/tree/main/public/"
    click Main "https://github.com/pranav-kunjir/simplechat/blob/main/src/main.tsx"
    click App "https://github.com/pranav-kunjir/simplechat/blob/main/src/App.tsx"
    click Sidebar "https://github.com/pranav-kunjir/simplechat/blob/main/src/chatSidebar.tsx"
    click MessagesFE "https://github.com/pranav-kunjir/simplechat/blob/main/src/messages.tsx"
    click SigninFE "https://github.com/pranav-kunjir/simplechat/blob/main/src/signin.tsx"
    click IndexCSS "https://github.com/pranav-kunjir/simplechat/blob/main/src/index.css"
    click SigninCSS "https://github.com/pranav-kunjir/simplechat/blob/main/src/signin.css"
    click Schema "https://github.com/pranav-kunjir/simplechat/blob/main/convex/schema.ts"
    click Functions "https://github.com/pranav-kunjir/simplechat/blob/main/convex/myFunctions.ts"
    click HTTP "https://github.com/pranav-kunjir/simplechat/blob/main/convex/http.ts"
    click AuthBoot "https://github.com/pranav-kunjir/simplechat/blob/main/convex/auth.ts"
    click AuthConfig "https://github.com/pranav-kunjir/simplechat/blob/main/convex/auth.config.ts"
    click APIJS "https://github.com/pranav-kunjir/simplechat/blob/main/convex/_generated/api.js"
    click APITS "https://github.com/pranav-kunjir/simplechat/blob/main/convex/_generated/api.d.ts"
    click ServerJS "https://github.com/pranav-kunjir/simplechat/blob/main/convex/_generated/server.js"
    click ServerTS "https://github.com/pranav-kunjir/simplechat/blob/main/convex/_generated/server.d.ts"
    click DataModel "https://github.com/pranav-kunjir/simplechat/blob/main/convex/_generated/dataModel.d.ts"

    %% Styles
    classDef frontend fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef logic fill:#90EE90,stroke:#333,stroke-width:1px
    classDef persistence fill:#FFA500,stroke:#333,stroke-width:1px
    classDef auth fill:#DDA0DD,stroke:#333,stroke-width:1px
    classDef contract fill:#D3D3D3,stroke:#333,stroke-width:1px
```
