This project is specifically developed for the Droidcon Berlin 2024 presentation. It showcases a Kotlin Multiplatform approach to building applications that can run on Android and server-side platforms using shared code and modern development practices.
-
/composeApp
: Contains the Android-specific implementation using Jetpack Compose.commonMain
: Code that is shared across all platforms.androidMain
: Android-specific code including UI components and platform-specific logic.
-
/server
: Contains the server-side application built with Ktor.src/main/kotlin
: Contains Kotlin code for server-side logic.Application.kt
: Main entry point for the Ktor application.RoutingRest.kt
: Defines RESTful API endpoints.RoutingSSE.kt
: Defines Server-Sent Events (SSE) endpoints.RoutingWS.kt
: Defines WebSocket endpoints.
-
/shared
: Contains code that is shared between the Android and server components.commonMain
: Core business logic, data models, and shared utilities.data/repository
: Data repository implementations.data/source
: Data source interfaces and implementations.ui
: Shared UI components and view models.
The primary goal of this project is to demonstrate the capabilities of Kotlin Multiplatform in building robust and scalable applications that can run seamlessly on both Android and server-side environments. This project will be used as a case study in the dcbln24 presentation to highlight the following:
- Code sharing across platforms
- Using Ktor for server-side development
- Implementing real-time features with SSE and WebSockets
- Utilizing Jetpack Compose for modern Android UI development
- Traditional Communication:
- Real-Time Communication:
- WebSockets: Enables bidirectional communication between the server and client.
- Server-Sent Events (SSE): Allows the server to push updates to the client in real-time.
-
Clone the repository:
git clone https://github.com/mbakgun/dcbln24-mbakgun.git cd dcbln24-mbakgun
-
Build the server:
cd server ./gradlew build
-
Run the server:
./gradlew run
-
Build the Android application:
cd composeApp ./gradlew build
-
Run the Android application: Open the project in Android Studio and run the application on an emulator or physical device.
- Canva Presentation
- KTOR-7186 : WebSocket clients via SharedFlow
- For more information about Kotlin Multiplatform, visit the official documentation.
- Droidcon Presentation