Home

Awesome

Kotlin Libraries Playground

A playground to gain a wider and deeper knowledge of the libraries in the Kotlin ecosystem

Also the official sample for gradle refreshVersions

Usage

Run all the samples

$ ./gradlew :kotlin-jvm:run

Run all the tests

$ ./gradlew :kotlin-testing:test

Test tests called FailingXXX are expected to fail

<img width="522" alt="kotlin-libraries-playground_–_versions_properties__kotlin-libraries-playground__and_GitHub_Desktop" src="https://user-images.githubusercontent.com/459464/116738577-edb25800-a9f2-11eb-9a63-96805bb59cf4.png">

❤️ Contributors welcome! #hacktoberfest

We want to collect sample usage of Kotlin libraries, and the more the better!

You are very welcome to contribute your own library sample.

<big>==> CONTRIBUTING.md</big>

🤔How do you keep up with all the new stuff?

There are great resources to learn Kotlin.

But once you master the language, you are not done just yet.

You now face another challenging task: become familiar with its ecosystem of libraries.

With time, you want to both acquire:

There are several inefficient ways to do that:

🦅Widening your knowledge of libraries

The kotlin-libraries-playgound contains samples for a growing number of good Kotlin libraries including Apollo, CliKt, Kodein DI, Kodein DB, Exposed, Fuel, Hoplite, Klaxon, Konad, Konf, Kotlin Collections, Kotlin Faker, Kotlin IO, Kotlinpoet, Kotlin Statistics, Kotlinx Serialization, Ktor Client, Mordant, Moshi, OkHttp, OkIO, Picnic, Retrofit, Skrapeit, SqlDelight, Statemachine, ..., KoTest, Mockk, Spek, Strikt, Mockito, Junit-Jupiter, ... ...

You are very welcome to contribute new samples (see contributing section below).

For each library, we have a sample usage that is:

Here is for example the sample usage for kotlinx.serialization

package playground.kotlinx.serialization

fun main() {
    println("# Kotlin/kotlinx.serialization : Kotlin multiplatform / multi-format serialization")
    val user = User(name = "Robert", age = 42)
    val json = """{"name":"Robert","age":42}"""

    Json.encodeToString(user) shouldBe json
    Json.decodeFromString<User>(json) shouldBe user
}

@Serializable
internal data class User(
    val name: String,
    val age: Int
)

🔭 Deepening your understanding of one library

Clone this repository and make it yours.

Want to learn more about, say, OkHttp?

You don't have the hassle to create a new project.

Create a new branch called okhttp and try out things while you are reading the documentation

🎩 Easy dependency management with gradle refreshVersions

This playground is also the official sample for gradle refreshVersions

It makes it super easy to refresh dependencies

$ ./gradlew refreshVersions

And to add a new dependency without leaving the IDEA and with auto-completion :

❤️ A big thanks to our wonderful contributors !

<a href="https://labhr.github.io/hatrack/#repo=LouisCAD/kotlin-libraries-playground"><img width="1063" alt="Let_s_Build_a_Hat_Rack" src="https://user-images.githubusercontent.com/459464/97205591-f3b34c00-17b7-11eb-884c-11a9ac42a4b8.png"></a>