Skip to content

Getting Started

Maryk runs on Kotlin Multiplatform and ships as modular artifacts. This guide shows the minimal setup and a first round‑trip from model → object → validation → serialization → storage.

Add the core dependency to your target(s):

dependencies {
implementation("io.maryk:maryk-core:<version>")
}

For stores, add one engine:

// In-memory (tests/dev)
implementation("io.maryk:store-memory:<version>")
// Embedded RocksDB (apps/servers)
implementation("io.maryk:store-rocksdb:<version>")
// FoundationDB (JVM server)
implementation("io.maryk:store-foundationdb:<version>")
object Person : RootDataModel<Person>() {
val firstName by string(index = 1u)
val lastName by string(index = 2u)
val dateOfBirth by date(index = 3u)
}

Create and validate:

val john = Person.create {
firstName with "John"
lastName with "Smith"
dateOfBirth with LocalDate(2017, 12, 5)
}
Person.validate(john)
val json = Person.writeJson(john)
val fromJson = Person.readJson(json)

Also see YAML/ProtoBuf in Serialization.

Use in‑memory for tests:

InMemoryDataStore.open(
keepAllVersions = true,
dataModelsById = mapOf(1u to Person)
).use { store ->
store.execute(Person.add(john))
}

Then advance to Stores for RocksDB or FoundationDB and migration tips.

Use the CLI to explore models and records, run scans, and edit values without writing code.

Use the Maryk App for a desktop UI to browse models and edit records.

Terminal window
./gradlew :app:run
  • Learn how models and properties work in Data design.
  • Explore queries, filters, and aggregations in Querying.
  • Check out how to persist data in Stores.
  • Browse and edit data interactively with the CLI.