# waynesutton/promptstack architecture

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

- Interactive diagram: https://gitdiagram.com/waynesutton/promptstack
- Repository: https://github.com/waynesutton/promptstack

## Overview

##### Main Components
- Frontend Client:
– Located in the “src” directory, this houses React components (e.g., App.tsx, Header.tsx, Footer.tsx) and routing logic (using TanStack Router).
– It includes UI elements, style files (Tailwind CSS), and static assets (the “public” folder).
- Backend & API Layer (Convex):
– The “convex” folder contains configuration and generated API files (e.g., api.d.ts, server.js) representing the Convex.dev backend which acts as a serverless database and business logic layer.
– This layer handles real‑time updates and data management for prompts and user interactions.
- Infrastructure & Deployment Components:
– Files like “netlify.toml” and deployment badges in the README show that Netlify is used for hosting.
– There is also a mix of configuration files (.npmrc, bun.lockb, package.json, vite.config.ts) indicating choices like Bun as a runtime and Vite as a build tool.
- External Services & Integrations:
– Authentication is handled via Clerk (as mentioned in the README).
– Other integrations include GitHub for linking profiles and potentially third‑party APIs or services for AI assistants.

##### Relationships and Interactions
- The Frontend communicates with the Convex backend to fetch and update prompt data.
- The routing layer (TanStack Router) manages client‑side navigation between pages (defined in “src/routes”).
- Static assets from the “public” folder complement the UI, while Convex’s auto‑generated API provides a clear contract between client and server.
- Authentication (via Clerk) and third‑party integrations (GitHub, AI APIs) interact with the frontend and sometimes the backend to secure and enrich the user experience.

##### Architectural Patterns & Design Principles
- Separation of Concerns:
– The clear division between “src” (frontend), “convex” (backend), and “public” assets supports modularity.
- Component‑Based UI (React):
– The UI is built in small, reusable, and well‑labeled components.
- API Contract Generation:
– The use of Convex’s auto‑generated API files helps ensure a robust communication layer between the frontend and backend.
- Serverless & Reactive Design:
– Convex.dev simplifies backend operations with real‑time updates, making the architecture both reactive and scalable.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    subgraph "Frontend Layer"
        FE1["Frontend Client (React, TanStack Router, Tailwind)"]:::frontend
        FE2["Static Assets (public)"]:::frontend
    end

    %% Backend Layer
    subgraph "Backend Layer"
        BE["Backend & API (Convex.dev)"]:::backend
    end

    %% External Services
    subgraph "External Services"
        EX1["Authentication (Clerk)"]:::external
        EX2["External Integrations (GitHub, AI)"]:::external
    end

    %% Infrastructure & Deployment
    subgraph "Infrastructure & Deployment"
        INF["Deployment & Build Tools (Netlify, Bun, Vite, Config Files)"]:::infrastructure
    end

    %% Connections
    FE1 -->|"APIcalls"| BE
    BE -->|"RealtimeUpdate"| FE1
    FE1 -->|"Auth"| EX1
    FE1 -->|"Loads"| FE2
    FE1 -->|"Integrates"| EX2
    INF -->|"HostsFrontend"| FE1
    INF -->|"HostsBackend"| BE

    %% Click Events
    click FE1 "https://github.com/waynesutton/promptstack/tree/main/src"
    click FE2 "https://github.com/waynesutton/promptstack/tree/main/public"
    click BE "https://github.com/waynesutton/promptstack/tree/main/convex"
    click INF "https://github.com/waynesutton/promptstack/blob/main/netlify.toml"

    %% Styles
    classDef frontend fill:#a2d2ff,stroke:#333,stroke-width:2px;
    classDef backend fill:#caffbf,stroke:#333,stroke-width:2px;
    classDef infrastructure fill:#ffd6a5,stroke:#333,stroke-width:2px;
    classDef external fill:#ffadad,stroke:#333,stroke-width:2px;
```
