Adaptive is a consolidated application development library for Kotlin focusing on:
- expressing our intention,
- clean code, close to no-boilerplate, minimal dependencies,
- frontend and backend components with built-in lifecycle and state handling.
Adaptive comes with a compiler plugin that performs many functions to reach the goals above.
Caution
Project status: preview
While library already works and provides both client and server side functionality, it is not even close to be ready for general production.
Please note that this is just a preview release, many basic things you would expect to work are still broken, especially around the code transformation.
For example, a simple { counter++ }
at the right place can result in a compiler plugin
error.
I will clean everything up eventually, but for now I consider these low priority issues, ones I can live with. If anyone starts to play around with the project I'll try to spend some time on these problems. Feel free to open an issue for any error or even inconvenience you experience.
- JVM
- Browser/JS
- Android
- iOS (Arm64, Simulator Arm64, X64)
See platforms for details.
There is some documentation.
Check out the adaptive-example project, or jump to the
- API (defines the API between the clients and the server)
- server
- server main (server entry point)
- service implementation (client request handler, one instance per request)
- worker implementation (background worker, one (or few) instances per server)
- client
- shared code (shared between all client platforms)
- browser main
- android main
Component | Content |
---|---|
core | The fundamental core of the library. |
adat | Data classes with many convenience functions, metadata and serialization support. |
foundation | Fundamental classes and interfaces for building adaptive structures. |
server | Server side adaptive fragments: workers, services, stores, settings. |
service | Client-server communication with simple function calls. |
wireformat | Serialization (protobuf and Json). |
gradle-plugin | The Gradle plugin. |
kotlin-plugin | The Kotlin compiler plugin. |
lib | Application level libraries such as UI, E-mail, etc. |
Email worker (JavaMail), tables (Exposed) and service to send emails. | |
exposed | Integration with Exposed, HikariPool worker. |
ktor | Ktor Worker with websockets and static directory serving. Transport for services. |
lib | Library sandbox. |
sandbox | Sandbox project to try things our without booting up the whole example. |
ui | User interface modules. |
common | Basic UI fragments for the supported platforms. |
- Add
local.propeties
file toadaptive-core
adaptive-ui/adaptive-ui-common
adaptive-sandbox
- Run the
build
task of the root project.
Note
If you are building with iOS targets you have to run the build on Mac OS X. This is a requirement from Apple, see Multiplatform Setup for details.
To disable iOS targets set the version of ios-support
to none
in libs.versions.toml. Any
value other than none
adds support for iOS.
This is also useful when you don't want to wait for the iOS linking during development.
Adaptive uses a composite Gradle build. These tasks are defined for the root project and run the appropriate task for each included project:
build
clean
publishToMavenLocal
kotlinUpgradeYarnLock
Everything uses the dependencies defined in libs.versions.toml.
To bump Adaptive version number:
- change
adaptive
version in libs.versions.toml - change
PLUGIN_VERSION
in AdaptiveGradlePlugin (also see #7)
To see what the plugin does, add this to build.gradle.kts
. When pluginDebug
is true, the plugin creates
files for each compilation in the pluginLogDir
directory.
adaptive {
pluginDebug = true
pluginLogDir = projectDir.toPath()
}
Multiplatform
- Kotlin (by the Kotlin Foundation, Apache 2.0)
- kotlinx-datetime (by JetBrains, Apache 2.0)
- kotlinx.coroutines (?, Apache 2.0)
Server side
- PostgreSQL (by The PostgreSQL Global Development Group, PostgreSQL Licence)
- Exposed (by the JB Team, Apache 2.0)
- HikariCP (by Brett Wooldridge, Apache 2.0)
- LOGBack (by QOS.ch, EPL v1.0 or LGPL 2.1)
- JavaMail (by Oracle, CDDL 1.0)
Building
- Gradle (by Gradle Inc., Apache 2.0)
Testing
- H2 (by multiple contributors, MPL 2.0 or EPL 1.0)
- SubEtha SMTP (by SubEthaMail.org, Apache 2.0)
Copied code from
- Compose Multiplatform (by JetBrains, Apache 2.0)
- parts of the resources module
- the resources part of the Gradle plugin
Inspiration
- Svelte (the whole idea)
- KVision (some service related ideas)
- Tailwindcss (style concept)
Copyright (c) 2024 Simplexion Kft, Hungary and contributors
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.