# rizanmohd030/genai-resume-assistant architecture

> Architecture diagram of the GitHub repository rizanmohd030/genai-resume-assistant, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-03-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rizanmohd030/genai-resume-assistant
- Repository: https://github.com/rizanmohd030/genai-resume-assistant

## Overview

##### Project type & purpose (from file tree)
This is a **single-page web application** built with **React + TypeScript** using **Vite** as the build tool and **TailwindCSS** for styling. It includes an **API layer** (`api/generate.ts`) and an LLM integration service (`services/geminiService.ts`), so the app’s core purpose is very likely:

- Collect user input (prompt / parameters)
- Call a backend “generate” endpoint
- That endpoint calls **Google Gemini** (or a Gemini-compatible API)
- Render the generated output in the UI
- It likely supports user-provided API keys (hint: `components/ApiKeyPrompt.tsx`)

Because the README is empty, the **file names and layout are the primary source of truth**.

##### Client (Browser / React SPA)
Key files:
- `index.html`, `index.tsx` (entry)
- `App.tsx` (top-level composition)
- `index.css`, `tailwind.config.cjs`, `postcss.config.cjs` (styling pipeline)

UI components (all under `components/`):
- `Header.tsx`, `Footer.tsx` (layout)
- `InputSection.tsx` (prompt input + settings)
- `OutputSection.tsx` (render model response)
- `GenrateButton.tsx` (generate trigger)
- `Loader.tsx` (in-flight state)
- `CopyButton.tsx` (copy output)
- `ApiKeyPrompt.tsx` (collect/store API key)

Shared types:
- `types.ts`

##### Backend/API (Serverless-style endpoint)
- `api/generate.ts` — treat this as a **backend container** even if it’s deployed serverlessly.
- Responsibility: validate request, call Gemini service, return response

##### LLM integration service
- `services/geminiService.ts`
- Responsibility: wrap Gemini API calls, request/response shaping, error handling

##### External dependency
- **Gemini API** (external SaaS)
- Authentication via API key (inferred from `ApiKeyPrompt.tsx` + `geminiService.ts`)

##### Build/Tooling (deployment-time, not runtime)
- `vite.config.ts`, `tsconfig.json`, `package.json`, `package-lock.json`, `metadata.json`

##### Response flows back
- Gemini API → geminiService → /api/generate → browser client
##### Optional UI actions
- **CopyButton** copies output to clipboard
- **Loader** shows while awaiting response
- **ApiKeyPrompt** supplies API key (likely stored in memory or localStorage)

- **Browser is untrusted**
- **API function is trusted boundary**

If the API key is provided by the user in the UI, show a note like:
- “API key stored in localStorage” or “API key passed in request header/body”
(Only choose what’s correct after checking implementation.)

##### Architectural patterns to highlight (
Even in a small app, call out these patterns because they affect correct diagramming:

- **Presentation / container separation (implicit)**: React components render UI; logic likely centralized in `App.tsx` and service modules.
- **Service wrapper**: `geminiService.ts` is an integration boundary; the API route should not directly embed raw HTTP calls everywhere.
- **Serverless API route**: `api/generate.ts` is a thin backend facade; it exists to:
- hide vendor API details,
- enforce validation,
- manage secrets / rate limits (if implemented).

##### React SPA (Vite-built static assets)
- runs in browser
- contains components: Input/Output, ApiKeyPrompt, etc.

##### API Container: `/api/generate` (serverless function / backend endpoint)
- code: `api/generate.ts`
- responsibilities: validation, orchestration, error mapping

##### Gemini API (External SaaS)
- code not in repo

- SPA → `/api/generate` (HTTP POST; include request schema label: prompt, params, apiKey?)
- `/api/generate` → `Gemini API` (HTTPS; include auth method)
- Responses returning in reverse

Annotations:

**React component breakdown (inside SPA container):**
- `App.tsx` (composition + state + handlers)
- uses `Header`, `Footer`
- uses `InputSection` (captures prompt/config)
- uses `ApiKeyPrompt` (if key required)
- uses `GenrateButton`
- uses `OutputSection`
- uses `Loader`
- uses `CopyButton`

**Backend endpoint internals (inside API container):**
- `api/generate.ts`
- calls `services/geminiService.ts`
- uses `types.ts` (request/response typing)

**Integration module (could be shown inside API container or as a subcomponent):**
- `geminiService.ts`
- talks to Gemini API

- `GenrateButton` → `App.tsx` handler (event)
- `App.tsx` → `/api/generate` (network)
- `/api/generate` → `geminiService.ts` (function call)
- `geminiService.ts` → `Gemini API` (HTTP)
- `OutputSection` ← `App.tsx` state (render data flow)

