Skip to main content

brix_cli 1.1.0 copy "brix_cli: ^1.1.0" to clipboard
brix_cli: ^1.1.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 #

brix brix_getx brix_network brix_storage brix_ui brix_cli License: MIT

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 #

  1. Install the command once:

    dart pub global activate brix_cli
    
  2. Make an app. Use lowercase letters, digits and underscores for the name, and your company's reverse domain for --org:

    brix create my_app --org com.mycompany
    

    [brix create in the terminal]

  3. Run it:

    cd my_app
    flutter run
    

    Or press F5 in VS Code. Until you add your API, debug runs use a test backend on the device: log in with demo@brix.dev and Demo@1234, every code is 123456, or tap "Skip login".

  4. Add your API address in lib/config/app_config.dart, then match the endpoints in lib/data/repositories/. Separate staging and production addresses go in env/staging.json and env/production.json.

What is inside #

The folders follow the Flutter architecture guide: routing on go_router, views and view models for each feature, repositories for your API.

[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 is copied into your app.

The test backend #

Debug builds without an API run on a small backend that lives on the device, in lib/dev. It saves its accounts, so the app behaves as 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 changes the password or deletes the account, the other device is not affected. "Reset local backend" starts that device over, and "Skip login" jumps to the home screen.

When you bring your own login, delete lib/dev and the two lines marked local test backend in lib/main.dart. Nothing else uses them.

Safe for release #

The test backend can never end up in your store app:

  • It runs only behind kDebugMode, so the compiler leaves it out of release builds, together with its accounts, codes and buttons.
  • A release build without an API shows a short setup message instead of a login screen, and only accepts an https address.
  • On every change, our CI makes a new app, builds it for release on Android and the web and checks that no test account or test button is inside.

Changing the app id #

Picked com.example at the start? Change the id on Android, iOS, macOS and Linux with one command, run inside the app:

brix id com.mycompany.my_app

Commands #

brix create <app_name> [--org com.mycompany]   Make a new app
brix id <com.mycompany.app>                    Change the app id everywhere
brix --version
brix --help

MIT licensed.

The brix packages #

brix_cli is one part of brix. Take only the packages you need.

Package Version What it does
brix pub The logic: auth, account, Result, Json, BrixLogger
brix_getx pub GetX controllers for every brix screen
brix_network pub REST calls that return a Result
brix_storage pub Values, secrets and a session store
brix_ui pub Buttons, fields, select, dialogs, sheets, toasts
brix_cli pub brix create my_app: a new app on all of them
0
likes
0
points
956
downloads

Publisher

unverified uploader

Weekly Downloads

Create a Flutter app that runs at once: login, signup, email code, password reset, theme, network and storage, built on brix.

Repository (GitHub)
View/report issues

Topics

#cli #scaffolding #template #authentication

License

unknown (license)

Dependencies

path

More

Packages that depend on brix_cli