Kotools Types is a Kotlin Multiplatform library providing types that model real-world concepts with correct and predictable behavior.
Instead of exposing the limitations of underlying platforms, these types follow their domain definitions. For example, the Integer type represents a mathematical integer and does not overflow.
By using Kotools Types, you can build APIs that are more explicit, easier to reason about, and less error-prone across JVM, JS, and Native platforms.
- Correct by Design: Types model real-world concepts and provide predictable behavior, avoiding common pitfalls such as integer overflow.
- Explicit and Safe APIs: Constraints and invariants are expressed directly in types, helping prevent invalid states and making code easier to understand.
- Complete and Practical: Each type comes with the operations needed for real-world usage, not just constructors or wrappers.
- Multiplatform Ready: Use the same reliable types across Kotlin/JVM, Kotlin/JS, and Kotlin/Native.
Important
Support of Kotlin Serialization is experimental and not intended for production use. It will be replaced by a stable solution in Kotools Types 6.0.
You can add Kotools Types to your project by using Gradle or Maven.
Just replace the $version or the ${kotools.types.version} variables by the
latest version or by another one available in the
changelog.
Gradle - Kotlin DSL
implementation("org.kotools:types:$version")Gradle - Groovy DSL
implementation "org.kotools:types:$version"Maven
<dependencies>
<dependency>
<groupId>org.kotools</groupId>
<artifactId>types</artifactId>
<version>${kotools.types.version}</version>
</dependency>
</dependencies>See the dedicated documentation for serializing types from the
org.kotools.typespackage using the kotlinx.serialization library.
Here's additional documentation for learning more about this project:
- API reference
- Design goals
- Versioning strategy
- Dependency compatibility
- Declarations lifecycle
- Security Policy
Join our thriving community! Connect, share insights, and collaborate with fellow developers to make Kotools Types even more powerful.
If you find this project valuable, show your support by giving us a ⭐️ on GitHub. Your feedback and engagement mean the world to us!
As an Open-Source project, Kotools Types is in need of new contributors! We have issues suited for all levels, from entry to advanced. All are welcome in this project.
If you are looking to contribute, check out our contribution guidelines for more details on how to get started.
Thanks to Loïc Lamarque for creating and sharing this project with the open source community.
Thanks to all the people that ever contributed through code or other means such as bug reports, feature suggestions and so on.
This project is licensed under the MIT License.
Happy coding with Kotools Types! 🎉