# jetbrains/compose-multiplatform architecture

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

- Interactive diagram: https://gitdiagram.com/jetbrains/compose-multiplatform
- Repository: https://github.com/jetbrains/compose-multiplatform

## Overview

1. This is a monorepo for Compose Multiplatform, not a single app. The top-level architecture is split into product code, build tooling, samples, benchmarks, tests, docs, and experimental incubations. The dominant boundary is Kotlin Multiplatform source sets: `commonMain` shared code with platform-specific implementations in `androidMain`, `desktopMain`, `iosMain`, `jsMain`, `wasmJsMain`, `macosMain`, and related variants.

2. The main framework runtime lives under `components/`. These are reusable libraries shipped to app authors, including resource handling, UI tooling preview, animated image support, split pane UI, and other composable building blocks. The `components/resources/library` module is especially central: it defines the cross-platform resource model, resource readers/caches, plural rules, vector parsing, and per-platform backends for Android, JVM/desktop, iOS, JS, Web, Wasm, and native.

3. Resource handling is a major cross-cutting subsystem. Source assets placed in `composeResources` are processed at build time into generated accessors and collectors, then resolved at runtime through platform-specific `ResourceReader`/`ResourceEnvironment` implementations. This is one of the clearest data flows in the repo: declarative resource files -> Gradle plugin generation -> generated Kotlin APIs -> runtime lookup on each target.

4. The build-time backbone is `gradle-plugins/compose`. This plugin configures Compose projects, wires Android/Desktop/Web application targets, handles desktop packaging/signing/notarization, validates compatibility, generates resources, and integrates preview support. It is the central orchestration layer that turns source modules into runnable apps, libraries, native distributions, and web bundles.

5. Web support is its own subsystem under `html/` and parts of `gradle-plugins/compose`. `html/core` provides DOM, CSS, events, and element DSLs for Kotlin/JS; `html/internal-html-core-runtime` bridges Compose runtime to browser rendering; `html/svg` adds SVG support; `html/test-utils` and `html/integration-core` provide browser/test infrastructure. The web runtime path is: Compose UI code -> JS/Wasm runtime adapter -> DOM/CSS output -> browser entry page and scripts.

6. Sample and showcase apps under `examples/` demonstrate how the libraries compose in real products. Most samples use a shared KMP module plus thin platform launchers for Android, desktop JVM, iOS, JS, or Wasm. These examples are important architecture references because they show the intended app structure: shared business/UI logic in `commonMain`, platform integration in entrypoint modules, and platform-specific resource or API adapters where needed.

7. The repo also contains benchmark suites under `benchmarks/`. These are organized by target (`desktop`, `ios`, `multiplatform`, `showcases`) and focus on performance characteristics of Compose primitives like text layout, lazy grids, shaders, visual effects, and complex lists. Benchmark outputs are compared and tracked with scripts such as `compare_benchmarks`, `find_degradation`, and iOS benchmark runners, so performance validation is a separate pipeline from functional testing.

8. Validation is spread across unit tests, integration tests, and generated-test-project fixtures. `gradle-plugins/compose/src/test/test-projects` and `html/compose-compiler-integration/testcases` are especially important: they are miniature projects used to verify code generation, packaging, compiler behavior, resource publication, web app variants, and platform-specific edge cases. The architecture relies heavily on “compile the fixture and compare the generated output” rather than only traditional runtime tests.

9. `ci/` holds release and publishing automation. There are build-helper modules, publishing tasks, Docker-based Linux test setup, release-note checks, and scripts for pushing artifacts to Maven-style repositories. This means the repo has a strong build/release boundary: source modules produce artifacts through Gradle, and CI validates, packages, signs, and publishes them.

10. `experimental/` contains incubating integrations that are not part of the stable core surface. Examples include CEF browser embedding for desktop, LWJGL/GLFW integration, and experimental components like a video player. These modules typically wrap lower-level native or desktop APIs and expose them to Compose-style UIs without changing the main framework architecture.

