feat: add runtime configuration for Caddy-based SPA containerization

Introduced `config.json` runtime configuration fetch mechanism to support the "Build Once, Deploy Everywhere" pattern. Replaced NGINX with Caddy for SPA deployment, enabling SPA routing, security headers, and static asset management. Updated Gradle and Kotlin/JS build configurations to align with the new runtime environment. Enhanced Dockerfile and health checks for optimized CI/CD workflows and improved SPA delivery.
This commit is contained in:
2026-02-02 16:19:20 +01:00
parent 86d8d780f5
commit 11c597f147
17 changed files with 327 additions and 193 deletions
+8 -4
View File
@@ -14,11 +14,15 @@ kotlin {
jvm()
js {
browser {
testTask {
enabled = false
}
// browser {} block removed to avoid NodeJsRootPlugin conflicts in multi-module builds
// We only need explicit browser configuration in the shell (application) module.
// Tests are disabled via root build.gradle.kts configuration anyway.
nodejs {
testTask {
enabled = false
}
}
binaries.library()
}
sourceSets {
+6 -27
View File
@@ -6,48 +6,27 @@ plugins {
}
kotlin {
// Toolchain is now handled centrally in the root build.gradle.kts
jvm()
js(IR) {
browser()
// nodejs()
}
// Wasm vorerst deaktiviert
/*
@OptIn(org.jetbrains.kotlin.gradle.ExperimentalWasmDsl::class)
wasmJs {
browser()
js(IR) {
binaries.library()
// Explicitly select browser environment to satisfy Kotlin/JS compiler warning
browser {
testTask { enabled = false }
}
}
*/
sourceSets {
commonMain.dependencies {
// Compose dependencies
implementation(compose.runtime)
implementation(compose.foundation)
implementation(compose.material3)
implementation(compose.ui)
implementation(compose.components.resources)
// Coroutines
implementation(libs.kotlinx.coroutines.core)
// Serialization
implementation(libs.kotlinx.serialization.json)
// DateTime
implementation(libs.kotlinx.datetime)
}
jsMain.dependencies {
// JS-specific UI dependencies if needed
}
jvmMain.dependencies {
// JVM-specific UI dependencies if needed
}
}
}
+2 -12
View File
@@ -9,24 +9,14 @@ plugins {
}
kotlin {
// Toolchain is now handled centrally in the root build.gradle.kts
// Wasm is now a first-class citizen in our stack, so we enable it by default
// val enableWasm = providers.gradleProperty("enableWasm").orNull == "true"
jvm()
js {
binaries.library()
browser {
testTask { enabled = false }
testTask { enabled = false }
}
}
// Wasm vorerst deaktiviert
/*
@OptIn(org.jetbrains.kotlin.gradle.ExperimentalWasmDsl::class)
wasmJs { browser() }
*/
sourceSets {
commonMain.dependencies {
implementation(libs.kotlinx.serialization.json)
+4 -23
View File
@@ -9,28 +9,18 @@ plugins {
}
kotlin {
// Toolchain is now handled centrally in the root build.gradle.kts
jvm()
js {
binaries.library()
browser {
testTask { enabled = false }
testTask { enabled = false }
}
binaries.executable()
}
// Wasm vorerst deaktiviert, um Stabilität mit JS zu gewährleisten
/*
@OptIn(org.jetbrains.kotlin.gradle.ExperimentalWasmDsl::class)
wasmJs {
browser()
}
*/
sourceSets {
commonMain.dependencies {
implementation(libs.koin.core)
implementation(libs.bundles.kmp.common) // Coroutines, Serialization, DateTime
implementation(libs.bundles.kmp.common)
implementation(libs.sqldelight.runtime)
implementation(libs.sqldelight.coroutines)
}
@@ -41,18 +31,9 @@ kotlin {
jsMain.dependencies {
implementation(libs.sqldelight.driver.web)
// NPM deps used by `sqlite.worker.js` (OPFS-backed SQLite WASM worker)
implementation(npm("@sqlite.org/sqlite-wasm", "3.51.1-build2"))
}
/*
val wasmJsMain = getByName("wasmJsMain")
wasmJsMain.dependencies {
implementation(libs.sqldelight.driver.web)
}
*/
commonTest.dependencies {
implementation(libs.kotlin.test)
}
@@ -63,7 +44,7 @@ sqldelight {
databases {
create("AppDatabase") {
packageName.set("at.mocode.frontend.core.localdb")
generateAsync.set(true) // WICHTIG: Async-First für JS Support
generateAsync.set(true)
}
}
}
+2 -16
View File
@@ -10,28 +10,14 @@ group = "at.mocode.clients.shared"
version = "1.0.0"
kotlin {
// Toolchain is now handled centrally in the root build.gradle.kts
jvm()
js {
binaries.library()
browser {
testTask {
// Browser testing is disabled to avoid environment issues (e.g. missing ChromeHeadless).
// Tests are still run on JVM.
enabled = false
}
testTask { enabled = false }
}
}
// Wasm vorerst deaktiviert
/*
@OptIn(org.jetbrains.kotlin.gradle.ExperimentalWasmDsl::class)
wasmJs {
browser()
}
*/
sourceSets {
commonMain.dependencies {
// Depend on core domain for User/Role types used by navigation API
+2 -25
View File
@@ -9,39 +9,23 @@ plugins {
}
kotlin {
// Toolchain is now handled centrally in the root build.gradle.kts
jvm()
js {
binaries.library()
browser {
testTask { enabled = false }
testTask { enabled = false }
}
}
// Wasm vorerst deaktiviert
/*
@OptIn(org.jetbrains.kotlin.gradle.ExperimentalWasmDsl::class)
wasmJs { browser() }
*/
sourceSets {
commonMain.dependencies {
// Ktor Client core + JSON and Auth + Logging + Timeouts + Retry
api(libs.ktor.client.core)
implementation(libs.ktor.client.contentNegotiation)
implementation(libs.ktor.client.serialization.kotlinx.json)
implementation(libs.ktor.client.auth)
implementation(libs.ktor.client.logging)
// ktor-client-resources optional; disabled until version is added to catalog
// Kotlinx core bundles
implementation(libs.kotlinx.coroutines.core)
// DI (Koin)
api(libs.koin.core)
// Project modules via typesafe accessors
// (none here; kept for consistency)
}
jvmMain.dependencies {
@@ -51,13 +35,6 @@ kotlin {
jsMain.dependencies {
implementation(libs.ktor.client.js)
}
/*
val wasmJsMain = getByName("wasmJsMain")
wasmJsMain.dependencies {
implementation(libs.ktor.client.js)
}
*/
}
}
+7 -2
View File
@@ -4,15 +4,20 @@ plugins {
}
kotlin {
// Targets are configured centrally in the shells/feature modules; here we just provide common code.
jvm()
js(IR) {
browser()
binaries.library()
browser {
testTask { enabled = false }
}
}
sourceSets {
commonMain.dependencies {
// Correct dependency: Syncable interface is in the shared core domain
implementation(projects.core.coreDomain)
// Also include frontend domain if needed (e.g., for frontend-specific models)
implementation(projects.frontend.core.domain)
// Networking
implementation(libs.ktor.client.core)