Skip to content

dariopellegrini/KDone

Repository files navigation

KDone

Ktor powered configurator for RESTful API, with authentication.

KDone is an abstraction over Ktor that allows to configure and manage a RESTful backend with models, users, authorization and file upload. KDone makes a plenty use of Kotlin DSL and Ktor APIs, giving developers a declarative and fast way to write a Kotlin REST server from scratch.

Installation

Add jitpack to your repositories

repositories {
        ...
        maven { url 'https://jitpack.io' }
    }

Then add as Kdone dependency

dependencies {
    ...
    implementation 'com.github.dariopellegrini:KDone:v0.5.1'
}

Getting started

KDone's configuration is done using Kotlin DSL, declaring server logic through its models and user logic.

First create a model

data class Game(
    val name: String,
    val platform: Platform?,
    val players: Int?,
    val image: ResourceFile?,
    val secondImage: ResourceFile?): Identifiable()

Second create a user model

data class User(override var username: String,
                val nickname: String) : KDoneUser()

Then start KDone, declaring a module for your models

startKDone(
        port = 23146,
        mongoURL = "mongodb://localhost:27017/games",
        jwtConfig = JWTConfig("user-key-secret")
    ) {
    
    userModule<User>("users")
    
    module<Game>("games")
  }
    

This configuration will open these endpoints for Game model:

This configuration will also open these endpoints for User model:

Other functionalities:

  • Permissions for users and models
  • Roles
  • Support for Apple, Google and Facebook authentications
  • One-time password
  • Queries
  • Geographic coordinates
  • Routes actions
  • DTO
  • File uploads
  • S3 storage support
  • Easily extensible with custom routes

Documentation

See KDone website or Wiki page for more details.

Author

Dario Pellegrini, pellegrini.dario.1303@gmail.com

License

KDone is available under the MIT license. See the LICENSE file for more info.


Donate with PayPal