11. `compose/`, `docs/`, and `tutorials/` provide guidance, integration examples, and migration/usage documentation. They are not runtime subsystems, but they shape the architecture by documenting supported patterns such as iOS interop, web usage, native distribution packaging, and resource conventions.

12. A key architectural theme across the repo is platform specialization behind a common API. Shared Compose UI code is kept in common source sets; platform modules supply rendering backends, file/resource access, native views, packaging, or browser glue. When diagramming this repo, it helps to show a central shared core feeding multiple target-specific adapters, with build-time plugins and generated resource code sitting between source assets and runtime consumption.

Main entry points: [`components`](https://github.com/jetbrains/compose-multiplatform/tree/master/components) (Components), [`gradle-plugins/compose`](https://github.com/jetbrains/compose-multiplatform/tree/master/gradle-plugins/compose) (Compose plugin), [`html/core`](https://github.com/jetbrains/compose-multiplatform/tree/master/html/core) (HTML core), [`gradle-plugins/compose/src/test/test-projects`](https://github.com/jetbrains/compose-multiplatform/tree/master/gradle-plugins/compose/src/test/test-projects) (Integration fixtures)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_grp_core["Core product"]
  node_kmp_sources["KMP sources<br/>source-set model"]
  node_components_root["Components<br/>library family"]
  node_resources_lib[("Resources core<br/>runtime library")]
  node_splitpane["Split pane<br/>ui component"]
  node_animated_image["Animated image<br/>ui component"]
  node_preview_lib["UI preview<br/>tooling library"]
end

subgraph group_grp_build["Build tooling"]
  node_gradle_compose["Compose plugin<br/>gradle plugin"]
  node_plugin_resources["Plugin resources<br/>build pipeline"]
  node_plugin_desktop["Desktop packaging<br/>build pipeline"]
  node_plugin_web["Web packaging<br/>build pipeline"]
  node_ci["CI & release<br/>automation"]
end

subgraph group_grp_web["Web stack"]
  node_html_core["HTML core<br/>web library"]
  node_html_runtime["HTML runtime<br/>web runtime"]
  node_html_svg["SVG support<br/>web library"]
  node_html_test_utils["Web test utils<br/>test infra"]
end

subgraph group_grp_examples["Examples"]
  node_examples_root["Examples<br/>sample suite"]
  node_samples_kmp["Shared samples<br/>kmp app modules"]
  node_sample_web["Web samples<br/>browser demos"]
  node_sample_imageviewer["Image viewer<br/>sample app"]
end

subgraph group_grp_quality["Validation"]
  node_benchmarks["Benchmarks<br/>perf suite"]
  node_integration_tests["Integration fixtures<br/>test fixtures"]
end

subgraph group_grp_docs["Docs & experiments"]
  node_docs["Docs<br/>documentation"]
  node_experimental["Experimental<br/>incubation"]
end

node_repo["compose-multiplatform<br/>monorepo"]

node_repo -->|"organizes"| node_kmp_sources
node_repo -->|"contains"| node_components_root
node_repo -->|"builds with"| node_gradle_compose
node_repo -->|"includes"| node_html_core
node_repo -->|"showcases"| node_examples_root
node_repo -->|"measures"| node_benchmarks
node_repo -->|"publishes via"| node_ci
node_repo -->|"documents"| node_docs
node_repo -->|"incubates"| node_experimental
node_components_root -->|"centralizes"| node_resources_lib
node_components_root -->|"includes"| node_splitpane
node_components_root -->|"includes"| node_animated_image
node_components_root -->|"includes"| node_preview_lib
node_gradle_compose -->|"generates resources"| node_plugin_resources
node_gradle_compose -->|"packages apps"| node_plugin_desktop
node_gradle_compose -->|"configures web"| node_plugin_web
node_plugin_resources -->|"feeds runtime"| node_resources_lib
node_html_runtime -->|"adapts"| node_html_core
node_html_core -->|"extends"| node_html_svg
node_html_core -->|"tested by"| node_html_test_utils
node_samples_kmp -->|"follows"| node_kmp_sources
node_sample_imageviewer -->|"uses"| node_resources_lib
node_sample_web -->|"uses"| node_html_core
node_sample_web -->|"renders through"| node_html_runtime
node_benchmarks -->|"covers"| node_kmp_sources
node_integration_tests -->|"verifies"| node_gradle_compose
node_integration_tests -->|"checks"| node_plugin_resources
node_integration_tests -->|"checks"| node_plugin_web
node_ci -->|"publishes"| node_gradle_compose
node_ci -->|"publishes"| node_components_root
node_experimental -->|"extends"| node_components_root

click node_components_root "https://github.com/jetbrains/compose-multiplatform/tree/master/components"
click node_resources_lib "https://github.com/jetbrains/compose-multiplatform/tree/master/components/resources/library"
click node_splitpane "https://github.com/jetbrains/compose-multiplatform/tree/master/components/SplitPane/library"
click node_animated_image "https://github.com/jetbrains/compose-multiplatform/tree/master/components/AnimatedImage/library"
click node_preview_lib "https://github.com/jetbrains/compose-multiplatform/tree/master/components/ui-tooling-preview/library"
click node_gradle_compose "https://github.com/jetbrains/compose-multiplatform/tree/master/gradle-plugins/compose"
click node_plugin_resources "https://github.com/jetbrains/compose-multiplatform/tree/master/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/resources"
click node_plugin_desktop "https://github.com/jetbrains/compose-multiplatform/tree/master/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application"
click node_plugin_web "https://github.com/jetbrains/compose-multiplatform/tree/master/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/web"
click node_ci "https://github.com/jetbrains/compose-multiplatform/tree/master/ci"
click node_html_core "https://github.com/jetbrains/compose-multiplatform/tree/master/html/core"
click node_html_runtime "https://github.com/jetbrains/compose-multiplatform/tree/master/html/internal-html-core-runtime"
click node_html_svg "https://github.com/jetbrains/compose-multiplatform/tree/master/html/svg"
click node_html_test_utils "https://github.com/jetbrains/compose-multiplatform/tree/master/html/test-utils"
click node_examples_root "https://github.com/jetbrains/compose-multiplatform/tree/master/examples"
click node_samples_kmp "https://github.com/jetbrains/compose-multiplatform/tree/master/examples/chat"
click node_sample_web "https://github.com/jetbrains/compose-multiplatform/tree/master/examples/html"
click node_sample_imageviewer "https://github.com/jetbrains/compose-multiplatform/tree/master/examples/imageviewer"
click node_benchmarks "https://github.com/jetbrains/compose-multiplatform/tree/master/benchmarks"
click node_integration_tests "https://github.com/jetbrains/compose-multiplatform/tree/master/gradle-plugins/compose/src/test/test-projects"
click node_docs "https://github.com/jetbrains/compose-multiplatform/tree/master/docs"
click node_experimental "https://github.com/jetbrains/compose-multiplatform/tree/master/experimental"

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_kmp_sources,node_components_root,node_resources_lib,node_splitpane,node_animated_image,node_preview_lib toneBlue
class node_gradle_compose,node_plugin_resources,node_plugin_desktop,node_plugin_web,node_ci toneAmber
class node_html_core,node_html_runtime,node_html_svg,node_html_test_utils toneMint
class node_examples_root,node_samples_kmp,node_sample_web,node_sample_imageviewer toneRose
class node_benchmarks,node_integration_tests toneIndigo
class node_docs,node_experimental toneTeal
class node_repo toneNeutral
```

## Components

### Core product

Reusable runtime libraries and Compose-facing building blocks.

- **KMP sources**: source-set model · CommonMain plus platform-specific source sets such as androidMain, desktopMain, iosMain, jsMain, wasmJsMain, macosMain, and variants.
- [Components](https://github.com/jetbrains/compose-multiplatform/tree/master/components): library family · Reusable Compose libraries shipped to app authors. · `components`
- [Resources core](https://github.com/jetbrains/compose-multiplatform/tree/master/components/resources/library): runtime library · Cross-platform resource model, readers, caches, plural rules, vector parsing, and per-platform backends. · `components/resources/library`
- [Split pane](https://github.com/jetbrains/compose-multiplatform/tree/master/components/SplitPane/library): ui component · Split-pane layout and splitter primitives. · `components/SplitPane/library`
- [Animated image](https://github.com/jetbrains/compose-multiplatform/tree/master/components/AnimatedImage/library): ui component · Animated image loading and rendering support. · `components/AnimatedImage/library`
- [UI preview](https://github.com/jetbrains/compose-multiplatform/tree/master/components/ui-tooling-preview/library): tooling library · Preview annotations and platform-specific preview parameter support. · `components/ui-tooling-preview/library`

### Build tooling

Gradle plugins and CI automation that generate, package, and publish artifacts.

- [Compose plugin](https://github.com/jetbrains/compose-multiplatform/tree/master/gradle-plugins/compose): gradle plugin · Primary Gradle plugin that configures Compose projects, targets, packaging, resources, previews, and compatibility checks. · `gradle-plugins/compose`
- [Plugin resources](https://github.com/jetbrains/compose-multiplatform/tree/master/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/resources): build pipeline · Resource discovery, code generation, collectors, and target assembly for composeResources. · `gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/resources`
- [Desktop packaging](https://github.com/jetbrains/compose-multiplatform/tree/master/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application): build pipeline · JVM/native application packaging, signing, notarization, runtime layout, and distribution tasks. · `gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application`
- [Web packaging](https://github.com/jetbrains/compose-multiplatform/tree/master/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/web): build pipeline · Web application configuration and compatibility tasks for JS/Wasm bundles. · `gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/web`
- [CI & release](https://github.com/jetbrains/compose-multiplatform/tree/master/ci): automation · Publishing helpers, Docker-based validation, release checks, and artifact upload tooling. · `ci`

### Web stack

Browser-facing Compose Web runtime, DOM DSL, SVG, and test infrastructure.

- [HTML core](https://github.com/jetbrains/compose-multiplatform/tree/master/html/core): web library · DOM, CSS, attributes, events, and HTML element DSL for Kotlin/JS. · `html/core`
- [HTML runtime](https://github.com/jetbrains/compose-multiplatform/tree/master/html/internal-html-core-runtime): web runtime · Bridges Compose runtime to browser rendering and snapshot dispatch. · `html/internal-html-core-runtime`
- [SVG support](https://github.com/jetbrains/compose-multiplatform/tree/master/html/svg): web library · SVG-specific Compose Web APIs. · `html/svg`
- [Web test utils](https://github.com/jetbrains/compose-multiplatform/tree/master/html/test-utils): test infra · Browser test helpers and Karma/Selenium support. · `html/test-utils`

### Examples

Sample apps and showcase projects demonstrating intended repository usage.

- [Examples](https://github.com/jetbrains/compose-multiplatform/tree/master/examples): sample suite · Representative apps showing KMP structure, platform launchers, and resource usage. · `examples`
- [Shared samples](https://github.com/jetbrains/compose-multiplatform/tree/master/examples/chat): kmp app modules · CommonMain application logic with thin Android, desktop, iOS, JS, or Wasm launchers. · `examples/chat`
- [Web samples](https://github.com/jetbrains/compose-multiplatform/tree/master/examples/html): browser demos · Compose Web examples and browser demos. · `examples/html`
- [Image viewer](https://github.com/jetbrains/compose-multiplatform/tree/master/examples/imageviewer): sample app · Large multiplatform sample with shared UI and platform-specific integrations. · `examples/imageviewer`

### Validation

Benchmarks, integration fixtures, and automated checks.

- [Benchmarks](https://github.com/jetbrains/compose-multiplatform/tree/master/benchmarks): perf suite · Desktop, iOS, multiplatform, and showcase benchmarks plus comparison scripts. · `benchmarks`
- [Integration fixtures](https://github.com/jetbrains/compose-multiplatform/tree/master/gradle-plugins/compose/src/test/test-projects): test fixtures · Generated-project and compiler-behavior fixtures used to validate plugin and web integration. · `gradle-plugins/compose/src/test/test-projects`

### Docs & experiments

Documentation, migration guidance, and incubating integrations.

- [Docs](https://github.com/jetbrains/compose-multiplatform/tree/master/docs): documentation · Repository guides, FAQs, tutorials, and usage documentation. · `docs`
- [Experimental](https://github.com/jetbrains/compose-multiplatform/tree/master/experimental): incubation · Incubating integrations and components not part of the stable surface. · `experimental`

### Other components

- **compose-multiplatform**: monorepo · Top-level repository for Compose Multiplatform libraries, tooling, samples, and experiments.

## Connections

- compose-multiplatform → KMP sources: organizes · Repository structure is defined around shared and platform-specific KMP source sets.
- compose-multiplatform → Components: contains · Core reusable libraries live under components/.
- compose-multiplatform → Compose plugin: builds with · The main Compose Gradle plugin orchestrates build and packaging behavior.
- compose-multiplatform → HTML core: includes · Web libraries and runtimes are a major repository subsystem.
- compose-multiplatform → Examples: showcases · Examples demonstrate intended usage of the libraries and build tooling.
- compose-multiplatform → Benchmarks: measures · Performance validation is separated into benchmark suites.
- compose-multiplatform → CI & release: publishes via · CI handles release and artifact publishing.
- compose-multiplatform → Docs: documents · Docs and tutorials describe supported patterns and workflows.
- compose-multiplatform → Experimental: incubates · Experimental integrations sit outside the stable core surface.
- Components → Resources core: centralizes · Resource handling is the most cross-cutting component subsystem.
- Components → Split pane: includes · Split-pane UI is one of the reusable component libraries.
- Components → Animated image: includes · Animated image support is shipped as a reusable component library.
- Components → UI preview: includes · Preview tooling is provided as a component library.
- Compose plugin → Plugin resources: generates resources · The plugin turns composeResources into generated Kotlin APIs and collectors.
- Compose plugin → Desktop packaging: packages apps · Desktop application packaging, signing, and runtime setup are configured here.
- Compose plugin → Web packaging: configures web · Web application targets and compatibility tasks are configured here.
- Plugin resources → Resources core: feeds runtime · Generated accessors and collectors are consumed by the runtime resource library.
- HTML runtime → HTML core: adapts · Compose runtime rendering is bridged into the DOM/CSS DSL.
- HTML core → SVG support: extends · SVG APIs build on top of the base web DSL.
- HTML core → Web test utils: tested by · Browser-level helpers support the web library's tests and fixtures.
- Shared samples → KMP sources: follows · Samples use commonMain plus thin platform entrypoints.
- Image viewer → Resources core: uses · The image viewer relies heavily on shared Compose resources and platform backends.
- Web samples → HTML core: uses · Web demos are built on the HTML/DOM Compose Web DSL.
- Web samples → HTML runtime: renders through · Browser samples reach the DOM through the internal runtime bridge.
- Benchmarks → KMP sources: covers · Benchmarks are organized by target-specific source sets and launchers.
- Integration fixtures → Compose plugin: verifies · Generated fixtures exercise plugin behavior, packaging, and resource generation.
- Integration fixtures → Plugin resources: checks · Resource codegen and publication behavior are validated via miniature projects.
- Integration fixtures → Web packaging: checks · Web variants and compatibility paths are validated with fixture projects.
- CI & release → Compose plugin: publishes · CI assists with plugin release, build helpers, and artifact upload.
- CI & release → Components: publishes · Component artifacts are built and published through CI tooling.
- Experimental → Components: extends · Incubating UI components reuse the same component architecture.
