Skip to content

docs: add comprehensive backend architecture documentation#1093

Open
karthi-palanisamy wants to merge 1 commit intoopen-webui:mainfrom
karthi-palanisamy:docs/backend-architecture
Open

docs: add comprehensive backend architecture documentation#1093
karthi-palanisamy wants to merge 1 commit intoopen-webui:mainfrom
karthi-palanisamy:docs/backend-architecture

Conversation

@karthi-palanisamy
Copy link

@karthi-palanisamy karthi-palanisamy commented Feb 18, 2026

Description

Added comprehensive backend codebase architecture documentation to help contributors understand the backend code structure, navigate the codebase, and implement new features.

Related to discussion in main repo: open-webui/open-webui#21554

What This Adds

A new Backend Architecture reference page (docs/reference/backend-architecture.md) that documents:

  • Architecture Overview: FastAPI-based modular architecture diagram
  • Directory Structure: Complete breakdown of the backend/ directory organization
  • Key Components: Detailed explanations of routers, models, utils, RAG system, and configuration
  • 27 API Routers: Documentation of all router files (authentication, chat management, LLM integrations, RAG, etc.)
  • 22+ Database Models: ORM model organization and relationships
  • 32+ Utility Modules: Helper functions and services
  • Development Setup: Backend-specific setup instructions
  • Code Examples: How to add new routers and database models
  • Environment Variables: Backend configuration reference

Why This Is Needed

This documentation fills a critical gap between existing documentation:

Existing Doc Focus Your Contribution
getting-started/development.md How to run the dev environment (npm install, pip install, sh dev.sh) How the codebase is organized and where to add features
enterprise/architecture.md Deployment architecture (load balancing, Redis, PostgreSQL, high availability) Code architecture (routers, models, FastAPI structure)
tutorials/.../backend-controlled-ui-compatible-flow.md How to consume the backend API How to contribute to the backend code

Problem: New contributors can set up the dev environment but don't know:

  • Where to find specific functionality (e.g., which router handles authentication?)
  • How to add a new API endpoint
  • What the different directories contain
  • Backend coding patterns and conventions

Solution: This documentation provides a comprehensive map of the backend codebase.

Validation

  • ✅ All file paths verified against actual codebase (as of February 2026)
  • ✅ All 27 router files confirmed to exist
  • ✅ All 22+ model files documented
  • ✅ Directory structure matches reality
  • ✅ Cross-references to other docs pages (/reference/api-endpoints, /reference/env-configuration, /contributing)
  • ✅ Code examples tested for accuracy

Screenshots

N/A - Documentation only

Checklist

  • Documentation follows Docusaurus MDX format with proper frontmatter
  • sidebar_position: 450 places it logically in the Reference section (after API Endpoints)
  • All internal links use correct paths
  • Content is contributor-focused (for backend developers)
  • Cross-references existing documentation
  • Single commit with clear message: "docs: add comprehensive backend architecture documentation"

@karthi-palanisamy
Copy link
Author

@Classic298 - Moved it here
open-webui/open-webui#21554

@pr-validator-bot
Copy link

ℹ️ Documentation PR Guidelines

👋 Welcome! This is an automated message posted on all new documentation PRs to help guide our contributors. Just because this comment appeared doesn't mean you have done anything wrong!

Please ensure you're using the correct branches:

Target branch (where you're merging TO):

  • dev branch: For documentation related to upcoming Open WebUI releases (new features, new environment variables, anything dependent on unreleased versions and unreleased features/fixes/changes)
  • main branch: For content that can go live immediately (fixes, tutorials, documentation not dependent on unreleased features)

Source branch (where you're merging FROM):

  • If targeting dev, create your branch from your fork's dev branch
  • If targeting main, create your branch from your fork's main branch
  • ⚠️ Mismatched branches can and will result in unwanted file changes being included in your PR!

If your docs PR depends on a pending PR in open-webui/open-webui:

  • Convert this PR to DRAFT mode!
  • Link to the related main repo PR in your description for clarity
  • We'll review both together once the PR on the main repo is merged

Please adjust your PR target branch, source branch, and/or draft status accordingly if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments