Skip to content

Module Structure

All shared code lives in the kmp/ module. The module targets four platforms from a single source tree.

Source setPurpose
commonMainPlatform-agnostic UI, domain logic, repositories, database abstraction, and parser. This is where most feature work happens.
jvmMainDesktop entry point (Main.kt), file watching with Java NIO, and JVM-specific logging configuration.
androidMainAndroid entry point and the SQLDelight driver factory for Android’s bundled SQLite.
iosMainSQLDelight driver for iOS. The iOS target is currently disabled in the default build.
wasmJsMainCompose/Wasm web target. Enabled via gradle.properties enableJs=true.
jvmTestJVM UI and integration tests. Uses Roborazzi for Compose screenshot assertions.
commonTestShared test utilities and helpers available across all test source sets.
businessTestBusiness logic tests without UI dependencies. Fastest to run; no Compose runtime required.
kotlin/dev/stapler/stelekit/
ui/ # Compose UI — screens, components, App.kt
repository/ # Page, Block, Search, Journal repositories
db/ # GraphManager, GraphLoader, GraphWriter
model/ # Page, Block, Property data classes
parser/ # Markdown parser
outliner/ # OutlinerPipeline — builds block trees from parsed markdown
platform/ # Platform abstractions (file access, logging)
FileRole
kmp/build.gradle.ktsAll dependencies, KMP targets, and SQLDelight configuration
kmp/src/commonMain/.../ui/App.ktRoot Compose composable and screen routing logic
kmp/src/commonMain/.../ui/AppState.ktGlobal UI flags: sidebar, search dialog, command palette
kmp/src/commonMain/.../db/GraphManager.ktMulti-graph lifecycle — adds, removes, and scopes graphs
kmp/src/commonMain/.../db/GraphLoader.ktReads markdown from disk and triggers parsing
kmp/src/commonMain/.../db/GraphWriter.ktWrites blocks to disk and detects external file conflicts
kmp/src/commonMain/.../model/Models.ktPage, Block, and Property data classes with built-in validation
kmp/src/commonMain/.../repository/RepositoryFactory.ktSelects IN_MEMORY or SQLDELIGHT backend
kmp/src/jvmMain/.../desktop/Main.ktDesktop application entry point
kmp/src/commonMain/sqldelight/.../SteleDatabase.sqSQLDelight schema — source of truth for all database types
  1. Define the interface in commonMain/platform/
  2. Implement it in the target source set (jvmMain, androidMain, etc.)
  3. Inject via the RepositoryFactory or constructor parameter
  4. Test the common logic in businessTest with an IN_MEMORY backend

For UI-only additions, work entirely in commonMain/ui/. Compose Multiplatform renders the same composables on all targets.