# From Bubble to an app in your own repository

Bubble apps run only on Bubble and cannot be exported as code, so moving to Meadowstack means rebuilding the screens and logic while the data comes across as CSV or JSON. The part to carry over with the most care is the privacy rules: Bubble enforces them on its server, so in the new app they belong in your database or your API as well as in the module's permission table.

Checked 2 December 2026. By Bohuslav Poláček. https://meadowstack.com/from/bubble/

*What the parts of a Bubble app become in an app built on Meadowstack, and what changes.*

| In Bubble | In Meadowstack | What changes |
| --- | --- | --- |
| A data type and its fields | A table in your database and a type in the module's `domain/types.ts` | One schema checks a value in the form and again on the server |
| A field whose type is another data type | A foreign key, and a link from one record to the other | The related record opens beside its list, then as a full page |
| A privacy rule on a data type | A row level security policy or a check in your API, mirrored by `domain/permissions.ts` | The database refuses what the rule forbids; the screen only decides what to show |
| A workflow: an event that runs actions | A user action that calls the module's api, or a move in `domain/workflow.ts` | Each move writes an event in the record's history in the same transaction |
| An action that changes the database | A function in `data/api.ts`, typed by the module's contract | Pages import only that file, and one contract test runs against your backend |
| A page and its elements | A `<Screen archetype>` built from kit components | The screen type sets width, header and scroll; you do not position elements |
| Show and hide by condition | `<Can do="…">` for actions, and the four states of every data view | Hidden actions are refused by the server too, and loading, error and empty are never skipped |

## Why teams move

- The app should live in the company's own repository and run on a host the company chooses.
- The team wants to read, review and test the logic, and to let an AI coding tool change it by rules it can check.
- The app has grown roles and approvals, and the team wants one table that says who may do what, tested.

## How the move goes

1. Write down every data type, its fields and its privacy rules. Each rule is a sentence: "a draft is visible to its author and admins". These sentences become your permission table and your database policies.
2. Write down every workflow as event and actions. A workflow that changes a status becomes a named move with its history event; one that only shows or hides something becomes screen code.
3. Make the app's repository (`docs/recipes/start-your-own-app.md`) and one module per kind of record, copied from the sample `requests` (`docs/recipes/new-module.md`).
4. Build the screens against the simulated store first, so each one is seen loading, failing and empty before real data arrives.
5. Export the data from Bubble and load it into your database once. With Postgres on Supabase, the framework's example has the migration with row level security and the adapter ([Supabase](https://meadowstack.com/integrations/supabase/)); with your own API, `docs/recipes/connect-your-data.md` lists what each route must answer and refuse.
6. Run both apps on the same data until the people who use it daily sign off, then switch.

### Before launch

- Every privacy rule has a policy or an API check, and the module's contract test passes against your backend.
- An action the screen hides is refused by the server: try it with `curl` and a person's token.
- Real sign-in is in place, and user accounts are invited again: in 2.1 the starter's sign-in is for development only ([Security](https://meadowstack.com/security/)).

## What comes across and what does not

- **Data** comes across: Bubble exports a data type from its app data view as CSV, JSON or newline-delimited JSON.
- **The app itself** does not. Bubble's own documentation says its apps can only run on Bubble and there is no way to export an application as code, so pages, workflows and rules are rebuilt from your notes.
- **The design** can be the brief for the new screens, but the screens are made from kit components and tokens, not copied.
- **Privacy rules** come across as policies you write, and they matter most: they are what keeps one person's data from another today.

## When to stay on Bubble

- Nobody on the team writes or reviews code, and nobody will own a repository, a database and a host.
- The app changes daily in its editor and the people changing it are not developers.
- The logic is simple, the roles are few, and the platform's hosting and privacy rules already do what you need.

## A privacy rule, written as a database policy

*From the framework's Supabase example: a draft is visible only to its author and admins, enforced by the database whatever the screen asks for.*

From `docs/recipes/examples/supabase/0001_requests.sql` in the Meadowstack repository:

```sql
create policy requests_select on public.requests for select
  using (status <> 'draft' or requester_id = auth.uid() or public.app_role() = 'admin');
```

## Questions

### Can I export my Bubble app as code?

No. Bubble's documentation says its apps can only run on Bubble and cannot be exported as code. The data can be exported, and the app is rebuilt.

### In which formats does the data come out?

From the app data view, a data type exports as CSV, JSON or newline-delimited JSON, and Bubble sends a link to the file when the export is ready.

### Where do privacy rules go?

Into the server: a row level security policy in Postgres or a check in your API, and the same rule in the module's permission table so the screen hides what the server refuses.

### What happens to our users' accounts?

They move to the identity provider you choose for the new app. The starter in the framework signs in for development only, so real sign-in is part of the move.

## Sources

- [Bubble manual: application and data ownership](https://manual.bubble.io/account-and-marketplace/application-and-data-ownership), checked 2 December 2026
- [Bubble manual: data types and fields](https://manual.bubble.io/help-guides/data/the-database/data-types-and-fields), checked 2 December 2026
- [Bubble manual: protecting data with privacy rules](https://manual.bubble.io/help-guides/data/the-database/protecting-data-with-privacy-rules), checked 2 December 2026
- [Bubble manual: workflows](https://manual.bubble.io/help-guides/logic/workflows), checked 2 December 2026
- [Bubble manual: exporting data](https://manual.bubble.io/help-guides/data/the-database/export-import-data/exporting-data), checked 2 December 2026

## Related

- [Permissions](https://meadowstack.com/patterns/permissions/) (Patterns)
- [Postgres: the person in a transaction setting](https://meadowstack.com/integrations/postgres/) (Integrations)
- [Supabase: the rules in the database](https://meadowstack.com/integrations/supabase/) (Integrations)
- [Multi-tenancy](https://meadowstack.com/glossary/multi-tenancy/) (Glossary)
- [Row-level security (RLS)](https://meadowstack.com/glossary/row-level-security/) (Glossary)
- [From a Lovable or Bolt prototype to a built app](https://meadowstack.com/from/lovable-bolt-prototype/) (Moving from)
