Chrysolites Tech Academy

Photo Social App with FlutterFlow and Supabase · Course book

Chapter 1: Planning the App

Pairs with Lesson 1: Architecture of the App

A photo-sharing social app, where people post pictures with captions, scroll a feed, like, comment, follow and chat, is an ideal project for learning visual app development, because it exercises every part of a modern app while keeping each part understandable. This series builds one with FlutterFlow, a visual builder that generates Flutter apps, and Supabase, a hosted PostgreSQL back end. Before building, it pays to see the whole architecture: the screens, the data, the storage, the security and the order of work. This chapter lays out that plan, explains how the two tools divide the job, sketches the database, and works out the geometry of the feed and grid by hand, so that every later part has a place in the overall design.

Two tools, two jobs

FlutterFlow is where the app is built. Pages are designed by placing widgets, such as columns, rows, text, images and lists, on a canvas and setting their properties; behaviour is added with actions, such as navigating, querying data or uploading a file; and the result is a real Flutter app that runs on iOS, Android and the web. FlutterFlow can also export the generated code, so the project is never locked inside the builder, and it allows custom code for anything its built-in actions do not cover.

Supabase is where the data lives. It provides authentication for accounts, a PostgreSQL database for structured data such as posts and comments, storage buckets for files such as photos, real-time updates for chat, and row level security to decide who may read or change each row. FlutterFlow has built-in Supabase integration: once connected, its actions can sign users in, query and insert rows, and upload files without writing code.

ConcernHandled in FlutterFlowHandled in Supabase
Screens and navigationPages, widgets, the bottom navigation bar–
AccountsLogin and sign-up pages, auth actionsUsers, passwords, email confirmation
Posts, likes, comments, followsQueries, lists and buttonsTables, relationships, triggers, views
PhotosUpload and display actionsStorage buckets and their policies
ChatChat pages, custom actions for live updatesChat and message tables, real-time
SecurityHiding controls the user should not useRow level security policies, the real enforcement

The screens

The app's screens fall into four groups, built roughly in this order over the series.

  • Authentication: login and sign-up pages, followed later by password reset and email verification.
  • Onboarding: a short sequence of pages after sign-up that collects a username, a profile photo and a short bio.
  • The main tabs: a home feed of posts, a search page with a grid of results, a page for creating a post with the camera or gallery, and the user's own profile with a grid of their posts.
  • Detail and social screens: a post detail page, a comment section with replies, other users' profiles with follow buttons, an edit profile page, and chat pages listing conversations and messages.

Designing the user interface for most pages first, before connecting any data, is a deliberate choice in this series. It lets you settle the layout and navigation while everything is still easy to change, and reveals exactly which data each page needs, which in turn shapes the database tables designed next.

FlutterFlow encourages building pages from components, reusable pieces such as a post card, a comment row or a user avatar, each designed once and placed wherever needed. Components can take parameters, so one post card can show any post when given its data. Planning the components alongside the pages pays off quickly: the home feed, the profile grid's detail view and the search results can all reuse the same post card, and a design change to it updates every screen at once. The same idea applies to app state, values such as the signed-in user's profile that many pages need, which FlutterFlow can hold globally so that pages do not each fetch them again.

It is also worth deciding early how the app will be tested. FlutterFlow's run mode and test mode launch the app in a browser, which is quick for checking layouts and data, but features such as the camera, photo picking and push notifications behave differently on real phones. Testing on at least one iOS and one Android device at the end of each major part catches platform differences before they pile up.

The data model

The database holds a table for each kind of thing the app stores, linked by ids. A primary key uniquely identifies each row, and a foreign key in one table refers to the primary key of another, creating a relationship.

userspostsfollowschatslikescommentsmessages parent_id: replies
Figure 1.1 — The app's main tables and their relationships. Users connect to almost everything; comments refer to themselves to form reply threads.

A few patterns recur through the series. An intermediate table, sometimes called a join table, represents many-to-many relationships, such as follows, where any user can follow many others and be followed by many. A self-reference, a comment's link to its parent comment, creates reply threads of any depth. Triggers, small functions the database runs automatically, keep counts such as likes and followers up to date. And views, saved queries that behave like tables, combine posts with their authors' details so that pages can fetch everything they need in one request.

Photos are not stored in tables. They go into storage buckets, and the posts table stores the address of each file. This keeps the database small and fast, and lets the storage service deliver images efficiently. Buckets can be public, giving each file a permanent address that anyone can load, which suits post images and profile photos in a public social app, or private, requiring signed, time-limited addresses, which suits content that should be restricted. Choosing deliberately for each kind of file, and writing the choice down, avoids confusion later when policies are tightened before release.

Feed and grid geometry

Photo apps commonly use portrait images in a 4:5 shape, which take more of a phone screen than square ones while still fitting a full post with its header and buttons. Working out the sizes early helps when designing pages in FlutterFlow.

Worked example. On a phone 390 points wide, a full-width 4:5 image is 390 × 5 / 4 = 487.5 points tall. Adding a 56-point header row with the author's picture and name, and a 48-point row of like, comment and share buttons, a post takes about 487.5 + 56 + 48 = 591.5 points, leaving room for the start of the next post on an 844-point screen. The profile and search pages show a grid of three columns: with 2-point gaps, each tile is (390 − 4) / 3 = 128.7 points wide. Square tiles show 128.7 × 128.7 points, so six rows of three, 18 posts, need 6 × 128.7 + 5 × 2 = 782 points, almost a full screen.

Images uploaded at full camera resolution are far larger than needed for these sizes. A 4:5 image at 1,080 × 1,350 pixels is about 1.46 million pixels, sharp on any phone, whereas a 12-megapixel original has over eight times as many. Compressing and resizing on upload saves storage, bandwidth and loading time, a theme that returns in the posting chapters, where uploads are first built.

Security and the build order

Because the app talks to Supabase directly, security lives in the database. Row level security policies on each table decide what signed-in users may do: anyone may read posts, but only the author may edit or delete a post; users may insert likes and follows only in their own name; and chat messages may be read only by members of the chat. Early in the series, a permissive "allow all" policy on a storage bucket makes testing easy, but before release every policy should be tightened to the minimum each feature needs.

The series builds the app in this order: email authentication; the user interface for all main pages; the Supabase tables and storage; posting and displaying posts; onboarding and user data; views and search, including a version built with API calls; post details, likes and like counts with triggers; comments and recursive replies; follows and unfollows; profiles and editing; and finally chat. Extra episodes add password reset, email verification and real-time chat updates. Each step builds on the last, so there is always a working app to test. Keeping notes of each table, policy and page as you go makes the finished project far easier to maintain, and to extend later with new features.

Check your understanding

  1. Compute the height of a full-width 4:5 image on a 430-point-wide phone, and the total height of a post with a 56-point header and a 48-point button row.
  2. How wide is each tile in a three-column grid on a 390-point screen with 1-point gaps?
  3. Explain the difference between a primary key and a foreign key, with an example from the posts and users tables.
  4. Why are photos stored in buckets rather than in database rows?
  5. Which concerns does FlutterFlow handle, and which does Supabase handle, in this app?
  6. Why is an "allow all" storage policy acceptable for early testing but not for release?

Install Chrysolites Tech Academy

Android / Chrome / Edge: open the browser menu and choose Install app or Add to Home screen.

iPhone / iPad (Safari): tap the Share button, then Add to Home Screen.