How hsuehdev/definiscope works
Project type and purpose
• This is a full-stack, document-analysis and chat platform.
• Users upload documents (PDF, etc.), the system splits and processes them, stores file data, and provides a chat interface with real-time WebSocket messages and AI-based Q&A on the content.
Key architectural building blocks
By inspecting the file tree and README we see these main containers and services:
• Frontend (React + Vite)
• Reverse proxy (Nginx)
• Backend API (FastAPI)
• Celery workers & Beat scheduler
• Split-Sentences microservice (FastAPI)
• Message broker & cache (Redis)
• Object storage (MinIO)
• Relational database (PostgreSQL master-slave)
• Browser (React app)
• Nginx proxy
• Frontend dev server (in local mode) or built static files served by Nginx
• FastAPI backend
• Celery worker(s)
• Celery Beat scheduler
• Split-Sentences service
• Redis (broker & cache)
• MinIO (S3-compatible object store)
• PostgreSQL primary & replica
b. Component-level view inside Backend
• API endpoints (/auth, /chat, /files, WebSocket)
• Core modules (security, JWT, config, websocket manager)
• Database layer (SQLAlchemy models, Alembic migrations)
• Services (file_service, n8n integrations, storage client)
• Tasks (chat_processing, file_processing, scheduled jobs)
Relationships and data flows
• Client ⇄ Nginx ⇄ Frontend assets & API/WebSocket
• Frontend → WebSocket → Backend (real-time chat & progress updates)
• Backend → PostgreSQL (CRUD & query storage)
• Backend → MinIO (upload/download file chunks)
• Backend → Redis (publish/subscribe for WebSocket events & Celery broker)
• Celery workers ← Redis broker → backend tasks (file splitting, chat processing)
• Celery Beat → Redis → scheduled tasks
• Backend or workers → Split-Sentences service (over HTTP) → returns sentence data
Architectural patterns and principles
• Microservices: separate “split_sentences” service
• Event-driven: Celery + Redis for async file/chat jobs
• MVC-style layering: routers, services, models, schemas
• Horizontal scaling: multiple Celery workers, database read replica, MinIO cluster
• Single entry point: Nginx handles HTTP & WS proxying
Technologies & frameworks
• React, TypeScript, Vite, Playwright, Vitest
• FastAPI, Pydantic, Alembic, SQLAlchemy
• Celery, Redis, Beat
• PostgreSQL (primary/replica), MinIO
• Nginx
• Docker & Docker-Compose
• Browser → Nginx → Frontend assets
• Browser → Nginx → Backend HTTP/WS
• Backend ↔ Postgres
• Backend ↔ MinIO
• Backend & Beat ↔ Redis (broker & pub/sub) ↔ Celery
• Backend ↔ Split-Sentences Service (HTTP)
• Labels: protocols, key frameworks, directional flows.