I am building something to achieve mongoose like experience in kotlin

Introduction

Node.js is the best when it comes to community support and simplicity.
But, when it comes to the language itself and the builtin features, Yuk!
I was used to a lot of libraries in Node.js and that what held me from
going all in server-side Kotlin.
After the introduction of ktor and kgraphql, it was mongoose the only
library left to have an alternative in kotlin!

So, I thought I could make mongoose in Kotlin :drooling_face:

The strategy

Building a database client from zero is tough!
So, our kotlin mongoose will depend on kmongo

Kotlin is totally different than typescript and type-unions
is not supported and not the kotlin way of doing stuff.
So, our kotlin mongoose will follow the design of kgraphql

What have been done

I already made a mongoose in kotlin (called it mangaka)
I will publish it soon at https://github.com/cufyorg/mangaka

Whats next?

Kotlin mongoose (mangaka) is still in alpha stage and needs
a lot of testing and extra design thoughts and more built-in utilities

So, I need someone to test and think with me about it

Just a teaser


val EntitySchema = DocumentSchema(Entity::class) {
    field("Hello") {
        this extends StringSchema()

        getter = { self.hello }
        setter = { self.hello = it }
    }
    field(Entity::value) {
        this extends StringSchema()

        default { "Mangaka Initialized" }
        validator { it != "Some Value" }
        immutable { self.frozen }
    }
    field(Entity::frozen) {
        this extends BooleanSchema()
    }
    field(Entity::someNewValue) {
        this extends StringSchema()

        default { "Hello World" }
    }
    field(Entity::kind) {
        this extends EnumSchema(Kind::class)
    }
}

Mangaka is now available at GitHub - cufyorg/mangaka: A mongoose equivalent for kotlin :partying_face: