An instant runtime for Jetpack Compose code. No compiler, no build, no waiting.
Write Compose code, see it render in milliseconds, on Android, iOS, desktop and the web.
- The problem
- How Fast Compose works
- KMP Library
- Where you can use Fast Compose
- Structure
- Building and testing
- Documentation
- License
Jetpack Compose is a joy to write and a pain to iterate on. Every change, even a padding value, has to go through the full toolchain before you see a single pixel:
On a device: edit ─▶ compile (Kotlin + Compose compiler plugin) ─▶ dex ─▶ package APK ─▶ install ─▶ run ─▶ see it
In a preview: edit ─▶ compile (Kotlin + Compose compiler plugin) ─▶ render in a JVM ─▶ see it
Hot reload tools shorten the loop by skipping the restart, but not the compiler:
Hot reload: edit ─▶ compile the changed code ─▶ swap the new classes into the running app ─▶ recompose ─▶ see it
- Live Edit (Android Studio) compiles the changed functions and redefines their classes in the app running on a device or emulator, then recomposes. Changes to signatures or classes need a full restart.
- Compose Hot Reload (JetBrains) recompiles the changed files with Gradle and reloads the classes in a desktop JVM app running on the JetBrains Runtime, keeping its state. It works only for the desktop target.
Previews, Live Edit and Compose Hot Reload all still need a compiler, a build and a JVM or device behind them. None of them can run inside a web page, a documentation site or a lightweight editor.
Fast Compose skips the compiler entirely. It reads Compose source code like a browser reads HTML:
flowchart LR
A["Kotlin source<br/>(a String)"] --> B["Parser<br/>pure Kotlin"]
B --> C["Syntax tree"]
C --> D["Interpreter<br/>runs inside composition"]
D --> E["Bindings<br/>Text, Column, Button, …"]
D --> G["Library code<br/>JVM, through reflection"]
E --> F["Real Jetpack Compose<br/>real pixels"]
G --> F
- Parse. A hand-written Kotlin lexer and parser turn the source into a syntax tree. It is pure Kotlin Multiplatform code, with no dependency on the Kotlin compiler, so it runs on Android, iOS, desktop and in the browser.
- Interpret. The interpreter walks the tree inside a real Compose composition.
remember, state, recomposition, effects and coroutines are the real Compose runtime, not a simulation. - Bind. When the code calls
Text(...)orModifier.padding(...), a binding calls the real Compose API with the evaluated arguments. What you see is exactly what Compose draws. - Library code. On the JVM (the IDE plugin, desktop), APIs without a binding run from the project's library jars through reflection, including library composables. Elsewhere, and for anything not found, a stand-in keeps the rest of the screen rendering, with a warning.
There is no code generation, no bytecode and no server. Edits re-render after a 150 ms typing pause; parsing runs in the background, and only the changed program is interpreted again.
See docs/PERFORMANCE.md for measured speed, recomposition and the time limit.
dependencies {
implementation("io.github.fast-compose:fast-compose:x.y.z")
}Replace x.y.z with the latest version, shown above.
Pass Compose code as text, and every @Preview in it is rendered:
@Composable
fun App() {
val code = rememberComposeCode("""
@Preview
@Composable
fun Hello() {
Text("Hello, Fast Compose!")
}
""".trimIndent())
FastComposePreview(code)
}See docs/LIBRARY.md for every composable and option: FastComposePreview,
BasicComposePreview, FastComposeContent, FastComposeLogs, registries and your own components, resources,
network images and multiple files.
Fast Compose Playground runs composables on the web, desktop and mobile. Write Compose, see it live: no install, no compile server, no waiting.
Plugins for Android Studio and IntelliJ IDEA and
VS Code render @Preview functions as you type, with no Kotlin
compiler, no Compose compiler plugin and no JVM preview process.
compose-script embeds live, editable Compose snippets in any static page: documentation, blogs, tutorials and design system catalogs.
Add one script to the page:
<script src="https://cdn.jsdelivr.net/npm/@fast-compose/compose-script/compose-script.js"></script>Then write Compose anywhere in the page:
<script type="text/compose-content">
Column {
Text("Hello from Compose!")
Button(onClick = {}) {
Text("Click me")
}
}
</script>Fast Compose CLI checks and renders @Preview functions from the
terminal, in CI, or as an MCP server that AI agents call while they write UI code. No Gradle, no compiler, no Android
Studio.
fast-compose check -r app/src
fast-compose render HomeScreen.kt --dark --size tablet -o previewsAdd it to an AI agent, such as Claude Code:
claude mcp add --scope user fast-compose -- fast-compose mcpDownload it for Windows, macOS or Linux from the releases; it includes its own Java runtime.
Fast Compose is published as one artifact, io.github.fast-compose:fast-compose, for Android, iOS, JVM, JS and Wasm.
Its sources in fast-compose are grouped by package, in layers:
flowchart BT
parser --> interpreter
interpreter --> bindings
bindings --> ui
Package ma7moud3ly.fast.compose.* |
Contents |
|---|---|
parser |
Kotlin lexer and parser: source code to syntax tree |
interpreter |
Runs the syntax tree inside composition; Registry, BindingPack, multi-file loading, ExternalResolver |
interpreter.jvm |
JVM only: JarResolver, running library code and composables through reflection; GradleJars |
project |
For hosts: project files (ProjectFiles, DiskFiles), KotlinSources, FolderSources, GradleLayout |
bindings.foundation |
Layouts, text, state, modifiers, drawing, effects, gestures, animation |
bindings.material3 |
Material 3 components, theming and defaults |
bindings.icons |
Material icons (Icons.Default.*, Icons.Filled.*, Icons.Outlined.*, Icons.AutoMirrored.*) |
bindings.resources |
R/Res, painterResource, stringResource, colorResource, resource providers |
bindings.coil |
Network images: Coil AsyncImage and rememberAsyncImagePainter |
ui |
FastComposePreview, BasicComposePreview, FastComposeContent, FastComposeLogs, presets |
Not published: binding-check checks every binding against the AndroidX API files and measures
coverage, and app is the demo app.
See docs/BUILDING.md for requirements, running the demo app, tests, benchmarks and releases.
| Document | About |
|---|---|
| docs/LIBRARY.md | Every composable and option of the library, and library code on the JVM |
| docs/BINDINGS.md | Writing bindings and packs, network images, the binding check |
| docs/RESOURCES.md | Images and strings from R/Res, and where their files come from |
| docs/MULTIPLE_FILES.md | Previews that use other files of a project |
| docs/PERFORMANCE.md | Interpreter speed, recomposition, time limit and benchmarks |
| docs/COVERAGE.md | What it can run, limitations and Compose API coverage |
| docs/BUILDING.md | Building, testing, benchmarks and releases |
Fast Compose is licensed under the Apache License 2.0.