# From Retool to an app you own

In Retool a query sits in the app beside the components that call it, and the resource it reaches is set up in Retool. On Meadowstack every call to your data goes through one file per module with a typed contract, so the screens never change when the backend does. The move is a rebuild of the screens on the kit, while your databases and APIs stay where they are.

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

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

| In Retool | In Meadowstack | What changes |
| --- | --- | --- |
| An app | A module: one folder with its records, rules, data and pages | A module never imports another, so it can be switched on in the next app as it is |
| A resource: the connection settings for a database or API | Your backend, reached by the module's adapter (`data/api.http.ts`) | The credentials live on your server; the browser gets a token, never a database password |
| A query, written in the app beside its components | A function in `data/api.ts`, typed by the module's contract | Pages import only that file, and one contract test runs against every implementation |
| A component: a table, a form, a button | A kit component inside a `<Screen archetype>` | The archetype sets the width, the header and what scrolls; you do not place widgets on a canvas |
| JavaScript that transforms a query's result | The adapter's mapping from rows to the module's types | One place maps `needed_by` to `neededBy`, and the pages never see a raw row |
| Who may use a resource or an app | `domain/permissions.ts`: one table of actions per module, asked through `can(action, record)` | Rules can depend on the record, so nobody approves their own; your server enforces the same table |
| A loading spinner or an empty table you configure | The four states of every data view through `<AsyncState>` | `npm run check` fails a page that loads data and skips one |

## Why teams move

- The app outgrew a tool for internal screens: clients, suppliers or field staff should use it, and it should look and behave like the company's own product.
- The team wants the code in its own repository, reviewed like the rest, and an AI coding tool that writes into it by rules it can check.
- Rules about who may do what have spread across queries and component settings, and nobody can say where the four-eyes check lives.

## How the move goes

1. List the Retool apps and, for each, the queries it runs. Each app usually becomes a module; a query that reads becomes a list or get function, a query that writes becomes a create, update or move.
2. Make the app's repository with `npm run new-app` (the recipe `docs/recipes/start-your-own-app.md`): the kit packed into `vendor/`, the rules for your coding tool and the checks.
3. Copy the sample module `requests` and rename it (`docs/recipes/new-module.md`): write the types, the states and the permission table before any screen.
4. Write the module's contract in `data/api.ts` from your query list, and build the screens against the simulated store first, so loading, failure and emptiness are seen before real data arrives.
5. Connect your backend with `docs/recipes/connect-your-data.md`: an HTTP adapter for the API you already have, or Postgres on Supabase with row level security ([Supabase](https://meadowstack.com/integrations/supabase/)).
6. Run Retool and the new app side by side on the same data until the people who use it daily sign off, then switch.

### Before launch

- Every action a Retool app allowed has a line in the module's permission table, and the server refuses what the screen hides: try it with `curl` and a person's token.
- The contract test passes against a test instance of your backend.
- Every change writes its history in the same transaction, so the record shows who did what.
- Real sign-in is in place: in 2.1 the starter's sign-in is for development only, and the server side is yours ([Security](https://meadowstack.com/security/)).

## What comes across and what does not

- **Your data and your APIs** stay where they are. Retool connects to them through resources; the new app connects to the same systems through its adapter.
- **The SQL of your queries** is a good start for your backend's endpoints, because it already says what each screen reads and writes.
- **The app itself does not run outside Retool.** Retool exports a classic app as a JSON file or a Toolscript archive with its queries, components and modules, without resources or data; it is a record of what you built, not code for another framework.
- **Permissions** are written again, per action and per record, in `domain/permissions.ts`.

## When to stay on Retool

- The screens are for a few colleagues, change weekly, and nobody outside the team sees them.
- Most of the work is wiring many existing systems together, and nobody on the team wants to own a repository.
- You rely on the platform's hosting and access control for its resources and have no one to run a backend of your own.

## The contract every query moves into

*The starter's requests module: every read and change the screens make, as one typed contract that the simulated store and your HTTP backend both answer.*

From `templates/starter/src/modules/requests/data/api.ts` in the Meadowstack repository:

```ts
export type RequestsApi = {
  /** The requests this person may read, newest first, matching the search (title, supplier, number, person). */
  listRequests: (actor: Person, query?: RequestQuery) => Promise<PurchaseRequest[]>;
  /** One request and its history, oldest event first; "Request not found" also when this person may not read it. */
  getRequest: (actor: Person, id: string) => Promise<RequestRecord>;
  /** A new draft by this person, with its number; writes a "created" event. */
  createRequest: (actor: Person, input: RequestInput) => Promise<PurchaseRequest>;
  /** Saves an edit and writes an "edited" event that says what changed (nothing changed: no event). */
  updateRequest: (actor: Person, id: string, input: RequestInput) => Promise<PurchaseRequest>;
  /** Moves requests along the workflow, all or nothing, one event each; a rejection needs a reason. */
  moveRequests: (actor: Person, ids: string[], move: Move, reason?: string) => Promise<PurchaseRequest[]>;
  /** A comment in the history of a request this person can read. */
  addComment: (actor: Person, id: string, text: string) => Promise<void>;
  /** Deletes a draft and its history for good. */
  deleteRequest: (actor: Person, id: string) => Promise<void>;
  /** Summaries outside the page (the sidebar count) reload when this moves. */
  subscribeToChanges: (listener: () => void) => () => void;
  getRevision: () => number;
```

## Questions

### Can I import a Retool app into the framework?

No. Retool's export is a JSON file or a Toolscript archive that Retool reads; it holds queries, components and modules but no resources or data. Use it as a list of what to rebuild.

### Where do the queries go?

Into your backend, behind the routes the module's adapter calls. The browser asks for a list or a change; the server runs the query and checks the permission.

### Do our databases have to move?

No. The adapter talks to whatever answers JSON, so the databases Retool used can stay, behind an API of your own or behind Supabase.

### How long does the move take?

It depends on the number of apps and queries. One module with its list, record, form and permissions is the unit to plan by, and the sample module is the one to copy.

## Sources

- [Retool docs: queries and code](https://docs.retool.com/queries), checked 2 December 2026
- [Retool docs: resources](https://docs.retool.com/data-sources/concepts/resources), checked 2 December 2026
- [Retool docs: components](https://docs.retool.com/apps/concepts/components), checked 2 December 2026
- [Retool docs: import and export classic apps](https://docs.retool.com/apps/guides/app-management/import-export), checked 2 December 2026

## Related

- [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)
- [Moving one process from a spreadsheet into an app, step by step](https://meadowstack.com/blog/excel-to-business-app/) (Blog)
- [From Access or FileMaker to a web app](https://meadowstack.com/from/access-filemaker/) (Moving from)
- [From Bubble to an app in your own repository](https://meadowstack.com/from/bubble/) (Moving from)
- [From Excel or Google Sheets to an app](https://meadowstack.com/from/spreadsheets/) (Moving from)
