Flexible ORM simplifying database CRUD on plain classes with annotation-free mapping, lazy loading, coroutine-based transactions, paginated queries, stored-procedure support, composite-key handling, and native driver access.
Stormify is a free and open source ORM library for Kotlin Multiplatform, released under the Apache 2.0 License. It simplifies database interactions with minimal configuration, operating on plain Kotlin classes without requiring extensive annotations or XML setups, as long as field names match database columns.
Designed for developers seeking a simple yet powerful ORM, Stormify excels in projects that favor convention over configuration, allowing for minimal setup and clean, straightforward code.
IN clauses.by db() delegates for automatic lazy loading of related entities.PagedList<T> for UI grids (ZK/Compose/Swing) and PagedQuery<T> for stateless REST endpoints — filters, sorting, FK traversal, aggregations, facet counts, and streaming iteration over very large result sets.git apply-ready patch — interactively as a TUI, or headless for CI hooks.Gradle (all targets — JVM, Android, Kotlin Multiplatform):
plugins {
id("onl.ycode.stormify") version "2.6.0"
}Maven (pure Java):
<dependency>
<groupId>onl.ycode</groupId>
<artifactId>stormify-jvm</artifactId>
<version>2.6.0</version>
</dependency>Supported native databases: PostgreSQL, MariaDB/MySQL, Oracle, MSSQL, SQLite. On iOS, only SQLite is available.
See Installation for configuration options and native runtime libraries.
Upgrading from V1? See the V1 to V2 migration guide.
Stormify works with any JDBC DataSource. The examples below use HikariCP, but any connection pool or plain driver will work.
Kotlin (JVM):
val config = HikariConfig("databaseConfig.properties")
val dataSource = HikariDataSource(config)
val stormify = Stormify(dataSource)Java:
HikariConfig config = new HikariConfig("databaseConfig.properties");
HikariDataSource dataSource = new HikariDataSource(config);
StormifyJ stormify = new StormifyJ(dataSource);Android:
val db = context.openOrCreateDatabase("mydb.db", Context.MODE_PRIVATE, null)
val stormify = Stormify(db)Native:
val ds = KdbcDataSource("jdbc:postgresql://localhost:5432/mydb", "user", "pass")
val stormify = Stormify(ds)Define a simple Kotlin class. The library automatically maps fields based on their names.
For a table CREATE TABLE test (id INT PRIMARY KEY, name VARCHAR(255)):
@DbTable("test") // optional on JVM — class name is used by default
data class Test(
@DbField(primaryKey = true)
var id: Int = 0,
var name: String = ""
)Mark primary keys with @DbField(primaryKey = true), or register a primary key resolver to detect them by naming convention.
// Create
val record = stormify.create(Test(id = 1, name = "Test Entry"))
// Read
val results = stormify.read<Test>("SELECT * FROM test")
// Update
record.name = "Updated Entry"
stormify.update(record)
// Delete
stormify.delete(record)Kotlin:
stormify.transaction {
val user = stormify.create(User(email = "test@example.com"))
stormify.create(Profile(userId = user.id, name = "Test User"))
stormify.update(account)
}Java:
stormify.transaction(() -> {
User user = stormify.create(new User("test@example.com"));
stormify.create(new Profile(user.getId(), "Test User"));
stormify.update(account);
});// Query with parameters
val users = stormify.read<User>("SELECT * FROM users WHERE age > ?", 25)
// Single result
val user = stormify.readOne<User>("SELECT * FROM users WHERE id = ?", 1)
// Find by ID
val user = stormify.findById<User>(1)Runnable example projects live in a separate repository: stormify-examples. They cover JVM (Kotlin & Java — both Maven and Gradle with type-safe paths), Android, iOS, Kotlin/Native (Linux, Windows, macOS), and Kotlin Multiplatform.
Clone them standalone:
git clone -b 2.6.0 https://github.com/teras/stormify-examples.gitOr pull them directly inside this repo as a submodule:
git submodule update --init --recursiveEach subfolder is a self-contained project with its own README.md explaining how to build and run it. See the Examples overview for a short description of each.
Stormify ships with a companion CLI, schema-sync, that reconciles a live database with the Kotlin entity sources in your project. Point it at a JDBC URL and one or more source roots; it introspects every table and view, pairs each with its matching entity, and stages two kinds of change:
CREATE TABLE / ALTER TABLE … ADD) for fields
the entities have but the database doesn't, and.kt entity files, plus brand-new entity
files for tables that don't have one yet.In the interactive flow, those Kotlin edits aren't dumb text patches —
schema-sync embeds the full Kotlin compiler and rewrites entity classes
through PSI, so existing imports, formatting, comments, constructor style,
and by db() delegate conventions in the file are preserved. New properties
are spliced into the right class body with the correct supertype, naming
policy, and FK references resolved to your existing entities.
The interactive TUI is a four-pane workspace — tables, entities, properties,
and a live diff that previews exactly what will be written. An n-gram
classifier trained on your already-synced columns suggests the right type
slot for new fields; per-category slots, per-dialect defaults, naming policy,
and Kotlin-side preferences all live in .schema-sync.toml and travel with
the repo. A bulk-classify view assigns slots across hundreds of columns at
once; a tabbed apply view shows the patched source of every affected entity
file alongside the migration SQL before anything hits disk; a configuration
window edits everything in the TOML without leaving the tool. Themes,
keyboard-only navigation, and a built-in help dialog round it off.
A headless mode also exists for pre-commit hooks and CI gates — same engine,
same output, but the Kotlin edits land as a git apply-ready patch instead
of touching files directly, so CI can fail cleanly when the schema drifts.
See the Schema Sync guide for the full feature tour, configuration reference, and per-dialect notes.
A quick side-by-side against common Kotlin and Java ORMs. See the full comparison for reflection behaviour, compile-time metadata, narrative context, and when to pick each.
| Stormify | Exposed | Ktorm | Komapper | SQLDelight | Hibernate | |
|---|---|---|---|---|---|---|
| Multiplatform · JVM + Android + native + iOS | ✓ | JVM + Android | JVM | JVM | ✓ | JVM |
| Native DB drivers · no JDBC required | ✓ | — | — | — | SQLite only | — |
| Facet-aware paged queries, built-in | ✓ | — | — | — | — | — |
| Any class as entity | ✓ | — | — | — | — | — |
| Accepts JPA annotations | ✓ | — | — | — | — | ✓ |
| Suspend / coroutines API | ✓ | ✓ | — | ✓ | ✓ | — |
| Lazy reference delegates | ✓ | DAO only | eager only | — | — | ✓ |
| Stored procedures (in/out/inout) | ✓ | manual | manual | — | — | ✓ |
Full documentation is available at stormify.org/docs.
Contributions are welcome! Please check the Contributing guide for instructions on how to get involved, report issues, or submit pull requests.
Stormify is licensed under the Apache License 2.0. You are free to use, modify, and distribute this library in accordance with the terms of the license.
Enjoy using Stormify? Please star this repository to show your support!
Stormify is a free and open source ORM library for Kotlin Multiplatform, released under the Apache 2.0 License. It simplifies database interactions with minimal configuration, operating on plain Kotlin classes without requiring extensive annotations or XML setups, as long as field names match database columns.
Designed for developers seeking a simple yet powerful ORM, Stormify excels in projects that favor convention over configuration, allowing for minimal setup and clean, straightforward code.
IN clauses.by db() delegates for automatic lazy loading of related entities.PagedList<T> for UI grids (ZK/Compose/Swing) and PagedQuery<T> for stateless REST endpoints — filters, sorting, FK traversal, aggregations, facet counts, and streaming iteration over very large result sets.git apply-ready patch — interactively as a TUI, or headless for CI hooks.Gradle (all targets — JVM, Android, Kotlin Multiplatform):
plugins {
id("onl.ycode.stormify") version "2.6.0"
}Maven (pure Java):
<dependency>
<groupId>onl.ycode</groupId>
<artifactId>stormify-jvm</artifactId>
<version>2.6.0</version>
</dependency>Supported native databases: PostgreSQL, MariaDB/MySQL, Oracle, MSSQL, SQLite. On iOS, only SQLite is available.
See Installation for configuration options and native runtime libraries.
Upgrading from V1? See the V1 to V2 migration guide.
Stormify works with any JDBC DataSource. The examples below use HikariCP, but any connection pool or plain driver will work.
Kotlin (JVM):
val config = HikariConfig("databaseConfig.properties")
val dataSource = HikariDataSource(config)
val stormify = Stormify(dataSource)Java:
HikariConfig config = new HikariConfig("databaseConfig.properties");
HikariDataSource dataSource = new HikariDataSource(config);
StormifyJ stormify = new StormifyJ(dataSource);Android:
val db = context.openOrCreateDatabase("mydb.db", Context.MODE_PRIVATE, null)
val stormify = Stormify(db)Native:
val ds = KdbcDataSource("jdbc:postgresql://localhost:5432/mydb", "user", "pass")
val stormify = Stormify(ds)Define a simple Kotlin class. The library automatically maps fields based on their names.
For a table CREATE TABLE test (id INT PRIMARY KEY, name VARCHAR(255)):
@DbTable("test") // optional on JVM — class name is used by default
data class Test(
@DbField(primaryKey = true)
var id: Int = 0,
var name: String = ""
)Mark primary keys with @DbField(primaryKey = true), or register a primary key resolver to detect them by naming convention.
// Create
val record = stormify.create(Test(id = 1, name = "Test Entry"))
// Read
val results = stormify.read<Test>("SELECT * FROM test")
// Update
record.name = "Updated Entry"
stormify.update(record)
// Delete
stormify.delete(record)Kotlin:
stormify.transaction {
val user = stormify.create(User(email = "test@example.com"))
stormify.create(Profile(userId = user.id, name = "Test User"))
stormify.update(account)
}Java:
stormify.transaction(() -> {
User user = stormify.create(new User("test@example.com"));
stormify.create(new Profile(user.getId(), "Test User"));
stormify.update(account);
});// Query with parameters
val users = stormify.read<User>("SELECT * FROM users WHERE age > ?", 25)
// Single result
val user = stormify.readOne<User>("SELECT * FROM users WHERE id = ?", 1)
// Find by ID
val user = stormify.findById<User>(1)Runnable example projects live in a separate repository: stormify-examples. They cover JVM (Kotlin & Java — both Maven and Gradle with type-safe paths), Android, iOS, Kotlin/Native (Linux, Windows, macOS), and Kotlin Multiplatform.
Clone them standalone:
git clone -b 2.6.0 https://github.com/teras/stormify-examples.gitOr pull them directly inside this repo as a submodule:
git submodule update --init --recursiveEach subfolder is a self-contained project with its own README.md explaining how to build and run it. See the Examples overview for a short description of each.
Stormify ships with a companion CLI, schema-sync, that reconciles a live database with the Kotlin entity sources in your project. Point it at a JDBC URL and one or more source roots; it introspects every table and view, pairs each with its matching entity, and stages two kinds of change:
CREATE TABLE / ALTER TABLE … ADD) for fields
the entities have but the database doesn't, and.kt entity files, plus brand-new entity
files for tables that don't have one yet.In the interactive flow, those Kotlin edits aren't dumb text patches —
schema-sync embeds the full Kotlin compiler and rewrites entity classes
through PSI, so existing imports, formatting, comments, constructor style,
and by db() delegate conventions in the file are preserved. New properties
are spliced into the right class body with the correct supertype, naming
policy, and FK references resolved to your existing entities.
The interactive TUI is a four-pane workspace — tables, entities, properties,
and a live diff that previews exactly what will be written. An n-gram
classifier trained on your already-synced columns suggests the right type
slot for new fields; per-category slots, per-dialect defaults, naming policy,
and Kotlin-side preferences all live in .schema-sync.toml and travel with
the repo. A bulk-classify view assigns slots across hundreds of columns at
once; a tabbed apply view shows the patched source of every affected entity
file alongside the migration SQL before anything hits disk; a configuration
window edits everything in the TOML without leaving the tool. Themes,
keyboard-only navigation, and a built-in help dialog round it off.
A headless mode also exists for pre-commit hooks and CI gates — same engine,
same output, but the Kotlin edits land as a git apply-ready patch instead
of touching files directly, so CI can fail cleanly when the schema drifts.
See the Schema Sync guide for the full feature tour, configuration reference, and per-dialect notes.
A quick side-by-side against common Kotlin and Java ORMs. See the full comparison for reflection behaviour, compile-time metadata, narrative context, and when to pick each.
| Stormify | Exposed | Ktorm | Komapper | SQLDelight | Hibernate | |
|---|---|---|---|---|---|---|
| Multiplatform · JVM + Android + native + iOS | ✓ | JVM + Android | JVM | JVM | ✓ | JVM |
| Native DB drivers · no JDBC required | ✓ | — | — | — | SQLite only | — |
| Facet-aware paged queries, built-in | ✓ | — | — | — | — | — |
| Any class as entity | ✓ | — | — | — | — | — |
| Accepts JPA annotations | ✓ | — | — | — | — | ✓ |
| Suspend / coroutines API | ✓ | ✓ | — | ✓ | ✓ | — |
| Lazy reference delegates | ✓ | DAO only | eager only | — | — | ✓ |
| Stored procedures (in/out/inout) | ✓ | manual | manual | — | — | ✓ |
Full documentation is available at stormify.org/docs.
Contributions are welcome! Please check the Contributing guide for instructions on how to get involved, report issues, or submit pull requests.
Stormify is licensed under the Apache License 2.0. You are free to use, modify, and distribute this library in accordance with the terms of the license.
Enjoy using Stormify? Please star this repository to show your support!