# rohitg00/createmvp architecture

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

- Interactive diagram: https://gitdiagram.com/rohitg00/createmvp
- Repository: https://github.com/rohitg00/createmvp

## Overview

##### Project type and purpose
- This is a full‑stack AI‑powered prototype generator (CreateMVP).
- Frontend: Single‑page React/TypeScript application with Tailwind CSS and Shadcn UI for rendering a variety of pages (Chat, file viewer, rules, MCP server docs, etc.).
- Backend: Express.js in TypeScript exposes REST endpoints for plan generation, subscription management, file upload, AI orchestration, and CRUD on API keys and chat history.
- Database: PostgreSQL managed via Drizzle ORM.
- External services: Multiple AI providers (OpenAI, Anthropic, Google, etc.) plus optional Supabase alternative for database.

##### File structure
- Top‑level “client” directory holds all frontend code:
- `public` for static assets and HTML shell (index.html)
- `src` for React pages, UI components, hooks, data, lib (context, query client), and routing under `pages`.
- Top‑level “server” directory holds backend code:
- `index.ts` boots the Express server, loads `middleware/creditCheck.ts`, mounts `routes.ts`
- `routes/` subdivides endpoint handlers: `generate-plan.ts`, `subscription.ts`, etc.
- `lib/api.ts` wraps AI provider calls, `storage.ts` manages file uploads/PDF parsing.
- Configuration files: `.env.example`, `drizzle.config.ts`, `vite.config.ts`, `tailwind.config.ts`, `tsconfig.json`.
- Build tools: Vite for frontend dev/server, npm scripts to run, build, and push DB schema.

