# akash-selvaraj/microbert architecture

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

- Interactive diagram: https://gitdiagram.com/akash-selvaraj/microbert
- Repository: https://github.com/akash-selvaraj/microbert

## Overview

##### Project type and purpose
- This is a full-stack web application called “MicroBert” composed of:
- A Python-based backend (FastAPI served by Uvicorn)
- A React/Next.js frontend (TypeScript, TailwindCSS)
- Purpose: Provide a chat interface (presumably powered by a BERT-style model) in the browser, with the backend handling AI inference and API requests.

##### File structure
- Top-level:
- `microbert_backend/` – Python service with `app.py`, `requirements.txt`, README
- `microbert_frontend/` – Next.js app with pages under `src/app`, configuration files
- Frontend patterns:
- Next.js file-based routing in `src/app/chat/page.tsx` and `src/app/about/page.tsx`
- Reusable UI components in `src/app/components`
- CSS via Tailwind (`tailwind.config.ts`, `globals.css`)
- Backend:
- Single entry point `app.py` exporting a FastAPI `app` instance
- Dependency list in `requirements.txt`
- No database directories—likely stateless or in-memory AI calls; any state is ephemeral or managed externally.

##### README for additional insights
- Backend: run `uvicorn app:app --host=0.0.0.0 --port=8000`
- Frontend: run Next.js via `npm start` (defaults to port 3000)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client
    Browser["User Browser"]:::client

    %% Frontend Presentation Layer
    subgraph "Frontend Presentation Layer"
        direction TB
        FE["Next.js Frontend (Port 3000)"]:::frontend
        subgraph "Pages"
            direction TB
            FL["Global Layout"]:::frontend
            HP["Home Page"]:::frontend
            CP["Chat Page"]:::frontend
            AP["About Page"]:::frontend
        end
        subgraph "Components"
            direction TB
            CH["Chat Component"]:::frontend
            AB["About Component"]:::frontend
            KR["Keyboard Responsive Wrapper"]:::frontend
            MS1["Mascot"]:::frontend
            MS2["MascotBig"]:::frontend
            MS3["MascotSuperBig"]:::frontend
            PM["Paragraph Manager"]:::frontend
            WA["Waiting Animation"]:::frontend
            TC["Test Component"]:::frontend
        end
    end

    %% Frontend Config & Dependencies
    subgraph "Frontend Config & Dependencies"
        direction TB
        TW["tailwind.config.ts"]:::frontend
        GC["globals.css"]:::frontend
        PC["postcss.config.js"]:::frontend
        ESL[".eslintrc.json"]:::frontend
        NX["next.config.mjs"]:::frontend
        TS["tsconfig.json"]:::frontend
        PKG["package.json"]:::frontend
        PKGL["package-lock.json"]:::frontend
    end

    %% Backend API Layer
    subgraph "Backend API Layer"
        direction TB
        BE["FastAPI Backend (Port 8000)"]:::backend
        APY["app.py"]:::backend
        REQ["requirements.txt"]:::backend
        BRMD["readme.md"]:::backend
    end

    %% External Service
    ML["External ML Service"]:::external

    %% Project Documentation
    PR["Project README"]:::project

    %% Data Flows
    Browser -->|"HTTP GET/HTTPS"| FE
    FE -->|"HTTP Response"| Browser
    FE -->|"POST /chat (JSON)"| BE
    BE -->|"invoke inference"| ML
    ML -->|"response JSON"| BE
    BE -->|"return JSON"| FE

    %% Click Events
    click FE "https://github.com/akash-selvaraj/microbert/tree/main/microbert_frontend/"
    click FL "https://github.com/akash-selvaraj/microbert/blob/main/microbert_frontend/src/app/layout.tsx"
    click HP "https://github.com/akash-selvaraj/microbert/blob/main/microbert_frontend/src/app/page.tsx"
    click CP "https://github.com/akash-selvaraj/microbert/blob/main/microbert_frontend/src/app/chat/page.tsx"
    click AP "https://github.com/akash-selvaraj/microbert/blob/main/microbert_frontend/src/app/about/page.tsx"
    click CH "https://github.com/akash-selvaraj/microbert/blob/main/microbert_frontend/src/app/components/Chat.tsx"
    click AB "https://github.com/akash-selvaraj/microbert/blob/main/microbert_frontend/src/app/components/About.tsx"
    click KR "https://github.com/akash-selvaraj/microbert/blob/main/microbert_frontend/src/app/components/KeyboardResponsiveWrapper.tsx"
    click MS1 "https://github.com/akash-selvaraj/microbert/blob/main/microbert_frontend/src/app/components/Mascot.tsx"
    click MS2 "https://github.com/akash-selvaraj/microbert/blob/main/microbert_frontend/src/app/components/MascotBig.tsx"
    click MS3 "https://github.com/akash-selvaraj/microbert/blob/main/microbert_frontend/src/app/components/MascotSuperBig.tsx"
    click PM "https://github.com/akash-selvaraj/microbert/blob/main/microbert_frontend/src/app/components/ParagraphManager.tsx"
    click WA "https://github.com/akash-selvaraj/microbert/blob/main/microbert_frontend/src/app/components/WaitingAnimation.tsx"
    click TC "https://github.com/akash-selvaraj/microbert/blob/main/microbert_frontend/src/app/components/Test.tsx"
    click TW "https://github.com/akash-selvaraj/microbert/blob/main/microbert_frontend/tailwind.config.ts"
    click GC "https://github.com/akash-selvaraj/microbert/blob/main/microbert_frontend/src/app/globals.css"
    click PC "https://github.com/akash-selvaraj/microbert/blob/main/microbert_frontend/postcss.config.js"
    click ESL "https://github.com/akash-selvaraj/microbert/blob/main/microbert_frontend/.eslintrc.json"
    click NX "https://github.com/akash-selvaraj/microbert/blob/main/microbert_frontend/next.config.mjs"
    click TS "https://github.com/akash-selvaraj/microbert/blob/main/microbert_frontend/tsconfig.json"
    click PKG "https://github.com/akash-selvaraj/microbert/blob/main/microbert_frontend/package.json"
    click PKGL "https://github.com/akash-selvaraj/microbert/blob/main/microbert_frontend/package-lock.json"
    click APY "https://github.com/akash-selvaraj/microbert/blob/main/microbert_backend/app.py"
    click REQ "https://github.com/akash-selvaraj/microbert/blob/main/microbert_backend/requirements.txt"
    click BRMD "https://github.com/akash-selvaraj/microbert/blob/main/microbert_backend/readme.md"
    click PR "https://github.com/akash-selvaraj/microbert/blob/main/README.md"

    %% Styles
    classDef frontend fill:#D5F5E3,stroke:#27AE60,stroke-width:1px;
    classDef backend fill:#EBF5FB,stroke:#2980B9,stroke-width:1px;
    classDef external fill:#FEF5E7,stroke:#E67E22,stroke-width:1px;
    classDef client fill:#D6EAF8,stroke:#21618C,stroke-width:1px;
    classDef project fill:#F2F3F4,stroke:#CACFD2,stroke-width:1px;
```
