How jetbrains/compose-multiplatform works
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 Components · compose Compose plugin · core HTML core · test-projects Integration fixtures
Components 24
Core product
Reusable runtime libraries and Compose-facing building blocks.
- KMP sources · CommonMain plus platform-specific source sets such as androidMain, desktopMain, iosMain, jsMain, wasmJsMain, macosMain, and variants.
- Components · Reusable Compose libraries shipped to app authors.
components - Resources core · Cross-platform resource model, readers, caches, plural rules, vector parsing, and per-platform backends.
components/resources/library - Split pane · Split-pane layout and splitter primitives.
components/SplitPane/library - Animated image · Animated image loading and rendering support.
components/AnimatedImage/library - UI preview · 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 · Primary Gradle plugin that configures Compose projects, targets, packaging, resources, previews, and compatibility checks.
gradle-plugins/compose - Plugin resources · Resource discovery, code generation, collectors, and target assembly for composeResources.
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/resources - Desktop packaging · JVM/native application packaging, signing, notarization, runtime layout, and distribution tasks.
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application - Web packaging · Web application configuration and compatibility tasks for JS/Wasm bundles.
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/web - CI & release · 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 · DOM, CSS, attributes, events, and HTML element DSL for Kotlin/JS.
html/core - HTML runtime · Bridges Compose runtime to browser rendering and snapshot dispatch.
html/internal-html-core-runtime - SVG support · SVG-specific Compose Web APIs.
html/svg - Web test utils · Browser test helpers and Karma/Selenium support.
html/test-utils
Examples
Sample apps and showcase projects demonstrating intended repository usage.
- Examples · Representative apps showing KMP structure, platform launchers, and resource usage.
examples - Shared samples · CommonMain application logic with thin Android, desktop, iOS, JS, or Wasm launchers.
examples/chat - Web samples · Compose Web examples and browser demos.
examples/html - Image viewer · Large multiplatform sample with shared UI and platform-specific integrations.
examples/imageviewer
Validation
Benchmarks, integration fixtures, and automated checks.
- Benchmarks · Desktop, iOS, multiplatform, and showcase benchmarks plus comparison scripts.
benchmarks - Integration 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 · Repository guides, FAQs, tutorials, and usage documentation.
docs - Experimental · Incubating integrations and components not part of the stable surface.
experimental
Other components
- compose-multiplatform · Top-level repository for Compose Multiplatform libraries, tooling, samples, and experiments.
Connections 31
- 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.