Skip to content

Latest commit

Β 

History

71 Commits

Folders and files

Repository files navigation

Gemini AI Kotlin Multiplatform App - Chat with Gemini AI πŸ’¬βœ¨

Gemini AI KMP App Preview

Click the image above to watch a demo of the Gemini AI KMP App on YouTube.


🌟 Overview

Gemini AI KMP App is a production-ready, open-source Kotlin Multiplatform (KMP) and Compose Multiplatform application targeting Android, iOS, Desktop (macOS, Windows, Linux), and Web (Wasm).

Powered by the latest Google Gemini AI models (including Gemini 3.8 Flash and Gemini 4 Argon), this app allows you to have intelligent, multimodal conversations using text and images. Conversations are stored locally with SQLDelight and persistent key-value configuration is handled cleanly with Multiplatform Settings.


πŸš€ Key Features

  • πŸ’¬ Multimodal Conversational AI: Seamless chat experience supporting text prompts and image attachments.
  • ⚑ Latest Gemini Models:
    • Live model discovery from the official Gemini API (/v1beta/models).
    • Flagship defaults: gemini-3.8-flash (Recommended), gemini-4-argon, gemini-3.5-flash-lite, and gemini-3.6-flash.
    • Context & token limits display with visual badges (e.g. Recommended, Thinking, Gemini 4, Fast & Lite).
  • 🎨 Adaptive & Responsive Material 3 UI:
    • Adaptive Navigation Suite adapting to Phones, Foldables, Tablets, and Desktops.
    • Collapsible desktop drawer for chat history.
    • Staggered adaptive grid layout for model selection.
  • πŸŒ“ Dynamic Theme Management:
    • One-click switching between System Default, Light, and Dark themes.
    • Reactive theme state managed cleanly via SettingRepository and AppViewModel.
  • πŸ“œ Cross-Platform Vertical Scrollbars (AppVerticalScrollbar):
    • Desktop & Web draggable scrollbars styled with Material 3 tokens.
    • Native touch-overscroll on mobile without conflicts.
    • Reverse-layout sync for chat messages.
  • πŸ” API Key & Storage Management:
    • Easily configure, mask/reveal, or change your Google Gemini API key at runtime.
    • Data & Storage controls with a safe Delete All Conversations confirmation flow.
  • πŸ—οΈ Clean Architecture & MVI:
    • Strict separation of concerns: UI (Compose) βž” ViewModel (MVI with Intent / State / Effect) βž” Domain (Use Cases) βž” Data (Repositories & Data Sources).
    • Lifecycle-aware one-off effect handling with ObserveAsEvents.

πŸ› οΈ Tech Stack & Architecture

Layer / Domain Technology
Language & Platform Kotlin Multiplatform (2.4.x), Compose Multiplatform (1.12.x)
Build Tools Android Gradle Plugin (AGP 9.1.x), Gradle 9.x
Architecture Clean Architecture + MVI (Model-View-Intent) + Single Source of Truth
UI & Theming Jetpack Compose Multiplatform, Material 3, Adaptive Layouts, Jetpack Navigation 3
Dependency Injection Koin 4.2.x (koin-compose-viewmodel)
Networking Ktor 3.6.x (Content Negotiation, Kotlinx Serialization)
Local Database SQLDelight 2.4.x (SQLite on Mobile/Desktop, SQL.js on Web)
Key-Value Persistence Multiplatform Settings
File / Image Picking FileKit 0.17.x (Native cross-platform image picker)
Logging Touchlab Kermit
BuildConfig BuildKonfig

πŸ“¦ Project Structure

The project follows a modern modular KMP setup:

Gemini-AI-KMP-App/
β”œβ”€β”€ androidApp/        # Android application entry point & Manifest
β”œβ”€β”€ desktopApp/        # JVM Desktop application entry point (macOS, Windows, Linux)
β”œβ”€β”€ webApp/            # Web (WasmJs) application entry point & webpack configurations
β”œβ”€β”€ iosApp/            # iOS Xcode project (SwiftUI wrapper)
└── shared/            # Shared multiplatform core module
    β”œβ”€β”€ commonMain/    # Core domain models, use cases, repositories, screens & UI
    β”œβ”€β”€ androidMain/   # Android-specific drivers & platform utilities
    β”œβ”€β”€ jvmMain/       # Desktop JVM implementations (Scrollbars, DB drivers)
    β”œβ”€β”€ wasmJsMain/    # WebAssembly implementations
    └── iosMain/       # iOS platform hooks

