Lightweight library for building reactive web apps with intuitive HTML rendering, precise data binding, two-way data updates, state handling, model validation, and support for HTTP, websockets, and hash-based routing.
[!IMPORTANT]
This repository is no longer actively maintained! The official fritz2-framework's development has been moved to a dedicated organization and therefore a new repository: https://www.github.com/fritztwo/fritz2Read more about the reasons for this change, some dedicated words form the original project creator and some outlook to the future developments in this blog article.
fritz2 is an extremely lightweight, well-performing, independent library for building reactive web apps in Kotlin, heavily depending on coroutines and flows.
fritz2 includes an intuitive way to build and render HTML elements using a type-safe dsl. You can easily create lightweight reactive HTML components which are bound to an underlying model and automatically change whenever the model data changes:
render {
val model = storeOf("init value")
div("some-css-class") {
input {
value(model.data)
changes.values() handledBy model.update
}
p {
+"model value = "
model.data.renderText()
}
}
}fritz2 implements precise data binding. This means that when parts of your data model change, exactly those and only those DOM-nodes depending on the changed parts will automatically change as well. No intermediate layer (like a virtual DOM) is needed. fritz2 requires no additional methods to decide which parts of your component have to be re-rendered. fritz2 also supports two-way data binding out-of-the-box to update your model by listening on events:
Utilizing Kotlin's multiplatform-abilities, you'll write the code of your data classes only once and use it on your client and server (i.e. in a SpringBoot- or Ktor-Backend). This is also true for your model-validation-code, which can quickly become far more complex than your data model.
fritz2 is hugely inspired by the great Binding.scala framework. Later we discovered that a lot of those concepts are described independently in Meiosis. Also, fritz2 relies heavily on the great Kotlin coroutines library.
If you like the idea of a lightweight pure Kotlin implementation for building reactive web-apps, please give us a star. Thank you!
[!IMPORTANT]
This repository is no longer actively maintained! The official fritz2-framework's development has been moved to a dedicated organization and therefore a new repository: https://www.github.com/fritztwo/fritz2Read more about the reasons for this change, some dedicated words form the original project creator and some outlook to the future developments in this blog article.
fritz2 is an extremely lightweight, well-performing, independent library for building reactive web apps in Kotlin, heavily depending on coroutines and flows.
fritz2 includes an intuitive way to build and render HTML elements using a type-safe dsl. You can easily create lightweight reactive HTML components which are bound to an underlying model and automatically change whenever the model data changes:
render {
val model = storeOf("init value")
div("some-css-class") {
input {
value(model.data)
changes.values() handledBy model.update
}
p {
+"model value = "
model.data.renderText()
}
}
}fritz2 implements precise data binding. This means that when parts of your data model change, exactly those and only those DOM-nodes depending on the changed parts will automatically change as well. No intermediate layer (like a virtual DOM) is needed. fritz2 requires no additional methods to decide which parts of your component have to be re-rendered. fritz2 also supports two-way data binding out-of-the-box to update your model by listening on events:
Utilizing Kotlin's multiplatform-abilities, you'll write the code of your data classes only once and use it on your client and server (i.e. in a SpringBoot- or Ktor-Backend). This is also true for your model-validation-code, which can quickly become far more complex than your data model.
fritz2 is hugely inspired by the great Binding.scala framework. Later we discovered that a lot of those concepts are described independently in Meiosis. Also, fritz2 relies heavily on the great Kotlin coroutines library.
If you like the idea of a lightweight pure Kotlin implementation for building reactive web-apps, please give us a star. Thank you!