Kratos

A flexible Kotlin library for seamless management and tracking of customizable application settings. Simplify the process of integrating user-configurable options into your projects.


Kratos is specifically designed for Kotlin and works best when used with Kotlin’s coding style. It’s strongly recommended to use it exclusively with Kotlin.

Key Features

  • Simple, customizable API: For creating and managing settings.

  • Type-safe and easy integration: Designed to be type-safe and easy to integrate into Kotlin projects.

  • Change tracking: Allows tracking changes to settings and performing side effects.

  • Readable, maintainable structure: Blends naturally with Kotlin code.

Installation

Maven Central


Maven Central Version

Make sure to replace ${version} with the latest version of Kratos!

Gradle (Kotlin DSL)

repositories {
mavenCentral()
}

dependencies {
implementation("dev.lyzev.api:kratos:${version}")
}

Gradle (Version Catalog)

[versions]
kratos = "${version}"

[libraries]
kratos = { module = "dev.lyzev.api:kratos", version.ref = "kratos" }

Gradle (Groovy DSL)

repositories {
mavenCentral()
}

dependencies {
implementation 'dev.lyzev.api:kratos:${version}'
}

Maven

<dependencies>
<dependency>
<groupId>dev.lyzev.api</groupId>
<artifactId>kratos</artifactId>
<version>${version}</version>
</dependency>
</dependencies>

Raw JAR

  1. Visit the Maven Central Repository and download the JAR file for the version you need.

  2. Add the downloaded JAR to your project.

Usage

Below is a simple example demonstrating how to implement a boolean setting and track its changes:

/**
* A specific implementation of the [Setting] class for boolean settings.
*
* @param container The class of the settings container where this setting belongs.
* @param name The name of the setting.
* @param value The initial value of the boolean setting.
* @param hide A lambda function that determines whether this setting is hidden or not.
* @param change A lambda function that will be called when the value of the setting changes.
*/
class BooleanSetting(
container: KClass<*>, name: String, value: Boolean, hide: () -> Boolean = { false }, change: (Boolean) -> Unit = {}
) : Setting<Boolean>(container, name, null, value, hide, change)

object Test {
var setting by BooleanSetting(Test::class, "Test", true) { println("Setting changed to $it") }
}

fun main() {
// Print the initial value of the setting.
println(Test.setting)

// Change the value of the setting to 'false'.
Test.setting = false

// Print the updated value of the setting.
println(Test.setting)
}

Bugs and Suggestions

GitHub Issues

For bugs or suggestions, please submit them via the GitHub Issue Tracker. Be sure to use the provided templates and include all relevant details to help us understand your issue and resolve it swiftly. Your cooperation is greatly appreciated!

GitHub Issues

Discord Community

Need assistance or have minor questions? Join our welcoming community on the Discord server. Our members and staff are always ready to help!

Discord Server

Contribution

We welcome contributions from the community! Please read our Contribution Guidelines to get started.

Pull Requests

Security Policy

Please review our Security Policy to understand how we handle security vulnerabilities.


Please do not publicly disclose the vulnerability until it has been fixed.

License

Copyright (C) 2025 Lyzev

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see https://www.gnu.org/licenses/agpl-3.0.en.html.

Packages

Link copied to clipboard

The dev.lyzev.api.setting package is a core component of the Kratos setting management library. It provides the necessary interfaces and classes to create and manage settings in your projects.