> For the complete documentation index, see [llms.txt](https://outline-1.gitbook.io/outline/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://outline-1.gitbook.io/outline/design-and-architecture/architecture-overview.md).

# Architecture Overview

High-Level Diagram

<figure><img src="https://3688977829-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQOJE6aViGSPYJ08xzzcA%2Fuploads%2FMwNpXE9fjeHkjlwERKus%2Fimage.png?alt=media&amp;token=07144786-46fb-4397-81a0-9308858cb53a" alt=""><figcaption><p>Something like this</p></figcaption></figure>

#### Component Responsibilities

* Next.js
  * Renders pages and components (React server/client).
  * Hosts API routes that either forward file uploads to the Python service or call AI APIs directly.
* Supabase
  * Manages user authentication and sessions.
  * Stores uploaded documents and analysis data in PostgreSQL.
  * Provides object storage for file uploads.
* Python Microservice (FastAPI)
  * Handles .docx/.pdf upload endpoints.
  * Parses document structure, runs checks, and computes scores.
  * Inserts analysis results and paragraphs into Supabase.
* External AI Services
  * Gemini API: Used for advanced content validation and scoring.
  * ElevenLabs API: Generates text-to-speech audio.
  * Winston AI: Performs AI-detection and summarization tasks.

<br>

#### Architectural Decisions

* Separation of Concerns
  * Splitting into Next.js and Python service keeps UI logic (React, routing) separate from heavy document parsing and database writes.
* Supabase as Managed Service
  * Chosen for built-in authentication, storage, and PostgreSQL hosting—minimizes infrastructure overhead.
* Use of FastAPI
  * Lightweight, high-performance framework ideal for parsing and analysis tasks without blocking the frontend.
* Direct AI API Calls vs. Local Models
  * Opted for Gemini, ElevenLabs, and Winston AI to leverage maintained services and avoid on-premise model hosting.
* API Proxying
  * Next.js routes hide service URLs and secrets from the client, centralizing all server-side calls.
