# lanthoiba2022/ai-customer-support architecture

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

- Interactive diagram: https://gitdiagram.com/lanthoiba2022/ai-customer-support
- Repository: https://github.com/lanthoiba2022/ai-customer-support

## Overview

##### Project type and purpose
- This is a full-stack web application (“AI Customer Support” / Botix) built on Next.js that serves both UI and serverless API routes.
- It provides a chat interface (React components + Tailwind + MUI) and proxies user messages to the Gemini AI API.

##### File structure
- Top‐level “aichatsupport” folder: contains Next.js app, configs, styling, dependencies.
- “app/page.tsx” + “app/layout.tsx” define global SSR pages.
- “app/chat/page.tsx” + “app/components/Chat.tsx” implement the Chat UI.
- “app/api/chat/route.ts” is a Next.js serverless function that handles chat requests.
- Configs: next.config.mjs, tsconfig.json, tailwind.config.ts, postcss.config.mjs. No database code—stateless API.

##### README for additional insights
- Key technologies: Next.js (SSR/routing), TypeScript, MUI, Tailwind CSS, Gemini API integration.
- No mention of a persistence layer—this is a real-time chat frontend + AI proxy backend.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client Layer
    Browser["Browser (Client)"]:::frontend

    %% Frontend Layer
    subgraph "Next.js Frontend" 
        direction TB
        SSRPage["SSR Entry Page\napp/page.tsx"]:::frontend
        Layout["Global Layout\napp/layout.tsx"]:::frontend
        ChatPage["Chat Page Route\napp/chat/page.tsx"]:::frontend
        ChatUI["Chat UI Component\napp/components/Chat.tsx"]:::frontend
        Styles["Global Stylesheet\napp/globals.css"]:::frontend
    end

    %% API Layer
    subgraph "Next.js Serverless API" 
        direction TB
        APIRoute["API Route\n/app/api/chat/route.ts"]:::backend
    end

    %% External Services
    CDN["Static Assets (public/)"]:::backend
    External["Gemini AI Service"]:::external

    %% Build & Config
    subgraph "Build & Configuration" 
        direction TB
        NextConfig["next.config.mjs"]:::backend
        TailwindConfig["tailwind.config.ts"]:::backend
        PostCSSConfig["postcss.config.mjs"]:::backend
        TSConfig["tsconfig.json"]:::backend
        PackageJSON["package.json"]:::backend
    end

    %% Data Flows
    Browser -->|"GET / → HTML/CSS/JS"| SSRPage
    SSRPage -->|"uses"| Layout
    SSRPage -->|"renders"| ChatPage
    ChatPage -->|"includes"| ChatUI
    Browser -->|"fetch POST /api/chat\n{userMessage}"| APIRoute
    APIRoute -->|"HTTPS POST\n{userMessage}"| External
    External -->|"AIResponse JSON"| APIRoute
    APIRoute -->|"JSON {aiResponse}"| Browser
    SSRPage -->|"serves static assets"| CDN
    NextConfig --> SSRPage
    TailwindConfig --> Styles
    PostCSSConfig --> Styles
    TSConfig --> SSRPage
    PackageJSON --> SSRPage

    %% Click Events
    click SSRPage "https://github.com/lanthoiba2022/ai-customer-support/blob/main/aichatsupport/app/page.tsx"
    click Layout "https://github.com/lanthoiba2022/ai-customer-support/blob/main/aichatsupport/app/layout.tsx"
    click ChatPage "https://github.com/lanthoiba2022/ai-customer-support/blob/main/aichatsupport/app/chat/page.tsx"
    click ChatUI "https://github.com/lanthoiba2022/ai-customer-support/blob/main/aichatsupport/app/components/Chat.tsx"
    click APIRoute "https://github.com/lanthoiba2022/ai-customer-support/blob/main/aichatsupport/app/api/chat/route.ts"
    click Styles "https://github.com/lanthoiba2022/ai-customer-support/blob/main/aichatsupport/app/globals.css"
    click TailwindConfig "https://github.com/lanthoiba2022/ai-customer-support/blob/main/aichatsupport/tailwind.config.ts"
    click PostCSSConfig "https://github.com/lanthoiba2022/ai-customer-support/blob/main/aichatsupport/postcss.config.mjs"
    click NextConfig "https://github.com/lanthoiba2022/ai-customer-support/blob/main/aichatsupport/next.config.mjs"
    click CDN "https://github.com/lanthoiba2022/ai-customer-support/tree/main/aichatsupport/public"
    click TSConfig "https://github.com/lanthoiba2022/ai-customer-support/blob/main/aichatsupport/tsconfig.json"
    click PackageJSON "https://github.com/lanthoiba2022/ai-customer-support/blob/main/aichatsupport/package.json"

    %% Styling
    classDef frontend fill:#D6EAF8,stroke:#21618C,color:#1B4F72
    classDef backend fill:#D5F5E3,stroke:#196F3D,color:#145A32
    classDef external fill:#FDEBD0,stroke:#B9770E,color:#7E5109
```
