DEV Community

Getinfo Toyou
Getinfo Toyou

Posted on

Why I Built an Offline-First Android App to Manage My AI Prompts

As developers, we are constantly switching contexts. On any given day, we might be jump-starting a new project, writing tests, or debugging legacy code. Over the last couple of years, large language models (LLMs) like ChatGPT, Claude, and Gemini have become core parts of my daily coding and documentation workflow. But as my usage grew, I noticed a frustrating bottleneck: prompt management.

The Problem: Where Did I Put That Prompt?

I started with a fragmented setup. I had a markdown file on my desktop for coding prompts, a note-taking app on my phone for writing prompts, and a few drafts saved in my email. Whenever I needed a specific prompt that had worked perfectly a week ago, I had to search through multiple apps, copy the text, tweak the variables, and paste it into the browser.

This process was inefficient. I wanted a single, dedicated library on my mobile device—something I could access instantly, search through, and copy from with a single tap. Since I couldn't find a lightweight, privacy-focused solution that fit my needs without unnecessary complexity, I decided to build one myself: AI Prompt Vault.

Choosing the Tech Stack

Since speed and privacy were my top priorities, I chose a modern, native Android tech stack:

  • Language: Kotlin, because of its safety features and concise syntax.
  • UI Framework: Jetpack Compose. Building UIs declaratively allowed me to quickly prototype the interface and handle dynamic states (like search queries and category filters) cleanly.
  • Local Database: Room Database. I wanted the app to be completely offline-first. Your prompts should remain your own data, stored locally on your device.
  • Dependency Injection: Hilt, to keep the codebase clean, modular, and testable.

Technical Challenges

Building a simple utility app doesn't mean there aren't interesting engineering challenges. Three aspects stood out during development:

1. Instant Full-Text Search

When you have dozens of prompts, scrolling is too slow. I needed instant search that matches terms in both the prompt title and the body. To achieve this without relying on a backend server, I integrated SQLite's FTS4 (Full-Text Search) module via Room.

Setting up the virtual FTS table required mapping the database entities correctly to ensure search queries were executed in milliseconds. The result is a highly responsive search bar that filters your prompt library as you type.

2. State Management and MVI

In Jetpack Compose, managing UI state across configuration changes (like screen rotation) can get tricky, especially when dealing with active search queries, category selections, and list states. I adopted a Model-View-Intent (MVI) architecture. By exposing a single immutable state flow from the ViewModel, the UI remains predictable. When a user selects a category, it triggers an action that updates the state, which in turn recalculates the filtered list via Room's Flow integration. This means the database is the single source of truth, and the UI reacts instantly to any changes.

3. Clean Clipboard Integration

The core user action in the app is copying a prompt to the clipboard. Android handles clipboard access via the ClipboardManager. However, ensuring a seamless user experience across different Android versions (especially with the clipboard overlay introduced in Android 13) meant I had to carefully handle background threads and system notifications. I implemented a simple one-tap copy gesture that updates the clipboard and gives subtle haptic feedback to confirm the action.

Lessons Learned

Building AI Prompt Vault taught me a valuable lesson in product scope. Initially, I wanted to build a cloud sync feature. I planned to use Firebase, set up user authentication, and synchronize prompts across multiple devices.

But as I talked to potential users (and looked at my own habits), I realized that a cloud database introduced unnecessary friction. Users didn't want to create another account just to store prompts. They valued privacy and speed. By stripping away the cloud synchronization and focusing entirely on a fast, local SQLite database, I delivered a more secure and responsive product.

I also realized how important it is to design for variable inputs. Often, a prompt is not static—it has placeholders (e.g., [Insert code here]). Handling dynamic variables within a local database and presenting them in a clean UI is a feature I'm actively refining.

Try It Out

If you find yourself copying and pasting the same instructions into LLMs or losing track of your best prompts, you can download AI Prompt Vault on Google Play:

AI Prompt Vault on Google Play Store

It is a simple, practical utility designed to make your daily AI interactions a little more productive. I would love to hear your feedback on how you manage your prompts and what features you would find useful.

Top comments (0)