Build a Flutter app on your machine
An app from Oalo's Flutter template on your machine, against your Base's sync and sign-in: get its code, generate its Dart models, run it, deploy.
An app made from Oalo's Flutter template already signs people in with an email code and keeps its data in sync with your Base, offline included. You can build it on your own machine with your own editor and agent, against your Base, and deploy from there.
1. Get the code
Make the app in the dashboard (a new app, Flutter). Then, in an empty folder:
git init
oalo login
oalo deploy --app <slug> --pull # oalo apps lists them
git merge oalo/<slug>
oalo link --app <slug>
The code arrives as the Base has it, with its address already in
lib/config.dart. Link after the merge, not before: oalo link writes a
.gitignore, and git refuses to merge the app's own .gitignore over an
untracked one.
2. Packages
flutter pub get
You need a Flutter whose Dart is 3.9.2 or newer, because synclib_sync
requires it. The current stable channel is fine; flutter --version shows
both.
The template lists synclib_flutter and synclib_sync by their public
https address, but synclib_sync itself pulls synclib_flutter by its
git@github.com: address, so git needs an SSH key on your GitHub account.
Without one, tell git to use https for them, once (the Base does the same):
git config --global url."https://github.com/synclib-io/".insteadOf "git@github.com:synclib-io/"
3. Models
oalo typegen --dart
It writes lib/sync/generated/ and lib/models/ with the same generator the
Base uses, so they match what the dashboard and the Base's own agent see.
Run it again after you add or change a model (oalo data models create, or
in Data). --check fails when they're out of date, for CI. Commit them.
It also writes .oalo/dart-defines.json: your Base's address, the app's
slug and the env (dev).
4. Run it
flutter run -d chrome --dart-define-from-file=.oalo/dart-defines.json
The same file works for -d ios and -d android. The app reads and writes
your Base's dev data, the same as its preview. Sign in with a real email
address: the code is sent to it.
- Shared data (a model marked shared: a catalog, articles, posts) syncs to everyone, signed in or not, and changes show up live.
- A member's own data syncs only to that member, once signed in. A
screen that writes must sit behind
RequireAuth.
5. Deploy
Commit, then oalo deploy updates the preview, and oalo deploy --env prod
builds and publishes the live app. The live web app reads prod data.
Common mistakes
- Running without the defines file. The web app then talks to
flutter run's own address and never connects. Pass--dart-define-from-file=.oalo/dart-defines.json. - Old models after a model change. Run
oalo typegen --dartagain. - No app slug in the defines file.
oalo link --app <slug>, thenoalo typegen --dartagain.
The mental model behind Oalo's offline-first data sync, its core concepts, and how the TypeScript and Dart client libraries are layered.
How people sign in to your app, and how Oalo proves who they are.
How to define your own data tables in Oalo, import a CSV, stage and promote data, and push data in from another system through the Data API.
Host code you already have: oalo deploy --new makes an app from a repo on your machine or at a Git URL, how Oalo tells what kind of app it is, and what to add.
Wire a web app you build yourself to your Oalo Base: sign members in with an email code, then sync their data with @synclib-io/client.
The six kinds of credential in Oalo, what each one is for, how to create it, and which ones are safe to put in an app.
Sign up, install the CLI, and deploy your repo in a few minutes.