CLI: the arianet baas commands
The arianet baas command group does everything in Arianet BaaS from the terminal: create and manage Projects, run SQL, apply migrations from files, generate TypeScript types, print your app's environment variables, and manage Storage and Users. The commands are available from CLI v0.7.0 (update older versions with arianet upgrade). Installing and signing in are covered in the CLI guide.
- The commands call
https://api.ariaservice.net/baas/v1with your API token. The permissions each command needs are listed under Security: token permissions. <project-id>is the Project's numeric id (theIDcolumn ofarianet baas projects list), not itsref.- Every command accepts
-o jsonfor JSON output.
Plans and Projects
arianet baas plans # Plans and their limits
arianet baas projects list
arianet baas projects get <project-id> # ref, state, Endpoint
arianet baas projects create --name shop --plan free --wait
arianet baas projects rename <project-id> --name "My shop"
arianet baas projects pause <project-id>
arianet baas projects resume <project-id>
arianet baas projects plan <project-id> <plan-code>
arianet baas projects delete <project-id> --confirm <ref>
arianet baas actions list | get <id> | wait <id> # running operations (create, pause, …)
--wait waits until the Database is created. A Project is only deleted with --confirm and that Project's ref.
Keys
arianet baas keys list <project-id> # previews only
arianet baas keys reveal <project-id> anon # anon | service | publishable | secret | database
arianet baas keys rotate <project-id> # the previous keys keep working for 72 hours
Every reveal is recorded in your account's activity log. database shows the direct Database connection password. Key rotation
Your app's environment
arianet baas env <project-id> > .env.local
arianet baas env <project-id> --format json
Prints the Endpoint and Anon Key as ARIANET_BAAS_URL and ARIANET_BAAS_ANON_KEY, plus the same values with the public prefixes of common frameworks: NEXT_PUBLIC_BAAS_* (Next.js), VITE_BAAS_* (Vite), NUXT_PUBLIC_BAAS_* (Nuxt) and EXPO_PUBLIC_BAAS_* (Expo). Keep the lines your app reads. This command never prints the Service Key.
Run SQL
arianet baas sql <project-id> "select id, title from todos limit 5"
arianet baas sql <project-id> -f seed.sql
cat report.sql | arianet baas sql <project-id> -f - --read-only --json
Like the SQL Editor: the Database owner's access, every statement in one transaction (no BEGIN or COMMIT), at most 15 seconds, and the result of the last statement that returns Rows (at most 1000 Rows). --read-only makes the transaction read-only.
Migrations
arianet baas db push <project-id> # the migrations/*.sql files
arianet baas db push <project-id> --dir db/migrations --dry-run
arianet baas db pull <project-id> # current schema to migrations/<timestamp>_remote_schema.sql
arianet baas db pull <project-id> --file - > schema.sql
db pushapplies every*.sqlfile of--dir(defaultmigrations) not applied yet, in name order. Start file names with a timestamp, such as20261121093000_create_todos.sql.- Each file runs in its own transaction together with its record in the
baas_cli.migrationsTable (name, checksum, time), so it is applied completely or not at all. A file that was applied and has changed since is refused: put the change in a new migration file. Files must not containBEGINorCOMMIT. db pullwrites one Schema (defaultpublic) as SQL: Tables, keys, indexes, RLS, Policies, Triggers and comments. Views and the Functions that Triggers call are not included. To start migrations from an existing Project,--mark-appliedrecords the snapshot as applied in that Project sodb pushdoes not run it again.
TypeScript types
arianet baas types <project-id> --lang ts > src/database.types.ts
arianet baas types <project-id> --schema public,app > types.ts
Generates a Database type: for each Table, Row (what a read returns), Insert (columns with a default, an identity or NULL allowed are optional) and Update (all optional), plus the foreign key relationships and Views. Pass it to a typed client library as its Database type parameter.
Storage
arianet baas storage buckets <project-id>
arianet baas storage buckets create <project-id> --name avatars [--public] [--size-limit 5242880] [--types image/png,image/jpeg]
arianet baas storage buckets empty <project-id> avatars
arianet baas storage buckets delete <project-id> avatars
arianet baas storage ls <project-id> avatars [users/42/]
arianet baas storage upload <project-id> avatars ./me.png users/42/me.png [--upsert] [--content-type image/png]
arianet baas storage download <project-id> avatars users/42/me.png [local-file | -]
arianet baas storage rm <project-id> avatars users/42/me.png [more paths…] [-y]
Auth Users
arianet baas auth users list <project-id> [--search ali] [--page 2 --per-page 100]
arianet baas auth users get <project-id> <user-id>
arianet baas auth users create <project-id> --email ali@example.com --password 'S3cret-pass' --email-confirm
arianet baas auth users delete <project-id> <user-id>
Logs and Usage
arianet baas logs <project-id> --since 1h
arianet baas logs <project-id> --source rest --status 5 --search /todos
arianet baas usage <project-id>
--source: gateway, auth, storage, rest or sql. --status: 2, 3, 4 or 5. Logs are kept for 7 days (Logs).
Commands of the next CLI version
These commands ship in the version after v0.7.0 (update with arianet upgrade). In that version the default directory of migration files is arianet/migrations.
link
arianet baas link <project-id|ref> # link this directory to a Project
arianet baas db push # no <project-id>: the linked Project
arianet baas unlink
link writes the id, ref, name, Endpoint and Region to arianet/.baas/project.json. From then on, in this directory, every command that takes <project-id> first works on the linked Project without it (an explicit id still wins). The file holds no secret and can be committed.
migration and db diff
arianet baas migration new create_orders # an empty arianet/migrations/<UTC timestamp>_create_orders.sql
arianet baas migration list # files and the Project's history: applied, pending, changed, remote only
arianet baas db diff # compare the files and the newest snapshot with the Project
arianet baas db diff --against schema.sql
db diff compares two things: the migration files with the Project's history (not applied, changed after being applied, recorded without a file), and the Project's current schema (as db pull writes it) with the newest *_remote_schema.sql file or --against. Exit code 0 means no difference and 2 means there is one; handy in CI. In this version db pull writes Views, Functions and Enums too.
gen types
arianet baas gen types --lang typescript > src/database.types.ts
arianet baas gen types --schema public,app --file types.ts
The same output as arianet baas types (TypeScript types) under a new name; types keeps working.
Edge Functions, Advisors, Domains, transfer and API settings
arianet baas functions new|list|deploy|download|delete|serve … # guide: Edge Functions
arianet baas functions secrets list|set|unset …
arianet baas advisors [project-id] [--run]
arianet baas domains list|remove …
arianet baas transfer <project-id> | transfer list|status|cancel|accept|decline …
arianet baas api-settings get|set <project-id>
Details in Edge Functions, Advisors, Custom Domains, Project transfer and API settings.
Calling the API directly
For anything without its own command, arianet baas api <method> <path> sends any request with your token to https://api.ariaservice.net/baas/v1 and prints the answer as JSON:
arianet baas api GET /projects/<project-id>/usage