How it-at-m/mucgpt works
Project type and purpose
• MUCGPT is a full-stack, web-based interface for large language models (LLMs).
• The frontend is built in React/TypeScript; the backend is a FastAPI (Python) service integrating LangChain to call OpenAI-compatible endpoints.
• The system supports chatting, summarizing, brainstorming (mind-maps), simplified language translation, and custom “GPT” generation.
File structure
• Top-level “app/frontend” houses the React UI, static assets, API client code, pages and reusable components.
• “app/backend” contains FastAPI entrypoints (app.py, init_app.py), business modules (chat, summarize, brainstorm, simply, create_bot), core helpers, type definitions, configuration and logging.
• “config/.env.empty” hints at environment-driven settings (LLM endpoints, database URL).
• Dockerfile, uv workflows and CI configs signal containerized deployment using Uvicorn, Docker, GitHub Actions.
• Tests/ folder holds unit/integration tests for backend logic.
Extract insights from the README
• Deployed on Azure App Service with a PostgreSQL database and an Azure OpenAI resource (or any OpenAI-compatible endpoint).
• Frontend communicates via REST (FastAPI) to backend.
• Backend uses LangChain for LLM orchestration.
• Local browser storage (IndexedDB) is used for chat history and custom GPT persistence.
Main components & interactions
a. User’s Browser / Client:
• Renders React app (HTML/CSS/JS).
• Reads/writes chat history & custom bots to IndexedDB.
• Calls backend REST endpoints (/chat, /summarize, /brainstorm, /simply, /create_bot).
b. Frontend App:
• Hosts pages & components, API client (api.ts), state/context providers (LLMSelector, LanguageSelector).
• Static assets (images, CSS modules).
c. Backend Service (FastAPI + Uvicorn):
• API layer (app.py, backend.py) defines endpoints.
• Business modules handle each feature (chat/chat.py, summarize/summarize.py, brainstorm/brainstorm.py, simply/simply.py, create_bot/…).
• Core helpers manage authentication, config loading, data persistence, model/LLM calls, text splitting, logging.
d. LLM Endpoint(s):
• Azure OpenAI or any OpenAI-compatible API URL configured via .env.
• LangChain orchestrates prompt templates, streaming, vector stores (if used).
e. Persistent Storage:
• PostgreSQL (for user-defined bots, usage statistics, if implemented).
• (Local) IndexedDB in browser for chat history and custom GPT definitions.
f. Container & Deployment:
• Docker container runs Uvicorn server exposing port 8000.
• CI/CD via GitHub/GitLab workflows, uv, Docker Hub or Azure Container Registry.
Architectural patterns & principles
• Client-Server separation (React UI vs. REST API).
• Modular backend: one module per feature (SRP).
• Environment-driven config (12-factor principles).
• Dependency injection via FastAPI’s startup events (init_app.py).
• Typed Python (pydantic models in core/types) for request/response validation.
• CI/CD and containerization for reproducibility.
Detail is key—capture
• Each feature path (chat, summarize, brainstorm, simply, create_bot) as its own module in the backend layer.
• Core helpers (auth, config, llmhelper, datahelper, textsplit) as a shared service block.
• Persistence layers separated by scope (browser vs. server).
• Deployment environment—Docker container on Azure, managed via uv and GitHub Actions—so ops can see end-to-end flow.