# tanmay-pathak/sprint-name architecture

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

- Interactive diagram: https://gitdiagram.com/tanmay-pathak/sprint-name
- Repository: https://github.com/tanmay-pathak/sprint-name

## Overview

##### Main Components
- Frontend Client:
- Located primarily in the “src” directory (with components such as Race2D.tsx and SprintNameInput.tsx).
- Built with React (using the React 19 library), TypeScript, and Vite for rapid development.
- Responsibilities include rendering the interactive race, handling user interactions (input of sprint names, starting races, etc.), and displaying animations with CSS and Canvas Confetti.
- Public/Static Assets:
- "index.html", "public", and various CSS files serve as the entry point and styling for the application.
- Backend (Convex Service):
- Housed in the “convex” directory with code files for schemas, winners, sprintNames, and auto-generated API files.
- Manages persistent storage of race results, sprint name suggestions, and real-time updates.
- Uses Convex for state management, user session handling, and ensuring data consistency across clients.
- Build and Configuration Files:
- Files like package.json, tsconfig.json, vite.config.ts, and others indicate the build process, environment configuration, and compilation of both frontend and backend code.

##### Relationships and Interactions
- The Frontend communicates with the Convex backend via API calls or real-time subscriptions:
- User inputs in the frontend (sprint names, race start events) are sent to the backend.
- The backend processes the data, stores race results, and pushes real-time updates back to all connected clients.
- The application may also load initial data (such as previous winners and race history) from the Convex backend at startup.
- The overall system thus follows a client-server pattern where the client (browser) renders UI components and subscribes to live events, while the backend (Convex) manages data, persistence, and real-time synchronization.

##### Architectural Patterns and Technologies
- Full-Stack Separation: Clear decoupling between the frontend (React/Vite) and the backend (Convex) with defined interfaces/APIs.
- Real-Time Data Flow: Use of Convex to provide real-time updates, ensuring a synchronized experience for multiple users.
- Modular Design: The frontend splits the UI into modular React components, and the backend organizes domain-specific functionality (e.g., handling sprint names, race results) in separate files.
- Modern Web Development: Integration of TypeScript for type safety, Vite for fast builds, and cutting-edge UI effects (Canvas Confetti).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Client Subgraph
    subgraph "Frontend Client"
        direction TB
        A["Application Shell<br/>(src/App.tsx & src/main.tsx)"]:::frontend
        subgraph "React Components"
            direction TB
            B["Race2D Component<br/>(Race2D.tsx)"]:::frontend
            C["SprintNameInput Component<br/>(SprintNameInput.tsx)"]:::frontend
        end
        D["Styles & Animations<br/>(CSS & Canvas Confetti)"]:::frontend
        E["Static Assets<br/>(index.html & public)"]:::asset
    end

    %% Convex Backend Service Subgraph
    subgraph "Convex Backend Service"
        direction TB
        F["Backend Core<br/>(schema.ts, sprintNames.ts, winners.ts)"]:::backend
        G["Auto-Generated API & Models<br/>(_generated)"]:::backend
    end

    %% Build & Configuration Files Node
    H["Build & Configuration Files<br/>(package.json, tsconfig.json, etc.)"]:::build

    %% Interactions
    %% User interactions from Frontend initiating API Requests to backend
    A -->|"APIRequest"| F
    B -->|"APIRequest"| F
    C -->|"APIRequest"| F
    %% Real-time updates from Backend to React Components
    F -->|"RealTimeUpdate"| B
    F -->|"RealTimeUpdate"| C
    %% Build process influence to both Frontend and Backend
    H ---|"Build/Deploy"| A
    H ---|"Build/Deploy"| F

    %% Click Events
    click A "https://github.com/tanmay-pathak/sprint-name/blob/main/src/App.tsx"
    click B "https://github.com/tanmay-pathak/sprint-name/tree/main/src/components"
    click C "https://github.com/tanmay-pathak/sprint-name/tree/main/src/components"
    click D "https://github.com/tanmay-pathak/sprint-name/blob/main/src/App.css"
    click E "https://github.com/tanmay-pathak/sprint-name/blob/main/index.html"
    click F "https://github.com/tanmay-pathak/sprint-name/tree/main/convex"
    click G "https://github.com/tanmay-pathak/sprint-name/tree/main/convex/_generated"
    click H "https://github.com/tanmay-pathak/sprint-name/blob/main/package.json"

    %% Styles
    classDef frontend fill:#cfe2f3,stroke:#1a1a1a,stroke-width:2px;
    classDef backend fill:#f4cccc,stroke:#1a1a1a,stroke-width:2px;
    classDef build fill:#d9ead3,stroke:#1a1a1a,stroke-width:2px;
    classDef asset fill:#fff2cc,stroke:#1a1a1a,stroke-width:2px;
```
