# docling-project/docling-ts architecture

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

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

## Overview

##### Major components
- Docling Core – This package contains the type definitions and utility functions needed to work with the Docling JSON output. It includes subdirectories for types (e.g., models.ts, typing.ts) plus build and configuration files (like tsconfig.json, tsup.config.ts). This represents the “core libraries” of the project.
- Docling Components – This package offers the web components for displaying the Docling JSON. Its source (in the src directory) is built using Svelte (files ending in .svelte) and includes further subdivisions (e.g., img, item, table) that logically separate the UI components. Build and linting configurations (eslint, prettier, stylelint) further support this module.
- Examples and Documentation – The examples directory (especially the Deno example) demonstrates how to integrate the libraries with a front-end application. Also, the docs directory provides example assets and usage, which can be treated as a “consumer” or demo layer of the overall system.

##### Establish relationships and interactions
- The Docling Core package is the foundation that defines the data model and utility operations; it is likely to be used by other parts (such as the Docling Components) for validation, parsing, or mapping of the JSON output.
- Docling Components, being the interface elements, depends on the core definitions but also encapsulates the presentation logic. They likely communicate with user interaction events and then use core utilities to ensure proper data transformation.
- The Examples (e.g., the Deno example) show how to integrate both components together into a runnable application. They include UI components, service interactions, and static assets that tie into the Docling Components.
- There may be external dependencies (like Svelte for the UI and Deno as the runtime in one of the examples), so external services and libraries should also be represented if needed.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Docling Core Subgraph
    subgraph "Docling Core"
        core_index("Index"):::core
        core_typesIndex("Types Index"):::core
        core_models("Models"):::core
        core_typing("Typing"):::core
        core_tsconfig("tsconfig.json"):::core
        core_tsup("tsup.config.ts"):::core
        core_vitest("vitest.config.ts"):::core
    end

    %% Docling Components Subgraph
    subgraph "Docling Components"
        comp_imgPage("ImgPage (svelte)"):::component
        comp_imgPages("ImgPages (svelte)"):::component
        comp_cropped("CroppedItem (svelte)"):::component
        comp_parsed("ParsedItem (svelte)"):::component
        comp_tableItem("TableItem (svelte)"):::component
        comp_itemIndex("Item Index"):::component
        comp_tablePage("TablePage (svelte)"):::component
        comp_tablePages("TablePages (svelte)"):::component
        comp_tableRow("TableRow (svelte)"):::component
        comp_props("Props"):::component
        comp_util("Util"):::component
        comp_tsconfig("tsconfig.json"):::component
        comp_svelteup("svelteup.config.js"):::component
        comp_eslint("eslint.config.mjs"):::component
        comp_prettierrc(".prettierrc"):::component
        comp_stylelintrc(".stylelintrc"):::component
    end

    %% Example Application (Deno) Subgraph
    subgraph "Example Application (Deno)"
        ex_readme("Deno README"):::example
        ex_denoConfig("deno.json"):::example
        ex_serve("serve.sh"):::example
        ex_src("Source Code"):::example
        ex_static("Static Assets"):::example
    end

    %% Documentation & Supporting Assets Subgraph
    subgraph "Documentation & Supporting Assets"
        docs_dir("Docs Directory"):::docs
        root_readme("README.md"):::docs
        root_code("CODE_OF_CONDUCT.md"):::docs
        root_license("LICENSE"):::docs
        root_gitignore(".gitignore"):::docs
    end

    %% External dependencies
    svelte("Svelte Framework"):::external
    deno("Deno Runtime"):::external

    %% High-level dependency relationships using representative nodes
    core_index -->|"providestypes"| comp_imgPage
    core_index -->|"integrated"| ex_readme
    comp_imgPage -->|"rendersUI"| ex_readme
    comp_imgPage -->|"builtwith"| svelte
    ex_readme -->|"runsOn"| deno

    %% Click Events for Docling Core
    click core_index "https://github.com/docling-project/docling-ts/blob/main/docling-core/src/index.ts"
    click core_typesIndex "https://github.com/docling-project/docling-ts/blob/main/docling-core/src/types/index.ts"
    click core_models "https://github.com/docling-project/docling-ts/blob/main/docling-core/src/types/models.ts"
    click core_typing "https://github.com/docling-project/docling-ts/blob/main/docling-core/src/types/typing.ts"
    click core_tsconfig "https://github.com/docling-project/docling-ts/blob/main/docling-core/tsconfig.json"
    click core_tsup "https://github.com/docling-project/docling-ts/blob/main/docling-core/tsup.config.ts"
    click core_vitest "https://github.com/docling-project/docling-ts/blob/main/docling-core/vitest.config.ts"

    %% Click Events for Docling Components
    click comp_imgPage "https://github.com/docling-project/docling-ts/blob/main/docling-components/src/img/ImgPage.svelte"
    click comp_imgPages "https://github.com/docling-project/docling-ts/blob/main/docling-components/src/img/ImgPages.svelte"
    click comp_cropped "https://github.com/docling-project/docling-ts/blob/main/docling-components/src/item/CroppedItem.svelte"
    click comp_parsed "https://github.com/docling-project/docling-ts/blob/main/docling-components/src/item/ParsedItem.svelte"
    click comp_tableItem "https://github.com/docling-project/docling-ts/blob/main/docling-components/src/item/TableItem.svelte"
    click comp_itemIndex "https://github.com/docling-project/docling-ts/blob/main/docling-components/src/item/index.ts"
    click comp_tablePage "https://github.com/docling-project/docling-ts/blob/main/docling-components/src/table/TablePage.svelte"
    click comp_tablePages "https://github.com/docling-project/docling-ts/blob/main/docling-components/src/table/TablePages.svelte"
    click comp_tableRow "https://github.com/docling-project/docling-ts/blob/main/docling-components/src/table/TableRow.svelte"
    click comp_props "https://github.com/docling-project/docling-ts/blob/main/docling-components/src/props.ts"
    click comp_util "https://github.com/docling-project/docling-ts/blob/main/docling-components/src/util.ts"
    click comp_tsconfig "https://github.com/docling-project/docling-ts/blob/main/docling-components/tsconfig.json"
    click comp_svelteup "https://github.com/docling-project/docling-ts/blob/main/docling-components/svelteup.config.js"
    click comp_eslint "https://github.com/docling-project/docling-ts/blob/main/docling-components/eslint.config.mjs"
    click comp_prettierrc "https://github.com/docling-project/docling-ts/blob/main/docling-components/.prettierrc"
    click comp_stylelintrc "https://github.com/docling-project/docling-ts/blob/main/docling-components/.stylelintrc"

    %% Click Events for Example Application (Deno)
    click ex_readme "https://github.com/docling-project/docling-ts/blob/main/examples/deno/README.md"
    click ex_denoConfig "https://github.com/docling-project/docling-ts/blob/main/examples/deno/deno.json"
    click ex_serve "https://github.com/docling-project/docling-ts/blob/main/examples/deno/serve.sh"
    click ex_src "https://github.com/docling-project/docling-ts/tree/main/examples/deno/src/"
    click ex_static "https://github.com/docling-project/docling-ts/tree/main/examples/deno/static/"

    %% Click Events for Documentation & Supporting Assets
    click docs_dir "https://github.com/docling-project/docling-ts/tree/main/docs/"
    click root_readme "https://github.com/docling-project/docling-ts/blob/main/README.md"
    click root_code "https://github.com/docling-project/docling-ts/blob/main/CODE_OF_CONDUCT.md"
    click root_license "https://github.com/docling-project/docling-ts/tree/main/LICENSE"
    click root_gitignore "https://github.com/docling-project/docling-ts/blob/main/.gitignore"

    %% Styles
    classDef core fill:#f9c,stroke:#000,stroke-width:2px;
    classDef component fill:#bbf,stroke:#000,stroke-width:2px;
    classDef example fill:#cfc,stroke:#000,stroke-width:2px;
    classDef docs fill:#ff9,stroke:#000,stroke-width:2px;
    classDef external fill:#ddd,stroke:#000,stroke-width:2px;
```