πŸš€ Getting Started

Prerequisites

  • JDK 21 (e.g. Azul Zulu JDK 21)
  • Android Studio Ladybug Feature Drop (or newer)
  • Xcode (for iOS builds on macOS)

Installation & Setup

  1. Clone the repository:

    git clone https://github.com/Coding-Meet/Gemini-AI-KMP-App.git
    cd Gemini-AI-KMP-App
  2. Configure Gemini API Key:

    • Obtain an API key from Google AI Studio.
    • Create a local.properties file in the project root:
      GEMINI_API_KEY=YOUR_GEMINI_API_KEY
      (Note: You can also configure or update your API key directly within the app's Settings screen at any time).
  3. Generate SQLDelight Interfaces: Run the following task in the terminal or Android Studio Gradle panel:

    ./gradlew :shared:generateCommonMainGeminiApiChatDBInterface

Running the App

  • Android: Select the androidApp run configuration in Android Studio and hit Run (Shift + F10). Or via terminal:

    ./gradlew :androidApp:installDebug
  • Desktop (macOS / Windows / Linux):

    ./gradlew :desktopApp:run
  • Web (Wasm / Browser):

    ./gradlew :webApp:wasmJsBrowserDevelopmentRun
  • iOS: Open iosApp/iosApp.xcodeproj in Xcode and press Run, or run the iosApp configuration from Android Studio with the KMP plugin.


πŸ“Έ Screenshots

Android (Google Pixel 9)

πŸŒ™ Dark Mode

Welcome Screen Add API Key Dialog New Group Dialog
Conversations List Empty Chat Screen Sending & Loading
Gemini Markdown Response Multimodal Prompt Gemini Vision Response
Delete Chat Dialog Settings Screen Edit API Key Dialog
Delete All Chats Dialog

β˜€οΈ Light Mode

Welcome Screen Add API Key Dialog New Group Dialog
Conversations List Empty Chat Screen Sending & Loading
Gemini Markdown Response Multimodal Prompt Gemini Vision Response
Delete Chat Dialog Settings Screen Edit API Key Dialog
Delete All Chats Dialog

iOS (iPhone 16 Pro)

πŸŒ™ Dark Mode

Welcome Screen Add API Key Dialog New Group Dialog
Conversations List Empty Chat Screen Sending & Loading
Gemini Markdown Response Multimodal Prompt Gemini Vision Response
Delete Chat Dialog Settings Screen Edit API Key Dialog
Delete All Chats Dialog

β˜€οΈ Light Mode

Welcome Screen Add API Key Dialog New Group Dialog
Conversations List Empty Chat Screen Sending & Loading
Gemini Markdown Response Multimodal Prompt Gemini Vision Response
Delete Chat Dialog Settings Screen Edit API Key Dialog
Delete All Chats Dialog

macOS (Two-Pane Desktop)

πŸŒ™ Dark Mode

macOS Welcome macOS Add Key
macOS New Group macOS Sending & Loading
macOS Chat Markdown macOS Vision
macOS Delete Chat macOS Settings
macOS Edit Key macOS Delete All

β˜€οΈ Light Mode

macOS Welcome macOS Add Key
macOS New Group macOS Sending & Loading
macOS Chat Markdown macOS Vision
macOS Delete Chat macOS Settings
macOS Edit Key macOS Delete All

Web (Wasm Two-Pane Browser)

πŸŒ™ Dark Mode

Web Welcome Web Add Key
Web New Group Web Sending & Loading
Web Chat Markdown Web Vision
Web Delete Chat Web Settings
Web Edit Key Web Delete All

β˜€οΈ Light Mode

Web Welcome Web Add Key
Web New Group Web Sending & Loading
Web Chat Markdown Web Vision
Web Delete Chat Web Settings
Web Edit Key Web Delete All

🀝 Contributing

Contributions, issues, and feature requests are welcome! Feel free to check the issues page.


❀️ Show Your Support

Give a ⭐️ if this project helped you!

Buy Me A Coffee

🌐 Connect with Me


πŸ‘€ Author

Meet