Short-Video App with React Native and Supabase · Course book
Chapter 1: Planning a Short-Video App
Short-video apps, where people scroll through a full-screen feed of clips, like them, comment, follow creators and chat with friends, look simple to use but combine almost every feature of modern mobile development. Before writing any code it pays to understand the whole system: what the app must do, which tools handle which jobs, how data moves between the phone and the back end, and how much storage and bandwidth videos really need. This chapter is that plan. It introduces the feature list, the technology stack of React Native with Expo, Supabase, TanStack Query and NativeWind, the architecture that connects them, a first estimate of storage costs, and the order in which the following chapters build the app.
What the app must do
A useful way to plan any app is to write its features as short user stories, then group them into the screens that deliver them. The finished app in this course covers the following.
- A splash screen, then sign-up and login with email and password.
- A full-screen, vertically scrolling video feed, where each clip plays when it is on screen and pauses when it leaves.
- Likes, comments and sharing on each video, shown as icons over the video.
- Recording videos with the camera or picking them from the phone's gallery, then uploading them.
- Following other users, with friends defined as people who follow each other, and a feed of friends' videos.
- A profile showing the user's photo, videos, likes and follower counts, with the ability to change the photo.
- An inbox with an activity feed of likes, comments and new followers, and real-time chat with friends.
Writing the list first helps in two ways. It reveals the data the app must store, which shapes the database, and it gives a natural order for building: navigation and accounts first, because everything depends on them, then uploading, because the feed needs videos to show, then the social features that sit on top.
It also helps to decide what is not in the first version. Editing tools such as filters and music, algorithmic recommendations, monetisation and live streaming are each large projects in their own right. A clear first version, often called a minimum viable product, includes only what is needed for the core experience: post a clip, watch clips, react to them and talk to friends. Features can be added once that core works well, and real users can show which additions matter most.
Finally, set quality targets early. A feed should scroll smoothly, which on phones means drawing about 60 frames per second, leaving roughly 16 milliseconds per frame for all the work on screen. A video should start playing within a moment of appearing. And the app should cope with poor connections, showing clear messages rather than freezing. These targets influence choices later, such as how many videos to load at once and when to start downloading the next clip.
The technology stack
Each tool in the stack has a clear job, and knowing why each one was chosen makes later decisions easier.
| Tool | Job in the app | Why it suits this project |
|---|---|---|
| React Native with Expo | The app itself, on iOS and Android | One JavaScript codebase; Expo provides the camera, video and image libraries and a fast development loop |
| Expo Router | Screens and navigation | Routes come from the folder structure, like a web framework |
| NativeWind | Styling | Tailwind-style utility classes in React Native |
| Supabase | Database, authentication, file storage and real-time updates | A hosted PostgreSQL database with these services built in |
| Prisma | Defining and migrating the database tables | Readable schema files and repeatable migrations |
| TanStack Query | Fetching and caching data in the app | Handles loading states, caching and refetching |
The stack is a common pattern called backend as a service: rather than writing and hosting a custom server, the app talks directly to a managed service that provides the database, accounts and files through a client library. That saves a great deal of work, but it moves responsibility for security into the database's own rules, a theme that returns whenever data is read or written.
How the pieces connect
The app on the phone holds the interface and a small amount of state, such as the signed-in user. Everything else lives in Supabase. Videos are large binary files, so they go into storage buckets, while the database holds a row for each video containing its owner, title and the path of the file in storage. Likes, comments, follows and chat messages are rows in their own tables, each linked to users and videos by their ids.
Reading data follows one pattern throughout. A screen asks TanStack Query for some data, such as the feed; the query function calls Supabase; the result is cached under a key; and the screen renders it. Writing follows another: an action, such as liking a video, inserts or deletes a row, and the related queries are refreshed so every screen shows the new state. Chat adds a third pattern: the app subscribes to new rows and Supabase pushes them as they arrive.
Security runs through all three patterns. Because the phone talks to the database directly, the database must decide, row by row, what each signed-in user may read and change, using rules called row level security policies. A user should be able to insert a like only in their own name, delete only their own comments and read chat messages only in conversations they belong to. Storage buckets have similar rules: anyone signed in might read public videos, but only the owner may upload into or delete from their own folder. Planning these rules alongside the tables, rather than as an afterthought, avoids the common mistake of an app that works perfectly but lets anyone change anyone's data.
Estimating storage and bandwidth
Video dominates the cost of an app like this, so it is worth estimating early. A video file's size is roughly its bitrate, the amount of data per second, multiplied by its duration. Bitrates are usually quoted in megabits per second, and there are 8 bits in a byte.
These numbers lead to sensible design choices: limit clip length, record at a reasonable resolution and bitrate rather than the camera's maximum, and check the free and paid storage and bandwidth allowances of the back-end plan before launching. Hosted services publish these limits, and they change, so check the current figures for your plan.
Bandwidth also affects viewers. On a mobile connection delivering 10 megabits per second, a 12.5 MB clip takes 12.5 × 8 / 10 = 10 seconds to download in full, far too long to wait. Video players avoid this by starting playback as soon as the first part has arrived and downloading the rest while it plays, so the practical requirement is that the connection delivers data faster than the clip's bitrate: 10 megabits per second comfortably exceeds a 5 megabit clip.
The build plan
The chapters that follow build the app in a deliberate order, each step relying on the previous ones.
- Set up Expo, then add NativeWind styling, Expo Router navigation and the tab bar icons.
- Create the Supabase project, define the tables with Prisma and add authentication with an auth provider.
- Add the camera, the gallery picker and uploads to storage.
- Build the home feed with automatic playback, then the overlay of icons, comments, likes and follows.
- Add the activity feed and real-time chat, then finish the profile and the friends feed.
- Prepare the app for the App Store, with the safety features that platforms require for user-generated content.
Working in this order means there is always something runnable on the phone, which makes mistakes easy to spot as soon as they appear. Commit to version control after each step, so that any experiment can be undone.
Check your understanding
- Compute the file size of a 30-second clip at 6 megabits per second, and of a 60-second clip at 4 megabits per second.
- How much storage do 10,000 clips of 12.5 MB each need, in gigabytes?
- Why are video files kept in storage buckets rather than in database rows?
- Explain what "backend as a service" means and one responsibility it shifts onto the database.
- Which data does the app read with queries, and which does it receive through a real-time subscription?
- Why does the build plan add authentication before the video feed?
This course book is available to read online only at tech-academy.chrysolites.org.