mobile

lexicon-android

Android client for lexicon with offline caching and background sync.

GitHub repo (opens in a new tab) ↗

~/problem

Shows offline-first mobile engineering, as opposed to another push-notification demo, against lexicon's query API.

A native Kotlin and Jetpack Compose app that lists corpora and documents, asks questions and caches every answer or refusal in Room. It keeps working offline, queues questions asked without a connection and answers them with WorkManager when the network returns.

~/highlights

  • Room cache of corpora, documents and query results, with repository classes owning the offline and sync logic.
  • WorkManager worker replays the offline question queue when connectivity returns.
  • Cached answers are flagged possibly stale when the corpus has changed since (ADR-0003).
  • Online, offline and syncing state is always shown in the UI.
  • CI runs ktlint, unit tests and assembleDebug, plus a security workflow with osv-scanner config.
  • Scope is a consumer query client: no upload, ingestion or corpus administration.

~/architecture

Architecture of lexicon-androidCompose UI connects to Repositories. Repositories connects to Room, Retrofit API, Sync worker. Room has no outgoing connections. Retrofit API connects to lexicon backend. Sync worker connects to Repositories. lexicon backend has no outgoing connections.Compose UIRepositoriesRoomRetrofit APISync workerlexicon backend
Compose UI → Repositories
Screens and ViewModels with a connectivity banner.
Repositories → Room, Retrofit API, Sync worker
CorpusRepository and QueryRepository implement offline and sync logic.
Room
Local cache of metadata and answers.
Retrofit API → lexicon backend
DTOs matching lexicon's API contract.
Sync worker → Repositories
WorkManager job that replays queued questions.
lexicon backend
Self-hosted service in the paired repository.

~/stack

  • Kotlin
  • Jetpack Compose
  • Room
  • WorkManager
  • Retrofit
  • KSP
  • Gradle

~/status

Scaffolded without Android SDK access, so the README states it was not compiled locally; CI is the build evidence. MIT.

  • lexicon Grounded document Q&A that gives cited answers or refuses.