marykdb / maryk

Maryk is a Kotlin Multiplatform library which helps you to store, query and send data in a structured way over multiple platforms. The data store stores any value with a version, so it is possible to request only the changed data or live listen for updates.
Apache License 2.0
8 stars 1 forks source link
data database graph json kotlin kotlin-multiplatform rocksdb serialization versioned yaml

GitHub license Download

Maryk: Cross-Platform Data Modeling and Storage

Maryk is a Kotlin Multiplatform project designed for developers to define, validate, serialize, and store data models across various platforms, including iOS, macOS, Android, JVM, and JavaScript. Currently, storage is only supported on the JVM.

With Maryk, you can create complex data structures that facilitate efficient and seamless cross-platform communication. It features a fully version-aware data store and query engine, making it an excellent choice for managing and storing data in Kotlin-based applications.

Features

Getting Started

To get started with Maryk, follow these steps:

  1. Add Maryk's Core Dependency: Include Maryk's core dependency in your Kotlin Multiplatform project Gradle configuration:

    implementation "io.maryk:maryk-core:$version"
  2. Define Your Data Models: Create your data models using Kotlin:

    object Person : RootDataModel<Person>() { 
       val firstName by string(index = 1u)
       val lastName by string(index = 2u)
       val dateOfBirth by date(index = 3u)
    }
  3. Create and Validate Data Objects: Instantiate and validate your data objects:

    val johnSmith = Person.run {
       create(
           firstName with "John",
           lastName with "Smith",
           dateOfBirth with LocalDate(2017, 12, 5),
       )
    }
    
    // Validate the object
    Person.validate(johnSmith) 
  4. Serialize Your Data Objects: Serialize your data objects in your preferred format (e.g., JSON, YAML, or ProtoBuf) and deserialize them on another platform:

    User.writeJson(user, jsonWriter)
    
    val user = User.readJson(reader)
  5. Choose an Appropriate Data Store: Select a suitable data store for efficient storage and querying of your data objects. Available implementations include:

Documentation

For more details on how to use Maryk, explore the documentation within the modules of the project repository. All core projects are multi-platform Kotlin projects, supporting JS, macOS, iOS, Android, and the JVM.

Contributing

We welcome feature requests, issue reports, and merge requests from the community. Feel free to open issues or submit pull requests on the GitHub repository.