How to Add a Database to an iPhone App Without a Backend (2026)
Add a database to an iPhone app without setting up a backend: on the phone or in the cloud, privacy rules, sync, costs, and the steps with Borel.

By Sigsten Gustavii· · 8 min read
To add a database to an iPhone app, decide whether the data stays on one phone or must be shared, pick on-device storage or a cloud database, define the tables and who may read each one, and connect the app's screens to it. In a Borel app, you describe what the app should remember and Borel declares the tables, the rules and the storage.
| Question | On the phone (SwiftData) | In the cloud (Borel Cloud) |
|---|---|---|
| Works offline? | Yes, always | Needs a connection to save and load |
| Syncs between devices? | No | Yes, with an account |
| Shared between people? | No | Yes, with access rules |
| Needs an account? | No | Yes, for anything private or shared |
| Running cost | None | Pay as you go, from the app's balance |
| Good for | Habits, journals, notes, personal logs | Social feeds, shared lists, marketplaces, bookings |
"Add a database" sounds like one decision, but it is really two: where the data lives, and who may see it. Get those right and the rest is screens. This guide explains both in plain words, then shows how Borel builds it.
On the phone: SwiftData
For data that belongs to one person on one phone, Apple's SwiftData keeps it on the device. The app opens instantly, works on a plane, and costs nothing to run. Borel uses it for apps like a habit tracker, a journal, a budget app or a workout log; see offline data.
The trade-off: data on one phone doesn't follow someone to a new phone unless they restore a backup, and it can't be shared with a partner. When either matters, it's time for the cloud.
In the cloud: Borel Cloud
When the app needs shared or synced data, Borel gives it Borel Cloud: a Postgres database, email sign-in and file storage, run by Borel. There is no account to create with a database company, no key to paste, and no server to deploy. You don't write SQL; Borel declares the tables from what the app needs.
| What you describe | What Borel creates |
|---|---|
| "People save recipes" | A recipes table with an owner, private to them |
| "Comments on a post" | A comments table related to posts, readable when the post is |
| "Likes, with a count" | A likes table and a count on each post the database keeps up to date |
| "Search by title and notes" | A search field over those columns |
| "One check-in per day" | A rule that allows one row per day |
| "Upload a photo" | A file in the app's storage, with its path in the row |
Who can read what: access rules
The most important part of a cloud database is the rule on each table. Borel picks one of a small set, and the database enforces it, so it holds even if someone calls the database without the app:
| Rule | Who reads | Who writes | Example |
|---|---|---|---|
| Private | The owner (and someone named, if chosen) | The owner | Journal entries, saved items |
| Public read, owner write | Everyone signed in, or everyone | The owner | Profiles, listings, posts |
| Followers | The owner and their followers | The owner | Posts in a follow-based feed |
| Participants | Members of a conversation | Members | Direct messages |
| Group | Members of a shared group | Owners and editors | A family shopping list, a team's tasks |
| Inherit | Whoever can read the parent | Depends on the parent | Likes and comments on a post |
Groups come with invite codes and roles (owner, editor, viewer), so "share this list with my partner" is a sentence, not a project.
Changing the database later
Apps grow, and the database grows with them. When you ask for a new field or table, Borel declares the change and runs it. A field added to a table that already has rows gets a default, so existing data stays valid. Before a change to a field's type or a table's access rule, Borel saves a restore copy, and for an app already on the App Store such a change waits for you to approve it. You never type a migration by hand.
Files and photos
Pictures and documents don't belong in database rows. Borel uploads them to the app's own file storage and keeps their path in the row, and screens show them from there. Uploads count toward the app's storage costs, and a person's files are removed when they delete their account.
Common database mistakes, and how to avoid them
- Putting everything in the cloud. Data that only one person uses on one phone is faster, free and offline in SwiftData. Move it to the cloud when sharing or syncing needs it.
- Rules only in the app. If the only thing keeping data private is a filter in the app's code, anyone who calls the database directly can read it. Rules belong in the database, which is where Borel puts them.
- Storing pictures in rows. Large files slow every list down. Keep them in file storage and store the path.
- Counting on the phone. Adding up likes on the phone gets slow and wrong as data grows. Let the database keep the count.
- Inventing sample data. Fake rows in a real app confuse people and reviewers. Borel's builder is told never to insert invented rows into a live database.
- Forgetting deletion. When someone deletes their account, their rows and files have to go too. Plan for it from day one.
Apple's rules that touch your data
| Guideline | What Apple asks | In a Borel app |
|---|---|---|
| 5.1.1(v) Account deletion | Delete account in the app | Removes the person's rows and files, then the sign-in |
| 5.1.1(i) Privacy policy | Say what you collect and why | Borel hosts a policy that covers its cloud use |
| 5.1.1(v) Login only when needed | No login without account-based features | On-phone data needs no account |
| 2.1 Completeness | A working back end during review | Borel Cloud stays on; add a demo account |
When you fill in App Store Connect's app privacy details, list what the cloud stores, such as email addresses and content people post.
What a database costs
| Item | Cost | Notes |
|---|---|---|
| On-phone data | $0 | SwiftData on the device |
| Borel Cloud | Pay as you go | Database, sign-in and storage from your app's balance |
| Building | Credits, from 5 credits a day | Pro from $20 a month for more |
| Publishing | Pro plus $99 a year to Apple | Needed for the App Store |
See pricing, and Cloud cost in the workspace for what each app uses.
How to choose the right database setup
- Borel, for an iPhone app where you describe the data and get SwiftData or a cloud database with access rules, sign-in and storage, without a backend to run.
- Firebase or Supabase by hand, if you write the app in Xcode and want to manage the service, its rules and its bill yourself.
- Apple's CloudKit, if you are a Swift developer and want data in each person's own iCloud; Borel apps don't use it.
- [CatDoes](/compare/catdoes), if you need Android too; it has its own cloud for React Native apps.
How to do it with Borel, step by step
Step 1: Say what the app remembers
In plain words, list the things the app keeps, who owns each, and who else sees it. Borel decides the tables.
Keep a shared shopping list for a household. Anyone can create a household and invite others with a code. Every member can add, tick and remove items; each item remembers who added it. Each person also has private favourite products only they see. Let people search items by name.Step 2: Check the data with two accounts
In the iOS Simulator in your browser, make two accounts. Join one household from both, add items from each, and confirm a third account outside the household sees nothing.
Step 3: Add to it as the app grows
Ask for new things in plain words: "add a quantity to each item", "keep a history of what we bought". Borel declares each change and keeps existing data.
Step 4: Publish
Stamp checks the app, and Publish builds and uploads it under your Apple Developer account. Add a demo account in a household with items so Apple's reviewer can see the shared list.
The Bottom Line
A database is two decisions: where data lives and who may read it. Borel keeps personal data on the phone with SwiftData and shared data in Borel Cloud, with access rules enforced by the database, uploads in storage and account deletion that really deletes. Describe what your app should remember in Borel and test it with two accounts on a live iPhone.
Questions people ask
Can I add a database to an iPhone app without a backend?
Yes. On-phone data needs none, and Borel apps that need a cloud database get Borel Cloud, a Postgres database with sign-in and storage that Borel runs, with no setup.
What database do iPhone apps use?
On the phone, usually Apple's SwiftData or Core Data. In the cloud, anything from Postgres to Firebase. Borel apps use SwiftData on the phone and Postgres in Borel Cloud.
Is SwiftData or a cloud database better?
SwiftData for data that belongs to one person on one phone; it is free and works offline. A cloud database when data must sync between devices or be shared between people.
How do I keep each person's data private?
With access rules enforced in the database, not only in the app. Borel declares a rule for every table, such as private to its owner or readable by a group's members.
Do I need to know SQL?
No. You describe what the app remembers, and Borel declares the tables, relations, indexes and rules.
What happens to my data when I change the app?
Borel changes the tables without losing rows. New fields get defaults, and before a change to a field's type or access rule it saves a restore copy.
How much does a cloud database cost for a small app?
In a Borel app it is pay as you go from the app's balance, so a small app with few people costs little. Cloud cost in the workspace shows what each app uses.
Can people share data, like a family list?
Yes. Borel's groups have invite codes and roles, so members of a household or a team see and edit the same items.
I started Borel because I wanted to make iPhone apps without a Mac or a team behind me. If this helped you build something, I would love to see it.
– Sigsten
Make your iPhone app in Borel
Describe the app you want and see its first screens before you pay anything.
See your app free