##### Don’t overthink it: maximize components, but keep each level readable
Because the repo is small, it’s better to **explicitly include every component in `components/` and every module under `api/` and `services/`** rather than abstracting them away. The accuracy comes from **one-to-one mapping** to the tree.

##### Quick checklist to ensure correctness (based on this repo)
Before finalizing, confirm by code inspection:
- Does the browser call Gemini directly, or always via `api/generate.ts`?
- Where is the API key stored and passed (localStorage, env var on server, request body/header)?
- Is there streaming output (SSE/websocket) or simple request/response?
- Any rate limiting / retries / error normalization in `geminiService.ts`?

## Diagram (Mermaid)

```mermaid
flowchart TD
  %% =========================
  %% Level 1: System Context
  %% =========================
  subgraph L1["Level 1 — System Context"]
    direction TB
    User["User\n(Browser)"]:::external
    Sys["Prompt Generator Web App"]:::system
    Gemini["Gemini API\n(External SaaS)"]:::external

    User -->|"UI_interactions"| Sys
    Sys -->|"Generate_content_(HTTPS)"| Gemini
    Gemini -->|"Generated_output_(HTTPS)"| Sys
  end

  %% =========================
  %% Level 2: Container Diagram
  %% =========================
  subgraph L2["Level 2 — Container Diagram"]
    direction TB

    subgraph Browser["Browser Boundary (Untrusted)"]
      direction TB
      SPA["React SPA\n(Vite-built static assets)"]:::frontend
    end

    subgraph Backend["Serverless/Backend Boundary (Trusted)"]
      direction TB
      API["API Endpoint\nPOST /api/generate"]:::backend
    end

    ExtGemini["Gemini API\n(External SaaS)"]:::external

    SPA -->|"HTTP_POST_/api/generate\n{prompt,config,apiKey?}"| API
    API -->|"HTTPS_to_Gemini\nAuth:API_key"| ExtGemini
    ExtGemini -->|"Response\n{generatedText,usage,error?}"| API
    API -->|"HTTP_200/4xx/5xx\n{generatedText,usage,error?}"| SPA

    Types["Shared Types\n(Request/Response)"]:::shared
    SPA -.->|"imports_types"| Types
    API -.->|"imports_types"| Types
  end

  %% =========================
  %% Level 3: Component Diagram
  %% =========================
  subgraph L3["Level 3 — Component Diagram"]
    direction TB

    subgraph SPAComp["Inside React SPA (Browser)"]
      direction TB

      Html["HTML Shell"]:::frontend
      Mount["React Mount"]:::frontend
      App["App\n(Composition + State + Handlers)"]:::frontend

      subgraph Layout["Layout Components"]
        direction TB
        Header["Header"]:::ui
        Footer["Footer"]:::ui
      end

      subgraph Input["Input / Controls"]
        direction TB
        InputSection["InputSection\n(Prompt + Settings)"]:::ui
        ApiKeyPrompt["ApiKeyPrompt\n(API key collection)"]:::ui
        GenerateBtn["GenrateButton\n(Generate trigger)"]:::ui
      end

      subgraph Output["Output / Actions"]
        direction TB
        OutputSection["OutputSection\n(Render model response)"]:::ui
        Loader["Loader\n(In-flight indicator)"]:::ui
        CopyBtn["CopyButton\n(Copy to clipboard)"]:::ui
      end

      Css["Global CSS\n(Tailwind entry)"]:::tooling

      Html -->|"loads_bundle"| Mount
      Mount -->|"renders"| App

      App -->|"composes"| Header
      App -->|"composes"| InputSection
      App -->|"composes"| OutputSection
      App -->|"composes"| Footer

      InputSection -->|"collects_apiKey"| ApiKeyPrompt
      InputSection -->|"triggers_generate"| GenerateBtn

      GenerateBtn -->|"onClick_event"| App

      App -->|"sets_loading_state"| Loader
      App -->|"sets_output_state"| OutputSection
      OutputSection -->|"enables_copy"| CopyBtn
    end

    subgraph APIComp["Inside API Endpoint (Serverless Backend)"]
      direction TB
      GenerateRoute["api/generate.ts\n(Validate + Orchestrate)"]:::backend
      GeminiSvc["services/geminiService.ts\n(Gemini client wrapper)"]:::backend
      GenerateRoute -->|"calls_service"| GeminiSvc
    end

    GeminiExt2["Gemini API\n(External SaaS)"]:::external

    App -->|"fetch_HTTP_POST_/api/generate\n{prompt,config,apiKey?}"| GenerateRoute
    GeminiSvc -->|"HTTPS_request\nAuth:API_key"| GeminiExt2
    GeminiExt2 -->|"HTTPS_response"| GeminiSvc
    GenerateRoute -->|"returns_JSON\n{generatedText,usage,error?}"| App

    Types2["types.ts\n(Request/Response types)"]:::shared
    App -.->|"imports_types"| Types2
    GenerateRoute -.->|"imports_types"| Types2
    GeminiSvc -.->|"shapes_payloads"| Types2
  end

  %% =========================
  %% Build & Tooling (Non-runtime)
  %% =========================
  subgraph Tooling["Build & Tooling (Deployment-time)"]
    direction TB
    ViteCfg["Vite Config"]:::tooling
    TsCfg["TypeScript Config"]:::tooling
    TailwindCfg["Tailwind Config"]:::tooling
    PostcssCfg["PostCSS Config"]:::tooling
    Pkg["package.json\n(Dependencies/Scripts)"]:::tooling
    Lock["package-lock.json\n(Lockfile)"]:::tooling
    Meta["metadata.json\n(Project metadata)"]:::tooling

    Pkg -->|"drives"| ViteCfg
    Pkg -->|"drives"| TsCfg
    Pkg -->|"drives"| TailwindCfg
    Pkg -->|"drives"| PostcssCfg
    Lock -->|"pins"| Pkg
  end

  %% Connect the levels top-to-bottom for vertical readability
  L1 --> L2 --> L3 --> Tooling

  %% =========================
  %% Click Events (from component_mapping)
  %% =========================
  click Html "https://github.com/rizanmohd030/genai-resume-assistant/blob/master/index.html"
  click Mount "https://github.com/rizanmohd030/genai-resume-assistant/blob/master/index.tsx"
  click App "https://github.com/rizanmohd030/genai-resume-assistant/blob/master/App.tsx"
  click Css "https://github.com/rizanmohd030/genai-resume-assistant/blob/master/index.css"
  click Header "https://github.com/rizanmohd030/genai-resume-assistant/blob/master/components/Header.tsx"
  click Footer "https://github.com/rizanmohd030/genai-resume-assistant/blob/master/components/Footer.tsx"
  click InputSection "https://github.com/rizanmohd030/genai-resume-assistant/blob/master/components/InputSection.tsx"
  click OutputSection "https://github.com/rizanmohd030/genai-resume-assistant/blob/master/components/OutputSection.tsx"
  click GenerateBtn "https://github.com/rizanmohd030/genai-resume-assistant/blob/master/components/GenrateButton.tsx"
  click Loader "https://github.com/rizanmohd030/genai-resume-assistant/blob/master/components/Loader.tsx"
  click CopyBtn "https://github.com/rizanmohd030/genai-resume-assistant/blob/master/components/CopyButton.tsx"
  click ApiKeyPrompt "https://github.com/rizanmohd030/genai-resume-assistant/blob/master/components/ApiKeyPrompt.tsx"
  click Types "https://github.com/rizanmohd030/genai-resume-assistant/blob/master/types.ts"
  click Types2 "https://github.com/rizanmohd030/genai-resume-assistant/blob/master/types.ts"
  click GenerateRoute "https://github.com/rizanmohd030/genai-resume-assistant/blob/master/api/generate.ts"
  click GeminiSvc "https://github.com/rizanmohd030/genai-resume-assistant/blob/master/services/geminiService.ts"
  click ViteCfg "https://github.com/rizanmohd030/genai-resume-assistant/blob/master/vite.config.ts"
  click TsCfg "https://github.com/rizanmohd030/genai-resume-assistant/blob/master/tsconfig.json"
  click TailwindCfg "https://github.com/rizanmohd030/genai-resume-assistant/blob/master/tailwind.config.cjs"
  click PostcssCfg "https://github.com/rizanmohd030/genai-resume-assistant/blob/master/postcss.config.cjs"
  click Pkg "https://github.com/rizanmohd030/genai-resume-assistant/blob/master/package.json"
  click Lock "https://github.com/rizanmohd030/genai-resume-assistant/blob/master/package-lock.json"
  click Meta "https://github.com/rizanmohd030/genai-resume-assistant/blob/master/metadata.json"

  %% =========================
  %% Styles (color is required)
  %% =========================
  classDef system fill:#1f2937,stroke:#111827,color:#f9fafb,stroke-width:2px
  classDef frontend fill:#dbeafe,stroke:#1d4ed8,color:#0b1220,stroke-width:1.5px
  classDef ui fill:#bfdbfe,stroke:#1d4ed8,color:#0b1220,stroke-width:1.5px
  classDef backend fill:#dcfce7,stroke:#166534,color:#052e16,stroke-width:1.5px
  classDef external fill:#fee2e2,stroke:#b91c1c,color:#450a0a,stroke-width:1.5px
  classDef shared fill:#fef9c3,stroke:#a16207,color:#422006,stroke-width:1.5px
  classDef tooling fill:#e5e7eb,stroke:#374151,color:#111827,stroke-width:1.2px
```
