brix_cli 1.0.0
brix_cli: ^1.0.0 copied to clipboard
Create a Flutter app that runs at once: login, signup, email code, password reset, theme, network and storage, built on brix.
brix_cli #
Make a new Flutter app that already works: login, signup with an email code, forgot and reset password, profile, change password, delete account and logout. It comes with a theme, API calls, safe storage and tests, all built on brix.
[Login, signup and email code screens]
[Home, profile and delete account screens]
Get started #
-
Install the command once:
dart pub global activate brix_cli -
Make an app. Use lowercase letters, digits and underscores for the name:
brix create my_app[brix create in the terminal]
-
Run it on the local test backend. You need no server for this:
cd my_app flutter run -t lib/main_development.dartLog in with
demo@brix.devandDemo@1234. Every code is123456. -
Point it at your API when you are ready:
flutter run --dart-define=API_URL=https://your.api/v1/The endpoints live in
lib/data/repositories/auth_repository_remote.dartandaccount_repository_remote.dart. Change the paths and fields there to match your backend.
The app id starts as com.example.my_app. Change it before you publish.
What is inside #
The folders follow the Flutter architecture guide, with views and view models for each feature.
[The folders of a new app]
Each screen is a short layout. The logic behind it (forms, loading, double taps, the session, error messages) comes from the brix packages, so it gets better when you run flutter pub upgrade, and none of it has to be copied into your app.
The local test backend #
main_development.dart runs the app against a small backend that lives on the device. It saves its accounts in a file, so the app behaves like it would with a real server: sign up, verify, log in, change your name or password, delete the account.
Every device keeps its own copy. If two people test with the demo account and one of them changes the password or deletes the account, the other device is not affected. "Reset local backend" on the login screen starts that device over.
Safe for release #
The local backend can never end up in your store app:
- Release builds start from
lib/main.dart, which does not import the local backend. Its accounts, code and reset button are not in the release app at all. main_development.dartstops right away if someone builds a release from it.- Without
API_URLthe app shows a short setup message instead of a login screen, and a release build only accepts anhttpsaddress. - On every change, our CI makes a new app, builds it for release and checks that no test account is inside.
If you no longer want the local backend, delete lib/main_development.dart, the two *_local.dart repositories, lib/data/services/local_accounts_service.dart and test/app_test.dart. Nothing else uses them.
Commands #
brix create <app_name> Make a new app
brix --version
brix --help
MIT licensed.