Skip to content
All posts

Sparkle AI: a ChatGPT-style assistant for iOS and Android

· 1 min read

I built a ChatGPT-style mobile app with React Native and the OpenAI API. It acts as a personal assistant that helps you stay organised and productive, and it is live on the App Store and Google Play as Sparkle AI.

What it does

  • Choose the model for each conversation, GPT-3.5 Turbo or GPT-4.
  • Set custom system messages to shape how the assistant answers.
  • Save chats and come back to them later.

How it’s built

Sparkle AI is a bare React Native app (0.71 at launch) with TypeScript, and it calls the OpenAI Chat Completions API directly: you bring your own API key, so there’s no server in between.

  • Streaming, word by word. React Native has no built-in server-sent events, so the client streams completions with react-native-sse. Each delta is appended to the message in Redux as it arrives, a stop button closes the stream, and errors appear in the chat instead of failing silently.
  • Conversations that persist. Chats are stored in Redux Toolkit with redux-persist on AsyncStorage. Each request rebuilds the conversation from the current chat, with your instructions as the system message, and trims it to the model’s token budget.
  • Feels like a native app. Code blocks get syntax highlighting and a copy button, a long press copies any message, voice input uses the phone’s own speech recognition, and a light haptic tap scales with the size of each streamed chunk.
  • Smooth long chats. An inverted list is the usual way to build a chat, but on Android it flips with scaleY: -1, which is a known source of jank. I patched it to rotate 180° instead.

If you want the same kind of assistant inside your own app, my open-source React Native chat library packages it as a single component.

Download Sparkle AI from the App Store or Google Play.

Written by Lakpriya Senevirathna

Mobile tech lead who builds fintech apps. Work with me

Keep reading