How to Build a Chat Messaging App
Short answer
A chat app needs realtime delivery, optimistic sends that never lose a message, history that paginates without gaps, and push notifications when the app is closed. Build it with React Native and Expo on a realtime backend: Supabase Realtime, Firebase Firestore, or a hosted chat API such as Stream. DeveloperMill's free Expo Chat Starter implements 1:1 and group chat with swappable Firebase, Supabase, Appwrite and offline SQLite backends.
Chat looks simple and isn't. Messages arrive out of order, phones go offline mid-send, and an inverted list with pagination is easy to get subtly wrong.
This guide covers the features and the reliability details that separate a demo from an app people trust.
Last updated November 19, 2026
Features for the first version
Conversations list
Latest message, unread counts, sorted by activity, updating live.
1:1 and group threads
Inverted message list with timestamps and sender grouping.
Optimistic sends
Message appears instantly, reconciled by a client ID, with retry on failure.
History pagination
Load older messages on scroll without skips or duplicates.
Push notifications
New messages when the app is closed, opening the right thread.
People search
Find users to start a conversation.
Leave for version two
- Read receipts and typing indicators
- Images, voice notes and files
- Reactions and replies
- End-to-end encryption
- Voice and video calls
Screens you'll need
- Conversations list
- Chat thread
- New chat and people search
- Group details
- Profile and settings
Recommended tech stack
| Layer | Choice | Why |
|---|---|---|
| App | Expo + React Native + TypeScript | Native keyboard handling and lists on both platforms. |
| Realtime | Supabase Realtime, Firestore or Stream | Push new messages to open clients without polling. |
| Cache | TanStack Query | Realtime events update the cached thread so screens stay in sync. |
| Keyboard | react-native-keyboard-controller | Smooth composer movement with the keyboard. |
| Push | expo-notifications | Server-triggered pushes for offline recipients. |
| Starter | Expo Chat Starter (MIT) | Working chat with four backend adapters to start from. |
How to build it, step by step
- 01
Choose build versus buy
A hosted chat API saves months if you need calls, moderation and scale. Your own backend gives control and lower cost.
- 02
Model conversations and members
Conversations, members and messages, with access rules so users only read their own threads.
- 03
Build sending with client IDs
Generate an ID on the device, show the message immediately, and reconcile when the server confirms.
- 04
Build the thread list
Inverted list, cursor pagination by timestamp and ID, realtime inserts merged into the cache.
- 05
Add push
Send a push from the server to members who aren't currently in the thread.
- 06
Test bad networks
Airplane mode mid-send, two devices on one account, and long threads.
Common problems and how to avoid them
Lost or duplicated messages
Client-generated IDs and idempotent inserts solve both.
Pagination gaps
Paginate on a stable cursor (created_at plus ID), never on offsets.
Keyboard and safe areas
The composer must track the keyboard on both platforms; test on small phones.
Abuse
Chat with strangers needs reporting and blocking to pass review.
Store rules, privacy and regulation
- If strangers can message each other, provide reporting and blocking (App Store guideline 1.2).
- End-to-end encryption may require export compliance answers in App Store Connect.
- Message content is personal data; set retention rules and support account deletion.
This is general guidance, not legal advice. Check the current store guidelines and local law for your market.
What drives cost and timeline
Cost depends far more on scope than on the category. These are the decisions that move a chat & messaging app from a small build to a large one:
- Media messages and storage
- Encryption
- Voice and video calling
- Group size and moderation
For sourced figures, see what it costs to hire a React Native developer versus an AI app builder and the yearly cost of maintaining an app. Starting from a template or a free design cuts the screens and setup work, not the business logic.
Free chat & messaging app UI designs with Expo code
Start from working code
Go deeper
Build an AI Chat App with Expo and the Vercel AI SDK (Streaming)
Build a streaming AI chatbot in Expo with the Vercel AI SDK: Expo Router API routes, useChat with expo/fetch, tool calling and server-side API keys.
How to Add Push Notifications to an Expo App (expo-notifications)
Local and push notifications in Expo: set up expo-notifications, request permissions, schedule reminders, get a push token and handle taps. SDK 54+ examples.
React Native State Management 2026: Zustand vs Redux vs TanStack Query
React Native state management in 2026: compare Zustand, Redux Toolkit, Jotai and TanStack Query with code, split server and client state, and pick a stack.
Local Database in Expo with expo-sqlite (Offline Data Guide)
Add an on-device SQL database to Expo with expo-sqlite: create tables, run parameterized queries, use transactions and build an offline data layer. SDK 54+.
Frequently asked questions
What's the best backend for a React Native chat app?
Supabase Realtime and Firebase Firestore both work well for most apps and are cheap to start. A hosted chat API like Stream adds moderation, threads and scale out of the box at a higher price. The Expo Chat Starter supports Firebase, Supabase, Appwrite and offline SQLite behind one interface, so you can switch later.
How do I stop messages from being lost or duplicated?
Generate a client ID on the device for every message, show it immediately, and insert it on the server idempotently by that ID. When the server confirms, replace the pending message rather than adding a new one.
Is there a free React Native chat template?
Yes. DeveloperMill's Expo Chat Starter is MIT licensed and includes chat list, 1:1 and group threads, optimistic sends, pagination tests and four backend adapters.
More app development guides
Food delivery
How to Build a Food Delivery App
E-commerce
How to Build an E-commerce Shopping App
Fitness & health
How to Build a Fitness or Health Tracking App
Banking & finance
How to Build a Banking or Personal Finance App
Real estate
How to Build a Real Estate Listing App
Social media
How to Build a Social Media App
Doctor booking & telehealth
How to Build a Doctor Appointment Booking App
Travel
How to Build a Travel Booking or Trip Planner App
E-learning
How to Build an E-learning App
Start here
The complete mobile app development guide
