# ka25van/genaifullstack architecture

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

- Interactive diagram: https://gitdiagram.com/ka25van/genaifullstack
- Repository: https://github.com/ka25van/genaifullstack

## Overview

##### Project type and purpose
- This is a full-stack, containerized web application (“Exploring GenAI”) that lets users interact with generative AI functionality.
- It is composed of three logical components:
- A React-based Single Page Application (frontend)
- A Node.js/Express API layer (backend)
- A Python AI microservice (ai_service) that encapsulates the actual GenAI logic
- CI is orchestrated via the GitHub Actions workflow in .github/workflows/ci.yml.

##### File structure
- Top-level directories:
- ai_service: contains app.py (likely a Flask/FastAPI service exposing AI endpoints).
- backend: Node.js/Express server.js + package.json + Dockerfile.
- frontend: React+TypeScript app with Tailwind, Dockerfile, and public/static assets.
- Dockerfiles in both backend and frontend indicate containerization for each service.
- No database directory—persistence may not be in scope or is external (e.g., cloud store or ephemeral).
- CI configuration (.github/workflows/ci.yml) suggests automated build/test on push/PR.

##### README
- Minimal textual description: title “Exploring GenAI” and accompanying image.

a. Main components to represent:
- Frontend SPA (React/TypeScript/Tailwind)
- Backend API (Node.js/Express)
- AI Service (Python/Flask or FastAPI)
- (Optional) External AI provider or downstream services if ai_service calls OpenAI or similar
- CI/CD pipeline (GitHub Actions)
- Container runtime or orchestration layer (e.g., Docker, Kubernetes)

b. Relationships & interactions:
1. User’s browser ←→ Frontend container (served by Nginx or static server in Dockerfile).
2. Frontend → HTTP(S) requests → Backend API.
3. Backend → Internal HTTP/gRPC → AI Service microservice (ai_service/app.py).
4. AI Service → External GenAI API (if configured) or local model inference.
5. CI pipeline triggers builds of frontend & backend containers, runs tests, and optionally pushes images.

c. Architectural patterns & principles:
- Microservices: separate deployable units for API and AI logic.
- Single-Page Application pattern for UI.
- Containerization for environment consistency and deployment.
- Clear API boundary between frontend and backend, and between backend and ai_service.

d. Key technologies/frameworks:
- Frontend: React, TypeScript, Tailwind CSS
- Backend: Node.js, Express, npm
- AI Service: Python (Flask or FastAPI), dependencies managed via .gitignore
- CI: GitHub Actions (ci.yml)
- Deployment: Docker, Dockerfile in frontend and backend

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Components
    Browser["User Browser"]:::external
    Frontend["Frontend SPA<br/>(React+TS/Tailwind)<br/>Port:3000"]:::internal
    Backend["Backend API<br/>(Node.js/Express)<br/>Port:8080"]:::internal
    AIService["AI Microservice<br/>(Python Flask/FastAPI)<br/>Port:5000"]:::internal
    ExternalAI["External GenAI API"]:::external
    CICD["CI/CD Pipeline<br/>(GitHub Actions)"]:::ci

    %% Layout
    Browser -->|"HTTP(S) requests"| Frontend
    Frontend -->|"API calls"| Backend
    Backend -->|"Internal HTTP/gRPC"| AIService
    AIService -->|"GenAI inference"| ExternalAI

    CICD -.->|build & test| Frontend
    CICD -.->|build & test| Backend
    CICD -.->|build & test| AIService

    %% Click Events
    click Frontend "https://github.com/ka25van/genaifullstack/tree/master/frontend/"
    click Backend "https://github.com/ka25van/genaifullstack/tree/master/backend/"
    click AIService "https://github.com/ka25van/genaifullstack/tree/master/ai_service/"
    click CICD "https://github.com/ka25van/genaifullstack/blob/master/.github/workflows/ci.yml"

    %% Styles
    classDef internal fill:#D0E8FF,stroke:#0366d6,color:#0366d6,stroke-width:2px;
    classDef external fill:#E6FFDD,stroke:#28a745,color:#28a745,stroke-width:2px,stroke-dasharray: 5 5;
    classDef ci fill:#FFF4D6,stroke:#FFA500,color:#AA6500,stroke-width:2px,stroke-dasharray: 5 5;
```
