Add Cloudflare D1 database access to an Android and iOS app using the same Kotlin code for both platforms.
Store user settings and tokens in Cloudflare KV from a Kotlin Multiplatform app without embedding secret keys in the client.
Build a mobile app backend on Cloudflare infrastructure while keeping all account credentials safely server-side.
Query and update a shared Cloudflare D1 database from Android, iOS, and a JVM server with one shared codebase.
Requires a Cloudflare Worker deployed as a server-side gateway before the client library can connect.
Cloudflare KMP is a Kotlin library that lets mobile and desktop apps talk to Cloudflare's backend services without exposing sensitive account credentials inside the app. Cloudflare provides a powerful set of hosted services for storing data, files, and real-time connections, but it does not offer an app-safe key model the way some other platforms do. This library fills that gap by sitting a small server-side gateway between the app and Cloudflare, so the app only ever sees a public URL and a publishable key. The library targets Kotlin Multiplatform, meaning the same code can run on Android, iOS, JVM servers, and WebAssembly targets without rewriting anything. It breaks into separate modules so you install only the pieces you need. The D1 module covers Cloudflare's SQL database, with a table API that lets you query, insert, update, and delete rows using Kotlin code rather than raw SQL strings. The KV module handles Cloudflare's key-value store, which is suited to storing settings, tokens, or small JSON documents. An R2 module shapes the API for file storage uploads and downloads, and a realtime module sketches out a channel-based model for live updates. The project is at an early alpha stage. D1 and KV routes compile and run. R2 signing and the realtime WebSocket transport are defined as API shapes but are not fully implemented yet, and the library notes those gaps explicitly rather than hiding them. Setup requires adding the relevant modules as dependencies in a Kotlin project build file, then writing a short initialization block with a Worker URL and publishable key. From there, operations follow a result-based pattern that lets you chain success and failure handlers instead of relying on exceptions. The library is released under the MIT license. Documentation pages for architecture, security model, and deployment are listed in the README but live in a separate docs folder within the repository.
← androidpoet on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.