# docling-project/docling architecture

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

- Interactive diagram: https://gitdiagram.com/docling-project/docling
- Repository: https://github.com/docling-project/docling

## Overview

Docling converts diverse local or remote inputs into a structured DoclingDocument, then exports formats such as Markdown and JSON. The principal Python workflow starts at DocumentConverter, selects a format backend, runs an appropriate conversion pipeline, and returns the document for export. PDF processing adds layout and document-understanding stages; separate pipelines cover VLM, audio, and video. The README documents broader format and integration capabilities than the sampled source establishes in detail, so those subsystem links are documented rather than inferred from folder names.

Main entry points: [`docling/pipeline/standard_pdf_pipeline.py`](https://github.com/docling-project/docling/blob/main/docling/pipeline/standard_pdf_pipeline.py) (PDF pipeline), [`docling/document_converter.py`](https://github.com/docling-project/docling/blob/main/docling/document_converter.py) (Document converter), [`docling/datamodel/document.py`](https://github.com/docling-project/docling/blob/main/docling/datamodel/document.py) (Document model), [`docling/backend`](https://github.com/docling-project/docling/tree/main/docling/backend) (Format backends)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry and conversion"]
  node_converter["Document converter"]
  node_cli["CLI<br/>[main.py]"]
end

subgraph group_ingest["Format ingestion"]
  node_input["Input detection<br/>[document.py]"]
  node_format_backends["Format backends"]
  node_pdf_backend["PDF backend<br/>[pdf_backend.py]"]
end

subgraph group_understanding["Document understanding"]
  node_pdf_pipeline["PDF pipeline"]
  node_pipeline_base["Pipeline foundation<br/>[base_pipeline.py]"]
  node_layout["Layout and order<br/>[layout_model.py]"]
  node_ocr["OCR"]
  node_tables["Table structure"]
  node_enrichment["Content enrichment"]
  node_vlm_pipeline["VLM pipeline<br/>[vlm_pipeline.py]"]
  node_audio_video["Audio and video"]
end

subgraph group_outputs["Results and access"]
  node_document_model["Document model<br/>[document.py]"]
  node_export["Document export<br/>[document.py]"]
  node_service_client["Service client<br/>[client.py]"]
end

node_user(("User"))
node_service["Docling service"]

node_user -->|"converts input"| node_converter
node_user -->|"runs conversion"| node_cli
node_converter -.->|"detects format"| node_input
node_input -.->|"selects backend"| node_format_backends
node_format_backends -->|"parses formats"| node_document_model
node_pdf_backend -->|"provides PDF input"| node_pdf_pipeline
node_pdf_pipeline -->|"analyzes layout"| node_layout
node_pdf_pipeline -->|"supports OCR"| node_ocr
node_pdf_pipeline -->|"structures tables"| node_tables
node_pdf_pipeline -->|"enriches content"| node_enrichment
node_pdf_pipeline -->|"extends foundation"| node_pipeline_base
node_converter -->|"returns result"| node_document_model
node_document_model -->|"exports formats"| node_export
node_converter -->|"supports VLM mode"| node_vlm_pipeline
node_converter -->|"supports media"| node_audio_video
node_user -.->|"uses API"| node_service
node_service_client -.->|"calls service"| node_service

click node_converter "https://github.com/docling-project/docling/blob/main/docling/document_converter.py"
click node_cli "https://github.com/docling-project/docling/blob/main/docling/cli/main.py"
click node_input "https://github.com/docling-project/docling/blob/main/docling/datamodel/document.py"
click node_format_backends "https://github.com/docling-project/docling/tree/main/docling/backend"
click node_pdf_backend "https://github.com/docling-project/docling/blob/main/docling/backend/pdf_backend.py"
click node_pdf_pipeline "https://github.com/docling-project/docling/blob/main/docling/pipeline/standard_pdf_pipeline.py"
click node_pipeline_base "https://github.com/docling-project/docling/blob/main/docling/pipeline/base_pipeline.py"
click node_document_model "https://github.com/docling-project/docling/blob/main/docling/datamodel/document.py"
click node_layout "https://github.com/docling-project/docling/blob/main/docling/models/stages/layout/layout_model.py"
click node_ocr "https://github.com/docling-project/docling/tree/main/docling/models/stages/ocr"
click node_tables "https://github.com/docling-project/docling/tree/main/docling/models/stages/table_structure"
click node_enrichment "https://github.com/docling-project/docling/tree/main/docling/models/stages"
click node_vlm_pipeline "https://github.com/docling-project/docling/blob/main/docling/pipeline/vlm_pipeline.py"
click node_audio_video "https://github.com/docling-project/docling/tree/main/docling/pipeline"
click node_export "https://github.com/docling-project/docling/blob/main/docling/datamodel/document.py"
click node_service_client "https://github.com/docling-project/docling/blob/main/docling/service_client/client.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_converter,node_cli,node_user toneBlue
class node_input,node_format_backends,node_pdf_backend toneAmber
class node_pdf_pipeline,node_pipeline_base,node_layout,node_ocr,node_tables,node_enrichment,node_vlm_pipeline,node_audio_video toneMint
class node_document_model,node_export,node_service_client toneRose
class node_service toneIndigo
```

## Components

### Entry and conversion

- [Document converter](https://github.com/docling-project/docling/blob/main/docling/document_converter.py): `docling/document_converter.py`
- [CLI](https://github.com/docling-project/docling/blob/main/docling/cli/main.py): `docling/cli/main.py`

### Format ingestion

- [Input detection](https://github.com/docling-project/docling/blob/main/docling/datamodel/document.py): `docling/datamodel/document.py`
- [Format backends](https://github.com/docling-project/docling/tree/main/docling/backend): `docling/backend`
- [PDF backend](https://github.com/docling-project/docling/blob/main/docling/backend/pdf_backend.py): `docling/backend/pdf_backend.py`

### Document understanding

- [PDF pipeline](https://github.com/docling-project/docling/blob/main/docling/pipeline/standard_pdf_pipeline.py): `docling/pipeline/standard_pdf_pipeline.py`
- [Pipeline foundation](https://github.com/docling-project/docling/blob/main/docling/pipeline/base_pipeline.py): `docling/pipeline/base_pipeline.py`
- [Layout and order](https://github.com/docling-project/docling/blob/main/docling/models/stages/layout/layout_model.py): `docling/models/stages/layout/layout_model.py`
- [OCR](https://github.com/docling-project/docling/tree/main/docling/models/stages/ocr): `docling/models/stages/ocr`
- [Table structure](https://github.com/docling-project/docling/tree/main/docling/models/stages/table_structure): `docling/models/stages/table_structure`
- [Content enrichment](https://github.com/docling-project/docling/tree/main/docling/models/stages): `docling/models/stages`
- [VLM pipeline](https://github.com/docling-project/docling/blob/main/docling/pipeline/vlm_pipeline.py): `docling/pipeline/vlm_pipeline.py`
- [Audio and video](https://github.com/docling-project/docling/tree/main/docling/pipeline): `docling/pipeline`

### Results and access

- [Document model](https://github.com/docling-project/docling/blob/main/docling/datamodel/document.py): `docling/datamodel/document.py`
- [Document export](https://github.com/docling-project/docling/blob/main/docling/datamodel/document.py): `docling/datamodel/document.py`
- [Service client](https://github.com/docling-project/docling/blob/main/docling/service_client/client.py): `docling/service_client/client.py`

### Other components

- **User**
- **Docling service**

## Connections

- User → Document converter: converts input
- User → CLI: runs conversion
- Document converter → Input detection: detects format
- Input detection → Format backends: selects backend (evidence: `docling/datamodel/document.py`)
- Format backends → Document model: parses formats (evidence: `docling/backend/abstract_backend.py`)
- PDF backend → PDF pipeline: provides PDF input (evidence: `docling/pipeline/standard_pdf_pipeline.py`)
- PDF pipeline → Layout and order: analyzes layout (evidence: `docling/pipeline/standard_pdf_pipeline.py`)
- PDF pipeline → OCR: supports OCR
- PDF pipeline → Table structure: structures tables
- PDF pipeline → Content enrichment: enriches content (evidence: `docling/pipeline/standard_pdf_pipeline.py`)
- PDF pipeline → Pipeline foundation: extends foundation (evidence: `docling/pipeline/standard_pdf_pipeline.py`)
- Document converter → Document model: returns result
- Document model → Document export: exports formats (evidence: `docling/datamodel/document.py`)
- Document converter → VLM pipeline: supports VLM mode
- Document converter → Audio and video: supports media
- User → Docling service: uses API
- Service client → Docling service: calls service
