Apache Solr open-source search software
= Technology Overview
:toc: left
This document lists information about the technologies used in the UI module.
== Kotlin
Kotlin is a modern, statically typed programming language that runs on the Java Virtual
Machine (JVM) and can also be compiled to JavaScript or native code. It is designed to be
fully interoperable with Java, making it an excellent choice for UI and
server-side development.
If you are new to Kotlin, it is strongly recommended to browse and go through the
https://kotlinlang.org/[language documentation]. Since the UI module makes use of Kotlin's
Multiplatform capabilities, you should also have a look at https://kotlinlang.org/docs/multiplatform.html[Kotlin Multiplatform].
=== Coroutines
Kotlin Coroutines provide a powerful and flexible way to manage asynchronous programming.
They allow developers to write code that is sequential in nature but non-blocking under the hood,
enabling efficient and straightforward concurrent programming. Coroutines simplify tasks such as
making network requests, processing large datasets, or handling multiple user interactions
simultaneously. They are integrated into the Kotlin language through libraries like
kotlinx.coroutines.
To get started with Kotlin Coroutines, you can have a look at https://kotlinlang.org/docs/coroutines-overview.html[Coroutines Overview].
=== Ktor
https://ktor.io/[Ktor] is a Kotlin framework designed for building asynchronous servers and clients.
It provides a robust toolkit for making HTTP requests and handling responses, making it an
excellent choice for frontend applications that need to communicate with a backend server.
Ktor's client library is highly customizable and supports various features essential for
frontend development.
== Compose Multiplatform
Compose Multiplatform is a UI framework that enables developers to create user interfaces
for Android, iOS, desktop, and web applications using a single codebase. It is built on
the principles of Jetpack Compose, providing a declarative way to build UIs.
To get started with Compose Multiplatform, see the https://www.jetbrains.com/lp/compose-multiplatform/[Compose Multiplatform page].
Many resources from https://developer.android.com/compose[Jetpack Compose] may be used for learning
and as reference, but keep in mind that some of the information may not have a multiplatform
integration yet.
=== Material 3
Material 3, also known as Material You, is the latest version of Google's Material Design system.
It offers new components, dynamic theming, and updated guidelines to create a more personalized
and adaptive user experience.
The https://m3.material.io/[Material 3 website] gives a good introduction into user interface
design and Material 3.
=== AndroidX Lifecycle (ViewModel)
The UI state and the logic behind a screen are held by a
https://developer.android.com/topic/libraries/architecture/viewmodel[ViewModel]. A `ViewModel`
survives recompositions, provides a `viewModelScope` for coroutines that is cancelled
automatically once the `ViewModel` is cleared, and can be created from within a composable with
`viewModel { ... }`.
The state itself is exposed as `StateFlow` and one-shot events as `SharedFlow`, which makes the
data flow between the UI and the logic unidirectional: the UI renders the state and forwards user
interactions to the `ViewModel`, which updates the state.
The libraries are used through their Compose Multiplatform ports that are published by JetBrains
(`org.jetbrains.androidx.lifecycle`). Most of the Android documentation therefore applies to the UI
module as well, but keep in mind that some Android-specific features are not available on all
targets.
=== Navigation 3
https://developer.android.com/guide/navigation/navigation-3[Navigation 3] is used for navigating
between screens and sections. The navigation state is a simple back stack (a list of navigation
keys) that is owned by a `ViewModel`, and the `NavDisplay` composable renders the entry on top
of the back stack. The `ViewModel` scopes provided by the navigation entries make sure that the
`ViewModel`s of an entry are cleared once the entry is removed from the back stack.
Navigating therefore means to change the back stack. This makes the navigation logic easy to
test without any UI.