Skip to main content

brix_cli 1.1.1 copy "brix_cli: ^1.1.1" to clipboard
brix_cli: ^1.1.1 copied to clipboard

Start here: brix create makes a Flutter app that runs at once, with login, signup, codes, reset, theme, API calls and safe storage on every brix package.

brix_cli #

brix_cli brix_ui brix_getx brix_network brix_storage brix License: MIT

Start here. brix_cli is the front door of the brix family: one command makes a new app on every other brix package. Already have an app? Add only the packages you need, see the family.

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. New app? Start with brix_cli. Existing app? Take only the packages you need; each brings the core with it.

Package Version What it does
brix_cli pub brix create my_app: a new app on every package below. Start here
brix_ui pub Buttons, fields, select, sheets, dialogs, toasts, light and dark
brix_getx pub GetX controllers for every account screen
brix_network pub REST calls that return a Result
brix_storage pub Values, secrets and a session store
brix pub The core every package builds on: flows, Result, Json, BrixLogger
0
likes
160
points
956
downloads
screenshot

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Start here: brix create makes a Flutter app that runs at once, with login, signup, codes, reset, theme, API calls and safe storage on every brix package.

Repository (GitHub)
View/report issues

Topics

#cli #scaffolding #template #authentication

License

MIT (license)

Dependencies

path

More

Packages that depend on brix_cli