##### README for insights
- Sections confirm tech stack, deployment steps, DB schema (`api_keys`, `chat_messages`), and MCP/Windsurf contributions guidelines.
- Multi‑model AI integration, PDF upload extraction, and API key management are key features.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Layer
    subgraph "Client Layer" 
        direction TB
        Browser["User Browser"]:::external
        StaticAssets["Static Assets & HTML Shell"]:::frontend
        ReactApp["React App (Vite)"]:::frontend
        Pages["React Pages"]:::frontend
        Components["UI Components"]:::frontend
        FileViewer["File Viewer"]:::frontend
        RequirementUpload["Requirement Upload"]:::frontend
        Layout["Global Layout & Common"]:::frontend
        DataLib["Data Fetching & Context"]:::frontend
        Hooks["Hooks"]:::frontend
        Utils["Utilities & Data"]:::frontend
        Entry["Entry & Styling"]:::frontend
    end

    %% Server Layer
    subgraph "Server Layer"
        direction TB
        APIServer["Express API Server"]:::backend
        CreditCheck["Credit Check Middleware"]:::backend
        RoutesEntry["Routes Entrypoint"]:::backend
        GeneratePlan["Plan Generation Handler"]:::backend
        Subscription["Subscription Handler"]:::backend
        APIWrapper["AI Provider Orchestration"]:::backend
        Storage["File/PDF Storage & Parser"]:::backend
        EnvConfig["Environment Config (.env.example)"]:::backend
        Types["Type Definitions"]:::backend
        DrizzleConfig["Drizzle Config"]:::backend
        ViteServer["Vite Server (SSR/API)"]:::backend
    end

    %% Data & External
    subgraph "Data & External"
        direction TB
        Postgres["PostgreSQL (Drizzle ORM)"]:::datastore
        Supabase["Supabase (Optional)"]:::datastore
        OpenAI["OpenAI API"]:::external
        Anthropic["Anthropic API"]:::external
        GoogleAI["Google AI API"]:::external
    end

    %% Client interconnections
    Browser --> StaticAssets
    StaticAssets --> ReactApp
    ReactApp --> Pages
    ReactApp --> Components
    Components --> FileViewer
    Components --> RequirementUpload
    Components --> Layout
    ReactApp --> DataLib
    ReactApp --> Hooks
    ReactApp --> Utils
    ReactApp --> Entry

    click StaticAssets "https://github.com/rohitg00/createmvp/tree/main/client/public/"
    click StaticAssets "https://github.com/rohitg00/createmvp/blob/main/client/index.html"
    click ReactApp "https://github.com/rohitg00/createmvp/tree/main/client/"
    click Pages "https://github.com/rohitg00/createmvp/tree/main/client/src/pages/"
    click FileViewer "https://github.com/rohitg00/createmvp/blob/main/client/src/components/FileViewer.tsx"
    click RequirementUpload "https://github.com/rohitg00/createmvp/blob/main/client/src/components/RequirementUpload.tsx"
    click Components "https://github.com/rohitg00/createmvp/tree/main/client/src/components/"
    click Layout "https://github.com/rohitg00/createmvp/blob/main/client/src/components/Layout.tsx"
    click Components "https://github.com/rohitg00/createmvp/blob/main/client/src/components/Navbar.tsx"
    click Components "https://github.com/rohitg00/createmvp/blob/main/client/src/components/Footer.tsx"
    click DataLib "https://github.com/rohitg00/createmvp/blob/main/client/src/lib/queryClient.ts"
    click DataLib "https://github.com/rohitg00/createmvp/blob/main/client/src/lib/userContext.tsx"
    click Hooks "https://github.com/rohitg00/createmvp/blob/main/client/src/hooks/use-mobile.tsx"
    click Hooks "https://github.com/rohitg00/createmvp/blob/main/client/src/hooks/use-toast.tsx"
    click Utils "https://github.com/rohitg00/createmvp/blob/main/client/src/lib/utils.ts"
    click Utils "https://github.com/rohitg00/createmvp/tree/main/client/src/data/"
    click Entry "https://github.com/rohitg00/createmvp/blob/main/client/src/main.tsx"
    click Entry "https://github.com/rohitg00/createmvp/blob/main/client/src/index.css"
    click Entry "https://github.com/rohitg00/createmvp/blob/main/tailwind.config.ts"
    click Entry "https://github.com/rohitg00/createmvp/blob/main/postcss.config.js"
    click Entry "https://github.com/rohitg00/createmvp/blob/main/vite.config.ts"

    %% Server interconnections
    ReactApp -->|REST calls| APIServer
    APIServer --> CreditCheck
    APIServer --> RoutesEntry
    RoutesEntry --> GeneratePlan
    RoutesEntry --> Subscription
    APIServer --> APIWrapper
    APIServer --> Storage

    click APIServer "https://github.com/rohitg00/createmvp/blob/main/server/index.ts"
    click CreditCheck "https://github.com/rohitg00/createmvp/blob/main/server/middleware/creditCheck.ts"
    click RoutesEntry "https://github.com/rohitg00/createmvp/blob/main/server/routes.ts"
    click GeneratePlan "https://github.com/rohitg00/createmvp/blob/main/server/routes/generate-plan.ts"
    click Subscription "https://github.com/rohitg00/createmvp/blob/main/server/routes/subscription.ts"
    click APIWrapper "https://github.com/rohitg00/createmvp/blob/main/server/lib/api.ts"
    click Storage "https://github.com/rohitg00/createmvp/blob/main/server/storage.ts"
    click EnvConfig "https://github.com/rohitg00/createmvp/blob/main/.env.example"
    click Types "https://github.com/rohitg00/createmvp/blob/main/types.ts"
    click DrizzleConfig "https://github.com/rohitg00/createmvp/blob/main/drizzle.config.ts"
    click ViteServer "https://github.com/rohitg00/createmvp/blob/main/server/vite.ts"
    click ViteServer "https://github.com/rohitg00/createmvp/blob/main/vite.config.ts"

    %% Data & External interconnections
    APIServer -->|ORM queries| Postgres
    APIServer -->|Optional DB| Supabase
    APIWrapper --> OpenAI
    APIWrapper --> Anthropic
    APIWrapper --> GoogleAI

    click Postgres "https://github.com/rohitg00/createmvp/blob/main/drizzle.config.ts"
    click Supabase "https://github.com/rohitg00/createmvp/blob/main/.env.example"

    %% Styles
    classDef frontend fill:#D0E8FF,stroke:#0066CC,stroke-width:1px
    classDef backend fill:#DFF5D0,stroke:#339900,stroke-width:1px
    classDef datastore fill:#FFE8B0,stroke:#FF9900,stroke-width:1px
    classDef external fill:#E8D0FF,stroke:#9933CC,stroke-width:1px
```
