# Arianet BaaS > Arianet BaaS is a backend for web and mobile apps: a Postgres database with row level security and an instant REST API, Auth, Storage, Realtime, Edge Functions (Deno) and static Sites, deployed from a GitHub or GitLab repository on every git push. Each project lives at https://.baas.arianet.app; sites at https://.site.arianet.app. ## Rules for coding assistants - APIs of a project: `/auth/v1`, `/rest/v1/`, `/storage/v1`, `/functions/v1/`, `wss://.baas.arianet.app/realtime/v1/websocket`. Every request sends `apikey: `; a signed-in user adds `Authorization: Bearer ` (role `authenticated`, `auth.uid()` = the user). They also work with the common compatible client libraries. - The anon key is public and ships in browser code; row level security (RLS) is what protects data. The service role key bypasses RLS: only in Edge Functions or servers, never in browser code, a repository, a build variable or a chat. - Deploy = git push. Repository layout: `package.json` (site, `npm run build`), `arianet/config.toml`, `arianet/migrations/*.sql`, `arianet/functions//index.ts`, `arianet/functions/_shared/`. A push to the production branch builds the site, runs new migrations, applies config.toml differences, deploys changed functions and publishes the site last; the first failing step stops it and the project keeps what it had. Other branches and pull requests get a preview at `https://--.site.arianet.app` that applies no backend changes but uses the same database. - Migrations: `.sql` files directly in `arianet/migrations`, applied in name order (`0001_init.sql`, `0002_...`), all pending files in one transaction (no BEGIN/COMMIT), each file once. Never edit an applied migration (`migration_changed`); write a new file. After `migration_failed` nothing was applied. Every new table: `alter table ... enable row level security` plus a policy per action using `(select auth.uid())`, `with check` on writes. Realtime: `alter publication baas_realtime add table public.;`. File access: policies on `storage.objects`. - Edge Functions: Deno, `Deno.serve(handler)`; folder name = function name (`^[a-z0-9][a-z0-9_-]{0,62}$`, not `secrets`/`config`); entry `index.ts` (or index.js/.mjs/.tsx/.jsx, main.ts/.js); shared code in `_shared` imported as `../_shared/x.ts`; imports with `npm:`, `jsr:`, `https:`. Env: `ARIANET_BAAS_URL`, `ARIANET_BAAS_ANON_KEY`, `ARIANET_BAAS_DB_URL`, `ARIANET_BAAS_SERVICE_ROLE_KEY` (only when exposed in the settings) and the project secrets (set in the panel or CLI, never in the repo). `verify_jwt` is on by default. CORS is handled by the platform. - arianet/config.toml accepts only: `[auth]` site_url, redirect_urls, email_enabled, phone_enabled, anonymous_enabled, disable_signup; `[auth.providers.]` enabled, client_id (secrets refused); `[storage.buckets.]` public, file_size_limit, allowed_mime_types; `[cron.]` schedule, enabled and exactly one of sql or http {url, method, headers, body, timeout_ms}; `[functions.]` verify_jwt, entrypoint; top-level project_id. Unknown keys fail the deploy (`invalid_config`). Only differences are applied; removing an entry deletes nothing. - Site build: Node.js 22, npm (or pnpm 9 / yarn 1 by lock file; `npm ci` with package-lock.json), ` run build`, output `dist`, `build`, `out` or `public`. Static output only (no SSR). `ARIANET_BAAS_URL`, `ARIANET_BAAS_ANON_KEY` and `CI=1` are set during the build; frameworks that expose only prefixed variables need them mapped (e.g. Vite `envPrefix`, or `VITE_BAAS_URL` build variables). Build variables are not secret. - Start from the template https://github.com/ariaservice/arianet-baas-starter: its AGENTS.md has these rules in full, with working examples of auth, RLS, storage, realtime and a function. --- title: "Arianet BaaS" description: "Arianet Backend As A Service (Arianet BaaS) - a managed Postgres Database with an automatic REST API, Auth, Storage, Realtime and Edge Functions behind one Endpoint, in Region Tehran 1 (thr-1)." url: https://docs.ariaservice.net/en/baas markdown: https://docs.ariaservice.net/en/baas.md language: en --- # Arianet BaaS **Arianet Backend As A Service** (**Arianet BaaS** for short) is a ready-made backend for your app: a managed Postgres Database that comes with a REST API, user sign-in (Auth), file storage (Storage), live channels (Realtime) and server-side code (Edge Functions), all behind one Endpoint. There is no server to run and no API to write: you create Tables, add security Policies and connect straight from your web or mobile app. The Arianet BaaS client protocol is compatible with common Postgres/BaaS client libraries. An app written against them runs on Arianet BaaS once you change its URL and key. ## Components {#components} Each **Project** is a separate Database with these parts, all on one address, `https://.baas.arianet.app`, each under its own path: | Part | Path | What it does | |---|---|---| | **Database** | `.db.baas.arianet.app:5432` | A full Postgres Database with Tables, Views, Functions, Triggers and the allowed Extensions; [direct connection](https://docs.ariaservice.net/en/baas/database-settings#direct-connection) with psql and ORMs, daily backups | | **REST API** | `/rest/v1` | An automatic read/write API for every Table and View in the `public` Schema; RLS decides access | | **Auth** | `/auth/v1` | Sign-up and sign-in for your app's users with email and password, magic link, one-time code (OTP) and anonymous sign-in and sign-in with Google, GitHub and other providers; MFA; standard JWT tokens | | **Storage** | `/storage/v1` | Files in public or private Buckets, with Policies on files, Signed URLs, resumable uploads, image transformation and S3 access | | **Realtime** | `/realtime/v1` | Websocket channels for Broadcast, Presence and live Database changes | | **Edge Functions** | `/functions/v1` | Runs your TypeScript/JavaScript code on the server | | **Sites** | `.site.arianet.app` | [Frontend hosting](https://docs.ariaservice.net/en/baas/sites): static sites and SPAs with automatic HTTPS and one-click rollback | | **Git and Deploy** | — | [Automatic deploys from GitHub or GitLab](https://docs.ariaservice.net/en/baas/git): the site, migrations, functions and settings on every push, and a preview per branch | `` is the Project's 20-character id (lowercase letters and digits), assigned at creation and never changed. ## Region {#region} Projects are currently created in Region **`thr-1` (Tehran 1)**: a datacenter inside Iran, with the lowest latency for users in Iran and no dependency on international links. A Project's Region is chosen at creation and never changes; its Database and files stay there. ## Plans and limits {#free-plan} Every Project is created on a Plan, and the Plan sets its limits: Database and Storage size, monthly Egress (outbound traffic) and MAU (monthly active Auth users), concurrent connections and request rate, among others. Your plan's limits are shown in the panel (the [Usage](https://docs.ariaservice.net/en/baas/usage) page and when [creating a project](https://docs.ariaservice.net/en/baas/projects#plan-picker)). - **Warnings at 80 % and 100 %:** for each item (Database, Storage, Egress, MAU) you get one notice at 80 % and one at 100 % per month. What happens at a limit is in [Usage and limits](https://docs.ariaservice.net/en/baas/usage#limits). - **The usage period** is the calendar month in UTC; Egress and MAU start from zero every month. - **Automatic pause:** depending on the Plan, a Project that receives no request for a while may be paused. Its data is kept, and the next request brings it back within a few seconds ([details](https://docs.ariaservice.net/en/baas/faq#idle-pause)). ## Where to start - [Quickstart](https://docs.ariaservice.net/en/quickstart): from creating a Project to the first request with curl and JavaScript in a few minutes. - [Sample project: arianet-baas-starter](https://github.com/ariaservice/arianet-baas-starter): a complete Persian "Notes" app with Auth, RLS, Storage, Realtime and an Edge Function; click **Use this template** to make your own and publish it with [Git and Deploy](https://docs.ariaservice.net/en/baas/git#starter). - Panel guide: [Projects](https://docs.ariaservice.net/en/baas/projects), [Table Editor](https://docs.ariaservice.net/en/baas/table-editor), [Database](https://docs.ariaservice.net/en/baas/database), [SQL Editor](https://docs.ariaservice.net/en/baas/sql-editor), [Auth](https://docs.ariaservice.net/en/cli-reference/auth), [Storage](https://docs.ariaservice.net/en/baas/storage), [Edge Functions](https://docs.ariaservice.net/en/baas/functions), [Realtime](https://docs.ariaservice.net/en/baas/realtime), [Sites](https://docs.ariaservice.net/en/baas/sites), [Git and Deploy](https://docs.ariaservice.net/en/baas/git), [API Keys and Connect](https://docs.ariaservice.net/en/baas/api-keys), [Usage](https://docs.ariaservice.net/en/baas/usage), [Account quota](https://docs.ariaservice.net/en/baas/quotas), [Logs](https://docs.ariaservice.net/en/baas/logs), [Advisors, Reports, Domains and Members](https://docs.ariaservice.net/en/baas/platform), [Settings](https://docs.ariaservice.net/en/baas/settings). - Database: [Backup and restore](https://docs.ariaservice.net/en/baas/backups), [Direct connections and Database Settings](https://docs.ariaservice.net/en/baas/database-settings), [Integrations (Webhooks, Cron, Queues, Vault)](https://docs.ariaservice.net/en/baas/integrations). - API reference: [REST API](https://docs.ariaservice.net/en/baas/rest-api), [Auth API](https://docs.ariaservice.net/en/baas/auth-api), [Storage API](https://docs.ariaservice.net/en/baas/storage-api). - [CLI](https://docs.ariaservice.net/en/cli): the `arianet baas` commands for Projects, SQL, migrations, keys, Storage, Sites and Git, and `arianet mcp` for AI tools. - [Security and best practices](https://docs.ariaservice.net/en/baas/security) and the [FAQ](https://docs.ariaservice.net/en/baas/faq). --- title: "Arianet BaaS quickstart" description: "Arianet BaaS quickstart - create a Project in the panel, create a Table with RLS and a Policy, copy the Endpoint and Anon Key, and make a first request with curl and JavaScript." url: https://docs.ariaservice.net/en/baas/quickstart markdown: https://docs.ariaservice.net/en/baas/quickstart.md language: en --- # Arianet BaaS quickstart In this guide you create a Project, build a `todos` Table with RLS and a Policy, and send your first request with curl and JavaScript. It takes about five minutes. > **Sample project** To start from a complete app, see [**arianet-baas-starter**](https://github.com/ariaservice/arianet-baas-starter): a Persian "Notes" app with sign-in (email and password, or as a guest), a table with RLS, Storage, Realtime and an Edge Function. Click **Use this template** on GitHub to make your own copy and connect it in the panel with **Git و Deploy**; everything deploys on the first push ([details](https://docs.ariaservice.net/en/baas/git#starter)). ## 1. Create a Project 1. In the panel, open **Arianet BaaS** and click **Create new Project** («ساخت Project جدید»). 2. **Project name** («نام Project»): a recognisable name: English letters, digits, `-` and `_`, no spaces, up to 64 characters (such as `my-app`). You can change it later. 3. **Region**: choose Tehran 1 («تهران ۱», `thr-1`). 4. **Choose a Plan** («انتخاب Plan»): choose a Plan. Each Plan's limits are listed on its card. 5. **Review and confirm** («مرور و تأیید»): check the summary and click **Create Project** («ساخت Project»). Creating the Database usually takes less than a minute. When you see "Project is ready" («Project آماده است»), the Endpoint is shown and you can click **Create your first Table** («ساخت اولین Table»). ![Project is ready](https://docs.ariaservice.net/en/img/panel/baas-create-project-result.jpg) ## 2. Create a Table with RLS and a Policy 1. In the Project, open **Table Editor** and click **New Table** («Table جدید»). 2. **Name and security** («نام و امنیت»): name it `todos`. Keep RLS on (it is on by default). 3. **Columns** («ستون‌ها»): `id` (auto-incrementing) and `created_at` are already there. Add a `title` column of type `text` with **Add column** («افزودن ستون»), then click **Owner column (user_id)** («ستون مالک (user_id)») to create `user_id`: type `uuid`, default `auth.uid()` (the signed-in User's id), referencing the Auth Users so that deleting a User also deletes their Rows. 4. **Policies** («Policyها»): tick the template **"Each User only their own Rows"** («هر User فقط Rowهای خودش») and pick the `user_id` column for it. If everyone should be able to read the Rows, also add "Public read, only signed-in Users write" («خواندن عمومی، نوشتن فقط User واردشده»). 5. **Review SQL** («مرور SQL»): read the SQL that will run and click **Create Table** («ساخت Table»). ![The Policies step of creating a Table](https://docs.ariaservice.net/en/img/panel/baas-create-table-wizard-policies.jpg) The SQL generated for "Each User only their own Rows" is: ```sql create policy "todos: users manage own rows" on "public"."todos" for all to authenticated using ((auth.uid() = user_id)) with check ((auth.uid() = user_id)); ``` You add Rows in step 4 with a User's token; each Row's `user_id` becomes that User's id. > **Do not turn RLS off** With RLS off, anyone who has your Anon Key can read and change every Row of the Table. The Anon Key ships in client-side code and is not a secret; RLS and Policies are what protect your data. [Security and best practices](https://docs.ariaservice.net/en/baas/security) ## 3. Copy the Endpoint and Anon Key Open **API Keys and Connect** («API Keys و اتصال»): - **Endpoint** is the Project's address, `https://.baas.arianet.app`. - Next to **Anon Key**, click **Show** («نمایش») and copy the key. It is hidden again after one minute. ![API Keys and Connect](https://docs.ariaservice.net/en/img/panel/baas-api-keys-connect.jpg) Below, replace `` with the Project's ref and `` with this key. ## 4. First request with curl ```bash export BAAS_URL="https://.baas.arianet.app" export ANON_KEY="" curl "$BAAS_URL/rest/v1/todos?select=*" \ -H "apikey: $ANON_KEY" ``` The answer is `[]`: a request without a signed-in User runs as the `anon` role, and the "Each User only their own Rows" Policy does not let it see anything. RLS is doing its job. Now create a User, sign in and write a Row with their token: ```bash # Sign up (if email confirmation is on, confirm the email first, or create the User in the panel as confirmed) curl -X POST "$BAAS_URL/auth/v1/signup" \ -H "apikey: $ANON_KEY" -H "Content-Type: application/json" \ -d '{"email": "ali@example.com", "password": "a-strong-password"}' # Sign in with the password: take access_token from the answer curl -X POST "$BAAS_URL/auth/v1/token?grant_type=password" \ -H "apikey: $ANON_KEY" -H "Content-Type: application/json" \ -d '{"email": "ali@example.com", "password": "a-strong-password"}' export TOKEN="" # Insert a Row; user_id is filled with this User's id automatically curl -X POST "$BAAS_URL/rest/v1/todos" \ -H "apikey: $ANON_KEY" -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" -H "Prefer: return=representation" \ -d '{"title": "Buy bread"}' # Read: only this User's Rows curl "$BAAS_URL/rest/v1/todos?select=id,title,created_at&order=created_at.desc" \ -H "apikey: $ANON_KEY" -H "Authorization: Bearer $TOKEN" ``` ## 5. First request with JavaScript Any client library compatible with Postgres/BaaS works. The exact client package name is shown in the **Connection code samples** («نمونه‌کد اتصال») card under API Keys and Connect; put it in place of `` below: ```js import { createClient } from '' const client = createClient('https://.baas.arianet.app', '') // Sign in const { data: session, error: loginError } = await client.auth.signInWithPassword({ email: 'ali@example.com', password: 'a-strong-password', }) // Read Rows (RLS returns only this User's Rows) const { data, error } = await client.from('todos').select('*') ``` Without a library, `fetch` works too: ```js const BAAS_URL = 'https://.baas.arianet.app' const ANON_KEY = '' const res = await fetch(`${BAAS_URL}/rest/v1/todos?select=*`, { headers: { apikey: ANON_KEY }, }) const todos = await res.json() ``` ## Next steps - [Sample project](https://github.com/ariaservice/arianet-baas-starter): a complete "Notes" app to start from with [Git and Deploy](https://docs.ariaservice.net/en/baas/git#starter). - [REST API](https://docs.ariaservice.net/en/baas/rest-api): filtering, ordering, paging, upsert and calling Functions. - [Auth API](https://docs.ariaservice.net/en/baas/auth-api): one-time codes, password recovery and `auth.uid()` in Policies. - [Storage](https://docs.ariaservice.net/en/baas/storage): uploading files and Signed URLs. - [CLI](https://docs.ariaservice.net/en/cli): `arianet baas env` prints your app's environment variables. --- title: "Start with no tech background: what GitHub and GitLab are and how to connect your project" description: "A plain guide for beginners - what GitHub and GitLab are, what a repository is, creating a free GitHub account, creating a repository from the ready-made sample, letting an AI assistant (Claude Code and others) write the code, connecting the repository in the Arianet panel and seeing the result after every push." url: https://docs.ariaservice.net/en/baas/github-for-beginners markdown: https://docs.ariaservice.net/en/baas/github-for-beginners.md language: en --- # Start with no tech background: what GitHub and GitLab are and how to connect your project This page is for someone who wants to build a site or an app with the help of AI but has never used GitHub. You do not need to be a programmer; just follow the steps in order. It takes about 15 minutes. By the end of this page: - you have a free GitHub account; - you have a repository (your project's online folder) that starts from a ready-made app; - the repository is connected to your Arianet project, and **every change you or an AI assistant saves is published to the internet automatically**. ## A few words to know {#words} | Word | Means | |---|---| | **Repository** | An online folder that holds all your app's files and keeps the history of every change; you can go back to an earlier version at any time. | | **GitHub** and **GitLab** | Two sites that store repositories, like "Google Drive for code". Both have free accounts. This page uses GitHub as the example; GitLab works the same way. | | **Git** | The tool behind GitHub and GitLab that records changes. You do not have to use it yourself; the AI assistant does. | | **Commit** | A "save" with a short description, e.g. "changed the button colours". | | **Push** | Sending commits from a computer (or from the assistant) to GitHub. | | **Branch** | A separate copy of the project for trying out changes. The main branch is usually called `main`, and it is what people see. | | **Pull Request** | A request to "add this branch's changes to the main branch". Clicking **Merge** moves the changes to `main`. | | **Deploy** | Building the app and putting it on the internet. On Arianet every push deploys automatically. | ## Step 1: create a free GitHub account {#account} 1. Go to [github.com/signup](https://github.com/signup). 2. Enter your email, a strong password and a username. The username appears in the address of your repositories. 3. Enter the code sent to your email. 4. If it asks how you will use GitHub, you can click **Skip**. The **Free** plan is enough. > **Account security** Turn on two-factor sign-in in GitHub (**Settings → Password and authentication**). Your app's code lives in this account. ## Step 2: create a repository from the ready-made sample {#repository} The easiest start is Arianet's sample app: a Persian "Notes" app with user sign-in, a database, image uploads and live updates, ready to deploy. The AI assistant turns it into the app you want. 1. Open [github.com/ariaservice/arianet-baas-starter](https://github.com/ariaservice/arianet-baas-starter). 2. At the top, click the green **Use this template** button, then **Create a new repository**. 3. Give it a name (e.g. `my-shop`). Choose **Private** so only you see the code. 4. Click **Create repository**. You now have a repository of your own. The sample has a file called `AGENTS.md` that explains to the AI assistant how the project works on Arianet, so you do not have to explain anything. > **An empty repository** If you do not want to start from the sample, click **+** at the top of GitHub → **New repository**, give it a name and tick **Add a README file**. Then ask the assistant to set up the project layout as described in [Build with AI](https://docs.ariaservice.net/en/baas/build-with-ai). ## Step 3: a BaaS project in the Arianet panel {#project} If you do not have a project yet, open **Arianet BaaS** in the [Arianet panel](https://panel.ariaservice.net) and create a Project ([Projects guide](https://docs.ariaservice.net/en/baas/projects)). It takes a few minutes. ## Step 4: connect the repository in the panel {#connect} 1. In the panel, open the Project and click **Git و Deploy** (Git and Deploy) in its menu. 2. Choose **Connect repository** («اتصال Repository») and then **GitHub**. A list of what Arianet can and **cannot** do is shown (Arianet never changes your code). Click **Continue to GitHub**. 3. On GitHub choose **Only select repositories**, pick your new repository and click **Install** (or **Authorize**). 4. You return to the panel. Pick the repository from the list. 5. In the **Settings** step everything is filled in for you (for the sample: `npm run build` and the `dist` folder). Just give a **Site name**; your site's address becomes `https://.site.arianet.app`. 6. Click **Connect and deploy**. The first deploy starts and the panel takes you to its live log. A few minutes later the app opens at the site address. More detail: [Git and Deploy](https://docs.ariaservice.net/en/baas/git#connect). ## Step 5: write the code with an AI assistant {#ai} Now ask an AI assistant to change the app. The assistant edits the files in this repository and pushes; every push is published automatically. ### Claude Code on your phone or in the browser {#claude-code-web} No installation on a computer: 1. Sign in to the Claude app or [claude.ai/code](https://claude.ai/code) and connect your GitHub account (let Claude access this repository). 2. Pick your repository. 3. Write what you want in plain words, e.g. "Turn this notes app into a shopping list where every user has their own list". 4. The assistant does the work and usually pushes the changes to a separate **branch**. Arianet builds a **preview** (a test copy at its own address) for that branch, so you can look before the real release. 5. If you are happy, click **Merge** on the assistant's **Pull Request** on GitHub (or ask the assistant to). The changes go to `main` and the main site is updated. ### Claude Code on a computer {#claude-code-desktop} Install Claude Code, bring the repository to your computer (ask Claude Code: "clone this repository") and work in that folder. When it is ready, say "commit and push". ### Other assistants {#other-assistants} ChatGPT (Codex), Cursor, GitHub Copilot and similar tools also connect to GitHub or work with git on your computer. Whichever you use, the flow is the same: the assistant changes the code and pushes, Arianet publishes. All of them read the sample's `AGENTS.md`. > **A small change with no tools at all** To change a piece of text, open the file on GitHub, click the pencil (**Edit**), make the change and click **Commit changes**. That is a push, and it deploys. > **Let the assistant see the status itself** Connect the [Arianet MCP server](../ai-assistants.md) to your assistant and it can read the deploy status and error logs itself and fix the problem. The full flow: [Build with AI on Arianet](https://docs.ariaservice.net/en/baas/build-with-ai). ## Step 6: every push is a release {#every-push} From now on you do not need to do anything in the panel: | Pushed to | What happens | |---|---| | The main branch (`main`) | The main site and the database (tables, settings, functions) are updated. | | Any other branch or a pull request | A **preview** is built at `https://--.site.arianet.app`; the main site is not touched. | If a deploy fails, the previous version of the site stays in place and nothing is left half-broken. ## Where to see the result {#result} - **Site address:** `https://.site.arianet.app`; it is also shown on the **Git و Deploy** page and in [Sites](https://docs.ariaservice.net/en/baas/sites). - **Status of each deploy:** in the panel, **Git و Deploy** → the **Deployments** list. Open one to see its live log and the reason for a failure. - **On GitHub:** each commit has a mark next to it: a yellow dot means publishing, a green tick means published, a red cross means an error. Clicking it opens that deploy's page in the panel. ## If it fails {#errors} 1. Open that deploy's page in the panel and copy the error and the last lines of the log. 2. Give them to the assistant and say: "The Arianet deploy failed with this error; find the cause, fix it and push again". 3. If the assistant is connected to the Arianet MCP server, just say "check the last deploy and fix it". Every error code and how to fix it: [Deploy errors](https://docs.ariaservice.net/en/baas/git#errors). ## Safety notes {#safety} - Never put the **Service Key**, the database password or other services' keys in the repository, in a chat with the assistant or in the site's code. Enter them only in the panel (the functions' Secrets). The anon key is public and is fine inside the site. - A **Private** repository is enough; Arianet only sees the repositories you pick. - If you put a key in the repository by mistake, change it in the panel on the [API Keys and connect](https://docs.ariaservice.net/en/baas/api-keys#rotate) page; deleting the file is not enough, because the history keeps it. ## Next {#next} - [Build with AI on Arianet](https://docs.ariaservice.net/en/baas/build-with-ai): the full flow with an assistant and a ready text to start with. - [Git and Deploy](https://docs.ariaservice.net/en/baas/git): every detail of connecting, previews and build settings. - [Connect AI assistants](../ai-assistants.md): connect Claude, ChatGPT and Cursor to your Arianet account. --- title: "Build with AI (vibe coding) on Arianet" description: "Building an app with an AI assistant on Arianet BaaS (vibe coding) - the workflow (the assistant writes code, push, automatic deploy), starting from the sample with AGENTS.md, giving the assistant the docs through llms.txt, connecting the Arianet MCP server to read status and logs, a ready project brief prompt and the rules the assistant must follow." url: https://docs.ariaservice.net/en/baas/build-with-ai markdown: https://docs.ariaservice.net/en/baas/build-with-ai.md language: en --- # Build with AI (vibe coding) on Arianet In **vibe coding** you say what you want and an AI assistant (Claude Code, ChatGPT, Cursor, Copilot, …) writes the code. Arianet BaaS is built so that the assistant understands how the project works without you explaining it, and every change it makes is published with one push. If GitHub is new to you, read [Start with no tech background](https://docs.ariaservice.net/en/baas/github-for-beginners) first. ## The workflow {#workflow} ```text You: "I want a small shop with a cart" ↓ Assistant: writes the site, the tables (migrations), the functions and config.toml ↓ Assistant: commit and push to GitHub or GitLab ↓ Arianet: build, run the migrations, apply the settings, publish the site (automatic) ↓ Assistant (with the Arianet MCP server): reads the deploy status and log; on an error it fixes and pushes again ``` - A push to the main branch (`main`) updates the main site; every other branch gets a **preview** at its own address ([Previews](https://docs.ariaservice.net/en/baas/git#previews)). - If a step fails, the Project keeps what it had. ## Step 1: start from the ready-made sample {#starter} Copy [**arianet-baas-starter**](https://github.com/ariaservice/arianet-baas-starter) with **Use this template** and connect it in the panel with **Git و Deploy** ([steps](https://docs.ariaservice.net/en/baas/github-for-beginners#repository)). The sample has two files for assistants: | File | Purpose | |---|---| | `AGENTS.md` | The project's rules for any assistant: repository layout, migrations, functions, the allowed `config.toml` keys, the build, auth and RLS, storage, realtime, local testing and a checklist before every push. ChatGPT/Codex, Cursor, Copilot and most assistants read it automatically. | | `CLAUDE.md` | Tells Claude Code to read `AGENTS.md`. | If you started your own project from scratch, copy the sample's `AGENTS.md` into your repository and change the parts that are about the sample (such as the table names). ## Step 2: give the assistant the docs {#docs-for-ai} All Arianet docs are published in a form that models read completely and accurately ([Docs for AI](../ai.md)). For BaaS these files are enough: | File | Content | |---|---| | [`/en/baas/llms.txt`](pathname:///en/baas/llms.txt) | The BaaS pages with the main rules, in English (the most accurate for models) | | [`/en/baas/llms-full.txt`](pathname:///en/baas/llms-full.txt) | The whole BaaS reference in one file, in English | | [`/baas/llms.txt`](pathname:///baas/llms.txt) and [`/baas/llms-full.txt`](pathname:///baas/llms-full.txt) | The same files in Persian | | [`/en/llms.txt`](pathname:///en/llms.txt) and [`/en/llms-full.txt`](pathname:///en/llms-full.txt) | The whole site (cloud, VPS, hosting, CLI, …) | These files are generated from these very pages every time the docs site is built, so they are always current. Every page is also available as Markdown by adding `.md` to its address, e.g. [`/en/baas/git.md`](pathname:///en/baas/git.md). ## Step 3: connect the Arianet MCP server {#mcp} With the [Arianet MCP server](../ai-assistants.md) (`https://mcp.ariaservice.net/mcp`) the assistant works on your account itself, with exactly the permissions you choose on the consent page: - `deploy_status` and `get_logs`: reads the last deploy's status and build log and fixes errors itself. - `create_baas_project` and `run_baas_migrations`: creates a Project and runs migrations (a dry run by default). - `rollback_site`: puts the site back to an earlier version (with your explicit approval). The Service Key and passwords are never given to the assistant. How to connect each client (Claude, Claude Code, ChatGPT, Cursor, VS Code): [Connect AI assistants](../ai-assistants.md#connect). ## Step 4: introduce the project to the assistant {#project-brief} Your first message to the assistant should say where the project is and what you want. If the panel shows a ready project brief for your Project, copy it and paste it into the first message. Otherwise fill in this template: ```text You are building my app on Arianet BaaS. Before writing any code: 1. Read AGENTS.md in this repository (if it is missing, read https://docs.ariaservice.net/en/baas/llms.txt and the pages it links). 2. Follow the repository layout and rules exactly: SQL changes only as new files in arianet/migrations (never edit an applied one), Edge Functions in arianet/functions//, settings only with the documented keys in arianet/config.toml, site built with `npm run build` into dist/, RLS on every table. My project: - Project URL: https://.baas.arianet.app - Site: https://.site.arianet.app - Production branch: main - The anon key is injected at build time as ARIANET_BAAS_URL / ARIANET_BAAS_ANON_KEY; never ask me for the service key and never put any secret in the repository. What I want: Work in small steps. After each step run `npm run build`, commit with a clear message and push. Then check the deploy (deploy_status / get_logs if the Arianet MCP server is connected) and fix it if it failed. Tell me in plain words what changed and anything I must do in the panel (for example a secret to add). ``` The Project URL is on the [API Keys and connect](https://docs.ariaservice.net/en/baas/api-keys) page and the site address in [Sites](https://docs.ariaservice.net/en/baas/sites). The anon key is public, so giving it to the assistant is fine; never give it the Service Key. ### A few ready requests {#prompts} ```text Add sign-in with email and password, and a "my orders" page where every user sees only their own orders. Use a new migration with RLS policies for the orders table. ``` ```text The last Arianet deploy failed. Read the deploy log (get_logs), find the cause, fix it in a new commit and push. If the error is migration_failed, none of the pending migrations was applied, so fix the failing file itself; never edit a migration that was applied before. ``` ```text Let users upload a profile photo: add a private bucket "avatars" in config.toml (max 2 MB, images only), storage policies so each user can only touch their own folder, and show the photo through a signed URL. ``` ## Rules the assistant must follow {#rules} If the assistant breaks these, the deploy is refused or the data is at risk. The sample's `AGENTS.md` has all of them: | Rule | If it is broken | |---|---| | Database changes only as a new file in `arianet/migrations` with the next number; an applied file is never edited. | The deploy is refused with `migration_changed`. | | No `BEGIN`/`COMMIT` inside migrations; all new files run in one transaction. | `migration_failed`, and nothing is applied. | | Every new table: `enable row level security` and a policy per action. | Users' data can be read or changed with the public anon key. | | Only the [documented keys](https://docs.ariaservice.net/en/baas/git#config-toml) in `config.toml`; no secret in the file. | The deploy is refused with `invalid_config`. | | The Service Key, the database password and other services' keys never in code or the repository; secrets go in the panel. | Anyone can read and delete all the data. | | Static site output (`npm run build` → `dist`); server-side rendering (SSR) is not supported. | `build_failed` or an empty site. | | Commit `package-lock.json` with every dependency change. | `npm ci` fails in the build. | | Server work (webhooks, secret keys, deleting users) in an [Edge Function](https://docs.ariaservice.net/en/baas/functions), never in browser code. | The secret key is published with the site. | ## What you do yourself {#your-part} - Create the Project and connect the repository (once). - Enter secrets in the panel when the assistant names them (e.g. a payment gateway's key). - Turn on paid features (such as SMS sign-in) or upgrade the plan; the assistant must not do these without your approval. - Look at the preview before merging, and approve sensitive actions the assistant asks for in the panel. ## Read more {#more} - [Start with no tech background: GitHub and GitLab](https://docs.ariaservice.net/en/baas/github-for-beginners) - [Git and Deploy](https://docs.ariaservice.net/en/baas/git) · [Edge Functions](https://docs.ariaservice.net/en/baas/functions) · [Security and best practices](https://docs.ariaservice.net/en/baas/security) - [Connect AI assistants](../ai-assistants.md) · [Docs for AI](../ai.md) --- title: "Projects and creating a Project" description: "The Arianet BaaS Project list, the steps of creating a Project (name, Region, Plan, review), Project states and the Overview page." url: https://docs.ariaservice.net/en/baas/projects markdown: https://docs.ariaservice.net/en/baas/projects.md language: en --- # Projects and creating a Project Each **Project** in Arianet BaaS is a separate Database with its own Endpoint, keys, Auth Users and Storage files. Create one Project per app (or per environment, such as staging and production). ## Project list The **Projects** («Projectها») page lists all your Projects, each as a full-width card. The card shows the name, `ref`, state, Plan, Region and the Project's Endpoint (with a copy button), and all of this month's usage against the Plan's limits: Database, Storage, Egress, MAU, requests, SMS OTP, and Realtime messages and peak concurrent connections. ## Create a new Project {#create} **Create new Project** («ساخت Project جدید») is a four-step wizard: | Step | What it does | |---|---| | **Project name** («نام Project») | English letters, digits, `-` and `_` only, no spaces, up to 64 characters; it must not start with `-` or `_` (such as `my-app` or `shop_prod`). The technical id (`ref`) and the Endpoint are generated. | | **Region** | Tehran 1 («تهران ۱», `thr-1`). The Project's Database and files stay in this Region, and the Region cannot be changed later; for another Region, create another Project. | | **Choose a Plan** («انتخاب Plan») | One row per Plan with its monthly price and five headline limits; **Details** («جزئیات») shows every feature ([Plan picker](#plan-picker)). | | **Review and confirm** («مرور و تأیید») | Name, Region, Plan, price, Database limit and automatic pause, once more. **Create Project** («ساخت Project») starts creating the Database. | ### Plan picker {#plan-picker} The Plan picker is the same when creating a Project and in [Change Plan](https://docs.ariaservice.net/en/baas/settings#change-plan). Each Plan has one row with its monthly price (and the hourly equivalent when the Plan is sold hourly) and five headline limits. **Details** («جزئیات») opens a window with every feature of the Plan: concurrent connections, requests per second, query timeout, maximum file size, image transformation, S3 keys, automatic pause when idle, Projects per account, and what happens beyond the limits (a hard stop, or extra usage metered). - If you have reached a Plan's Project limit, the Plan step does not let you continue. Delete one of your Projects or choose another Plan. - If the Plan has a price, the first month is deducted from your wallet; with too little balance the Project is not created. If creating fails, any amount deducted goes back to your wallet. - If your account needs identity verification before creating a Project, this step tells you. Creating the Database usually takes less than a minute. Then "Project is ready" («Project آماده است») shows the name and Endpoint with three buttons: **Open Project** («ورود به Project»), **Create your first Table** («ساخت اولین Table») and **API Keys and Connect** («API Keys و اتصال»). ![Project is ready](https://docs.ariaservice.net/en/img/panel/baas-create-project-result.jpg) ## Project states {#states} | State | Meaning | |---|---| | Provisioning («در حال ساخت») | The Database is being created; the management pages are not available until it is done. | | Active («فعال») | The Project answers requests. | | Paused («متوقف») | The Database and files are kept but no request is answered. **Resume Project** («ادامهٔ کار Project») brings it back. An automatic pause for idleness also ends with the next request ([details](https://docs.ariaservice.net/en/baas/faq#idle-pause)). | | Suspended («معلق») | Arianet suspended the Project; it cannot be used until the suspension is lifted. The reason is shown at the top of the page: non-payment, terms violation, support decision or Database space full. | | Deleting («در حال حذف») | The Project is being deleted and disappears from the list in a moment. | ## Project overview {#overview} Opening a Project shows its **Overview** («نمای کلی»), and the main sidebar becomes the Project's menu, in the groups Project, Build, Database, Integrations and Settings; **All Projects** («همهٔ Projectها») takes you back to the list. The Project's sections: Overview, [Table Editor](https://docs.ariaservice.net/en/baas/table-editor), [SQL Editor](https://docs.ariaservice.net/en/baas/sql-editor), [Auth](https://docs.ariaservice.net/en/cli-reference/auth), [Storage](https://docs.ariaservice.net/en/baas/storage), [API Keys and Connect](https://docs.ariaservice.net/en/baas/api-keys), [Usage](https://docs.ariaservice.net/en/baas/usage), [Logs](https://docs.ariaservice.net/en/baas/logs) and [Settings](https://docs.ariaservice.net/en/baas/settings). - **Endpoint:** the single address of this Project's REST API, Auth and Storage, with a copy button. Below it, the creation time and the last request. - **Quick start** («شروع سریع»): three steps to the first request: create a Table, take the key and code sample, and set up user sign-in. - **This month's usage** («مصرف این ماه»): Database, Storage, Egress and MAU against the Plan's limits, with a link to [Usage](https://docs.ariaservice.net/en/baas/usage). - **Pause and resume** («توقف و ادامه»): pause or resume the Project ([Settings](https://docs.ariaservice.net/en/baas/settings#pause)). The header shows the Project's name, state, **ID (ref)** («شناسه (ref)», with a copy button), Plan and Region. The ref is the Project's technical id: the first label of its Endpoint (`https://.baas.arianet.app`) and the id that client libraries and the [CLI](https://docs.ariaservice.net/en/cli) ask for. --- title: "Table Editor" description: "The Arianet BaaS Table Editor - create Tables from a template or a CSV header with a column grid, edit a Table and change column types, indexes, relations, view and edit Rows, RLS and Policies from ready-made templates." url: https://docs.ariaservice.net/en/baas/table-editor markdown: https://docs.ariaservice.net/en/baas/table-editor.md language: en --- # Table Editor The **Table Editor** manages your Database's structure and data without writing SQL: create Tables, view and edit Rows, add or drop columns, and use RLS and Policies to decide who can reach which Rows. Every structural change shows the SQL that ran. ![Table Editor with a Table's Rows](https://docs.ariaservice.net/en/img/panel/baas-table-editor-rows.jpg) On the side of the page: - **Schema:** `public` by default. Only Tables in the `public` Schema are served by the [REST API](https://docs.ariaservice.net/en/baas/rest-api). - **Search Table** («جستجوی Table») and the list of Tables. A Table with RLS off has a red open-lock icon. - **New Table** («Table جدید»). Selecting a Table shows its full name (such as `public.todos`), RLS state, size and approximate Row count, and these tabs: **Rows** («Rowها»), **Structure** («ساختار»), **Indexes** («Indexها»), **Relations** («ارتباط‌ها») and **RLS and Policy** («RLS و Policy»). The **Edit Table** («ویرایش Table») button is at the top of the page. ## Create a Table {#create-table} **New Table** opens a four-step wizard: 1. **Name and security** («نام و امنیت»): the Table name in lowercase English letters, digits and underscores, plus an optional description. **RLS is on by default** so nobody can reach the Rows without a Policy. Turning it off shows a warning: anyone with the Anon Key could read and change every Row. 2. **Columns** («ستون‌ها»): each row is a column: name, type, default value and primary key. Next to the form, a **structure preview** shows the Table live. - **Start from a template:** "id and created_at" (the default), "Empty", "User profile (linked to Auth)" and "Task list (todos)". Or take the column names from the first line of a CSV file with **From CSV header** («از سرستون CSV»). - **Type:** a grouped, searchable list that includes the Project's Enums. - **Default value:** ready-made suggestions that fit the type, such as `identity` (auto-increment), `now()` and `gen_random_uuid()`. - **More settings** (the settings button of each row): Nullable, Unique, array, Check condition, comment and Foreign key (target Table and column, and the on-delete behaviour: `no action`, `cascade`, `set null`, `restrict`). - **Add column** («افزودن ستون») adds a column; drag rows to change the column order. - **Owner column (user_id)** («ستون مالک (user_id)») adds a `uuid` column `user_id` that defaults to `auth.uid()` (the signed-in User's id) and references the Auth Users (deleting a User deletes their Rows). It works with the "Each User only their own Rows" Policy template. ![The Columns step of creating a Table](https://docs.ariaservice.net/en/img/panel/baas-create-table-columns.jpg) 3. **Policies** («Policyها»): choose one or more ready-made templates (table below). Without a Policy, no Row is visible through the API; only the SQL Editor and the Service Key have access. 4. **Review SQL** («مرور SQL»): exactly the SQL that will run. **Create Table** («ساخت Table») runs it. ![The Policies step of creating a Table](https://docs.ariaservice.net/en/img/panel/baas-create-table-wizard-policies.jpg) ## Rows {#rows} The **Rows** tab shows the Table's data page by page. Each column header shows its type, and the primary key column has a key icon. - **New Row** («Row جدید»): a form opens at the side. Columns with a default can be left empty for the Database to fill; each column also has "default value" and NULL options. - **Edit:** the pencil next to each Row. Only the values you change are saved; primary key columns cannot be edited. - In the Row form, a Foreign key column is filled by **searching the target Table's Rows**, `json`/`jsonb` columns are validated before saving, and date and time columns have a calendar. - **Delete:** tick Rows and click "Delete … Rows". Deleting cannot be undone. - **Filter** («فیلتر»): pick a column and a condition: equal, not equal, greater than, greater than or equal, less than, less than or equal, contains (`like`), contains ignoring case (`ilike`), is NULL and is not NULL. Several filters combine. - **Refresh** («تازه‌سازی») reloads the data. Row counts are exact up to 10,000. ![Editing a Row](https://docs.ariaservice.net/en/img/panel/baas-table-editor-row-drawer.jpg) > **note** - Editing and deleting Rows needs a Table with a **primary key**; without one you can only add Rows. - Views are read-only. - The Table Editor works with the Database owner's access, so RLS does not limit it. A column whose default is `auth.uid()` has no value in the Table Editor; fill it in yourself. ## Structure {#structure} The **Structure** tab lists the columns (name, type, NULL, default), indexes and constraints. - **New column** («ستون جدید»): name, type, "column can be empty (NULL)", "values must be unique" and an optional default. If the Table already has Rows and the column does not accept NULL, you must give a default so the existing Rows are filled. Text defaults go in single quotes (`'draft'`); functions and numbers without quotes (`now()`, `0`). - **Drop column:** the bin icon next to a column. The column and all its data are deleted for good. With the cascade option, dependent objects (indexes, Views, Policies) are dropped too. - **Delete Table** («حذف Table»): the button at the top; type the Table name to confirm. The exact name is shown with a copy button and pasting is allowed. The Table is deleted with all its Rows and Policies. ## Edit a Table {#edit-table} **Edit Table** is a three-step wizard: 1. **Table:** name, comment and RLS. Renaming changes the Table's API address too; apps that use the old address must be updated. 2. **Columns:** rename, change the type, default, Unique, Foreign key and the other settings; add a new column or drop one. For a **type change**, the conversion's `USING` expression is previewed. If the conversion may truncate or round data you get a data-loss warning, and if a value cannot be converted to the new type the change is not made and the data is left alone. The order of existing columns and the primary key are not changed here. 3. **Review changes:** each change with its SQL. The changes run one by one in this order; if one fails it stops there and you see which ones were done. ## Indexes {#indexes} The **Indexes** tab lists the Table's indexes with their method and columns. **New Index** is a three-step wizard: 1. **Columns:** the columns you use in searches (`WHERE`), sorting (`ORDER BY`) or joins (`JOIN`). Order matters. The primary key and Unique columns already have an index. 2. **Method and settings:** `B-tree` (right for most cases), `GIN` (for `jsonb`, arrays and text search), `GiST`, `BRIN` (for large Tables with ordered data such as time) or `Hash` (one column only, equality only). Options: **Unique**, **Partial** (only Rows matching a `WHERE` condition) and **Concurrently** (build without locking writes; if it is interrupted it leaves an invalid index that you must drop). 3. **Review SQL.** ## Relations {#relations} The **Relations** tab shows this Table's Foreign keys to other Tables and other Tables' Foreign keys to this one. The full picture is in the [Schema diagram](https://docs.ariaservice.net/en/baas/database#diagram). ## RLS and Policy {#rls} **RLS** (Row Level Security) means that for every API request the Database checks, Row by Row, whether that request may see or change the Row. A **Policy** is a rule that grants this. With RLS on and no Policy, the API returns no Rows. ![The RLS and Policy tab](https://docs.ariaservice.net/en/img/panel/baas-table-policies.jpg) In the **RLS and Policy** tab: - The RLS state and a **Turn RLS on** / **Turn RLS off** button (with confirmation). With RLS off, every Policy stops having any effect. - The list of Policies with their name, roles, command and SQL, and a delete button. - **New Policy** («Policy جدید»): a four-step wizard: 1. **Template** («قالب»): a ready-made template or "Custom". 2. **Who and what** («چه کسی و چه عملی»): the Policy name, the command (`SELECT`, `INSERT`, `UPDATE`, `DELETE` or `ALL`), the roles (`anon` a visitor who has not signed in, `authenticated` a signed-in User) and Permissive (if there are several Policies, one is enough). 3. **Conditions** («شرط‌ها»): `USING` decides which existing Rows can be seen or changed; `WITH CHECK` decides which Rows may be written. Conditions can use `auth.uid()` (the signed-in User's id), `auth.role()` and column names. 4. **Review SQL** («مرور SQL»): read the `create policy` statement and confirm. ### Policy templates {#policy-templates} | Template | Command and role | Condition | |---|---|---| | **Each User only their own Rows** («هر User فقط Rowهای خودش») | `ALL` for `authenticated` | `auth.uid() = user_id` in `USING` and `WITH CHECK` (needs a `uuid` column) | | **Public read, only signed-in Users write** («خواندن عمومی، نوشتن فقط User واردشده») | `SELECT` for `anon` and `authenticated` | `true` | | **Only signed-in Users read** («فقط User واردشده می‌خواند») | `SELECT` for `authenticated` | `true` | | **Signed-in Users can add Rows** («User واردشده می‌تواند Row اضافه کند») | `INSERT` for `authenticated` | `WITH CHECK (true)` | | **Custom** («سفارشی») | any | you write the conditions in SQL | > **tip** - The Service Key and the SQL Editor bypass RLS; Policies only limit requests made with the Anon Key or a User's token. - Where `auth.uid()` comes from: [Auth API: auth.uid() in Policies](https://docs.ariaservice.net/en/baas/auth-api#auth-uid). ## On mobile Every part of the Table Editor works on a small screen; the Table list comes first and the Rows grid below it scrolls sideways. ![Table Editor on a phone](https://docs.ariaservice.net/en/img/panel/baas-table-editor-mobile.jpg) --- title: "Database" description: "The Arianet BaaS Database section - schemas and REST API schemas, views and materialized views, functions and rpc, triggers, enums, extensions, roles, the schema diagram, CSV import and export, and automatic API docs." url: https://docs.ariaservice.net/en/baas/database markdown: https://docs.ariaservice.net/en/baas/database.md language: en --- # Database The **Database** section shows and manages the structure of a Project's database, apart from its data: schemas, views, functions, triggers, enums, extensions and roles, plus the schema diagram, CSV import and export, and the API docs generated from that structure. For tables and rows use the [Table Editor](https://docs.ariaservice.net/en/baas/table-editor); for anything else use the [SQL Editor](https://docs.ariaservice.net/en/baas/sql-editor). ![The Database section and its list of schemas](https://docs.ariaservice.net/en/img/panel/baas-database-schemas.jpg) Before any change, every tab shows the SQL that will run. ## Schemas {#schemas} - **REST API schemas:** only the schemas in this list are reachable through the [REST API](https://docs.ariaservice.net/en/baas/rest-api). The first is the default (usually `public`); the others are chosen with the `schema` option of the client library. Change the list with **Change**; the privileges the `anon`, `authenticated` and `service_role` roles need on the schema are granted too (policies still decide which rows are visible). - **New schema** creates an empty schema; dropping a schema asks you to type its name. - System schemas (`auth`, `storage`, `realtime`, …) are managed by the platform. They are read-only here and marked with a lock. ## Views and materialized views {#views} Create a view or a materialized view from a name, a schema and a `SELECT` query. Before creating it, **Preview** shows the first rows of the query's result. A materialized view stores its result and is recomputed with **Refresh**. > **security_invoker** A view in a REST API schema can also be read through the API. Keep **security_invoker** on, so the view runs with the privileges and RLS of the user reading it. Without it, the view runs with its creator's privileges and bypasses the RLS of the underlying tables for the reader. ## Functions {#functions} A function is database-side logic your app calls with `rpc`: ```js const { data, error } = await client.rpc('add_points', { user_id: id, amount: 10 }) ``` Or over REST: `POST /rest/v1/rpc/` with the parameters in the JSON body. **New function** is a five-step wizard: name and language (`sql` or `plpgsql`), arguments and return type (including `setof`, `table` and `trigger`), body, behaviour and security, and SQL review. - Over the REST API the arguments are sent under the same names in the JSON body. - **Behaviour** (`volatile`, `stable`, `immutable`) helps the planner. - **SECURITY DEFINER** means the function runs with its creator's privileges (and bypasses RLS). Use it only when you need it, and always with a fixed `search_path`, so nobody can change the function's behaviour by creating a same-named object in another schema. ## Triggers {#triggers} A trigger runs a function on `INSERT`, `UPDATE` or `DELETE` on a table (`BEFORE` or `AFTER`, for each row or each statement). The function must return `trigger`. Triggers on `auth.users` are allowed too, for example to create a profile row when a user signs up: ```sql create function public.handle_new_user() returns trigger language plpgsql security definer set search_path = '' as $$ begin insert into public.profiles (id, email) values (new.id, new.email); return new; end $$; create trigger on_auth_user_created after insert on auth.users for each row execute function public.handle_new_user(); ``` ## Enums {#enums} An enum is a type with a fixed set of values (such as `'draft'`, `'published'`). Create an enum, add a value, rename a value or drop the enum. A value cannot be removed once added; it can only be renamed. The Project's enums also appear in the column type picker of the Table Editor. ## Extensions {#extensions} The list of allowed extensions with their on/off state. Extensions are installed in the `extensions` schema. Turning an extension off removes the functions and types it provides; with the CASCADE option the columns and indexes that depend on it are dropped as well. Extensions outside this list cannot be installed. ## Roles {#roles} The database roles and what each one means. The three roles you use in policies: | Role | Who | |---|---| | `anon` | A request without sign-in, with the Anon Key only | | `authenticated` | A signed-in user with a valid token | | `service_role` | Your server with the Service Key; bypasses RLS and must never be in client-side code | ## Schema diagram {#diagram} Shows the tables of a schema and their foreign key relations. Primary keys are marked `PK`, nullable columns `?`, and a table from another schema (such as `auth.users`) has a dashed border. Zoom and pan to move around. ![Schema diagram](https://docs.ariaservice.net/en/img/panel/baas-database-diagram.jpg) ## Import and export {#csv} - **Import from CSV:** add the rows of a CSV file to an existing table, or create a new table from it. Column types are suggested from the sample values and you see the SQL before it runs. The file size and row limits come from your Plan. - **Export a table:** all rows of the table are downloaded as CSV. - **Export a query result:** a read-only `SELECT` runs and its result is downloaded as CSV. ## API Docs {#api-docs} For every table, view and function in the REST API schemas, docs are generated automatically with `curl` and JavaScript examples: reading with filters, inserting, updating, deleting and calling `rpc`. The examples carry your Project's address; fill in the key yourself. The docs follow every change of the structure. > **GraphQL** A GraphQL endpoint is not offered yet and is **coming soon**; until then use the [REST API](https://docs.ariaservice.net/en/baas/rest-api). --- title: "SQL Editor" description: "The Arianet BaaS SQL Editor - run SQL with the Database owner's access in one transaction, read-only mode, Snippets, sample queries, errors and limits." url: https://docs.ariaservice.net/en/baas/sql-editor markdown: https://docs.ariaservice.net/en/baas/sql-editor.md language: en --- # SQL Editor The **SQL Editor** runs any SQL statement on the Project's Database: create Tables, Functions and Triggers, change structure, run migrations and reports, and anything the Table Editor does not cover. Statements run with the **Database owner's access**, so RLS does not limit them. ![SQL Editor showing an error](https://docs.ariaservice.net/en/img/panel/baas-sql-editor-error.jpg) ## Run SQL 1. Type SQL in the editor, or pick one from **Sample query** («نمونه Query»): list Tables, Table sizes, active Policies, create a sample Table. 2. Click **Run** («اجرا») or press Ctrl+Enter. How a run works: - **All statements run in one transaction**: they are applied together or not at all. Do not write `BEGIN` or `COMMIT` in the text; they are refused. - The result of the **last statement that returns Rows** is shown in **Result** («نتیجه»), with the run time in milliseconds. At most **1000 Rows** (and 5 MB) are shown; beyond that a note says only the first Rows are shown, and you should narrow the query. - Each run has at most **15 seconds** and is then cancelled. - A statement that returns no Rows ends with "ran without error". ## Read-only mode {#read-only} Turn on **Read-only** («فقط‌خواندنی») to make sure the query changes nothing. The transaction is then read-only and any `INSERT`, `UPDATE`, `DELETE` or structural change fails. Use it for reports on live data. ## Errors {#errors} If a statement fails, the **SQL error** («خطا در اجرای SQL») box shows: - the Database's error message and its **SQLSTATE** code (for example `42P01` the Table does not exist, `42501` permission denied, `23505` duplicate value in a unique column); - the **line** of the error, highlighted red in the editor; - with several statements, the **number of the statement** that failed. Since they all run in one transaction, the earlier statements are rolled back too. ## Snippets {#snippets} Save queries you use often to run them again any time: - **Save as Snippet** («ذخیره به‌عنوان Snippet»): give it a name and save. With a Snippet open you can **Update** («به‌روزرسانی») it or **Save as new** («ذخیره به‌عنوان جدید»). - The **Snippets** («Snippetها») list sits next to the editor; click one to load its text. - Deleting a Snippet only deletes the saved text; it does not touch the Database. - A Project holds up to 200 Snippets. Snippets belong to the Project; team members with access to the Project see them. ## Limits and activity - Per Project, at most 30 runs a minute and 600 an hour (the SQL Editor and the Table Editor's structural changes together). Beyond that you get a rate-limit error; try again shortly. - Every run is recorded in your account's activity log (time, Row count and run time). **The SQL text is never stored.** - Running SQL needs the `baas:sql:execute` permission ([Security](https://docs.ariaservice.net/en/baas/security#token-scopes)). > **Migrations from the terminal** To apply migration files in order and keep them in Git, use [`arianet baas db push`](https://docs.ariaservice.net/en/cli#migrations). SQL tools such as `psql` also work over the [direct Database connection](https://docs.ariaservice.net/en/baas/api-keys#direct-connection). --- title: "Auth: your app's users" description: "The Auth section of the Arianet BaaS panel - manage Users and sessions, sign-in methods, sign-in with Google, GitHub and OpenID Connect, MFA, password rules and CAPTCHA, email templates and your own SMTP, the SMS log, rate limits, Auth hooks and audit logs." url: https://docs.ariaservice.net/en/baas/auth markdown: https://docs.ariaservice.net/en/baas/auth.md language: en --- # Auth: your app's users The **Auth** section shows the users who signed up in your app (not the members of your Arianet account) and decides how they sign in. Sign-up and sign-in happen from your app through the [Auth API](https://docs.ariaservice.net/en/baas/auth-api); this page is for viewing and managing Users by hand and for the settings. All Auth sections are in a tab strip that is always visible at the top: **Users**, **Sign-in methods** («روش‌های ورود»), **Providers**, **Policies** (password rules, CAPTCHA and account), **Email**, **SMS** («پیامک‌ها»), **URLs**, **Rate Limits**, **Sessions**, **MFA**, **Hooks** and **Audit Logs**. ![Auth Users list](https://docs.ariaservice.net/en/img/panel/baas-auth-users.jpg) ## Users {#users} The Users table shows for each User: - **User:** email or phone (an anonymous User is marked "anonymous"). - **Status** («وضعیت»): confirmed, unconfirmed, anonymous or banned. - **Method** («روش»): the ways the User signed in (such as `email` or `phone`). - **Last sign-in** and **Created**. Find a User with **Search email or phone** («جستجوی ایمیل یا موبایل»). Clicking a User opens **User details** («مشخصات User») with the id (copyable), email, phone, timestamps and metadata, and these actions: | Action | Effect | |---|---| | **Confirm email manually** («تأیید دستی ایمیل») | The email is marked confirmed without a confirmation link. | | **Send magic link** («ارسال Magic link») | A one-time sign-in link is emailed to the User. | | **Send password recovery link** («ارسال لینک بازیابی رمز») | A link to set a new password is sent; the current password works until the link is used. | | **Ban** («مسدود کردن») | The User cannot sign in for the chosen period (24 hours, 7 days, 30 days or permanently); current sessions end when their token expires. | | **Unban** («رفع مسدودی») | The User can sign in again. | | **End session** / **End all sessions** («بستن نشست» / «بستن همهٔ نشست‌ها») | The User's active sessions (device, time) are listed on their page; an ended session is signed out at its next refresh. | | **Delete factor** («حذف Factor») | Removes one of the User's multi-factor (MFA) factors, for example when they lost their phone. | | **Delete User** («حذف User») | The User and all their sessions are deleted for good. Rows that reference them with `on delete cascade` (such as the Table Editor's owner column) are deleted too. | ## Create a User {#create-user} **New User** («User جدید») is a three-step wizard: 1. **How** («روش ساخت»): - **Create with a password** («ساخت با رمز عبور»): you set the password; good for test Users or moving users over. - **Invite by email** («دعوت با ایمیل»): the User is created without a password and gets a sign-in link (magic link) by email. 2. **Details** («مشخصات»): email, phone (optional; international form such as `+989121234567` or the Iranian local form `09121234567`) and password (the minimum length from the settings, 6 by default). The email or phone must be unique. With "treat the email / phone as confirmed" the User can sign in without a confirmation code. 3. **Review and create** («مرور و ساخت»). ![Creating a User](https://docs.ariaservice.net/en/img/panel/baas-auth-user-wizard.jpg) The User's password is never shown anywhere; give it to them yourself. ## Sign-in methods and URLs {#settings} The **Sign-in methods** tab shows the current state (email sign-in, phone sign-in, anonymous sign-in, new sign-ups, email confirmation required, minimum password length, one-time code length and lifetime). **Edit step by step** («ویرایش گام‌به‌گام») has these steps: 1. **Sign-in methods** («روش‌های ورود») - Email sign-up and sign-in (with a password or magic link) - Phone sign-in (SMS code): only on a Plan with SMS ([SMS](#sms)). - Anonymous sign-in (a temporary User without an email) - New sign-ups closed: only Users you create or invite can sign in. - At least one sign-in method must stay on. 2. **Security** («امنیت») - Email must be confirmed before sign-in (on by default). If you turn it off, anyone can sign up with any email, including someone else's. - Phone must be confirmed before sign-in. - Minimum password length (default 6), one-time code (OTP) length (6 to 10 digits, default 6) and code lifetime in seconds (default 300). 3. **URLs** («آدرس‌ها») - **Site URL** («آدرس برنامه»): where email links go when no allowed redirect is given. - **Allowed redirect URLs** («آدرس‌های مجاز بازگشت», one per line): confirmation, magic link and password recovery links only go back to these addresses and the Site URL. `*` matches within one host label or path segment and `**` matches anything; mobile app URLs (such as `myapp://callback`) must be listed exactly. 4. **Review changes** («مرور تغییرات»): only what you changed is applied. Changes reach every User within a few seconds; current sessions are not ended. ## Providers: sign in with Google, GitHub and more {#providers} The **Providers** tab sets up sign-in with outside accounts: **Google**, **GitHub**, **GitLab**, **Microsoft (Azure)**, **Apple**, **Discord**, **Bitbucket**, **LinkedIn (OIDC)**, **X (Twitter)** and any **OpenID Connect** compatible provider (the **Custom provider (OIDC)** button). ![The Providers tab](https://docs.ariaservice.net/en/img/panel/baas-auth-providers.jpg) The **Callback URL** of every provider is at the top of the tab (`https://.baas.arianet.app/auth/v1/callback`) with a copy button. **Set up** («راه‌اندازی») for each provider is a three-step wizard: 1. **Create an OAuth App:** create an OAuth App in the provider's console and register the Callback URL in it. 2. **Client ID and Secret:** enter them. The Secret is stored encrypted and never shown again. 3. **Review:** once confirmed, sign-in with this provider is live within a few seconds. - A User who already has an account with the same confirmed email is linked to that account. A signed-in User can link their other accounts too (if "Manual identity linking" is on in the Policies tab). - From your app: `client.auth.signInWithOAuth({ provider: 'github', options: { redirectTo } })`. Both the PKCE and implicit flows are supported, and sign-in with an ID token (for example from Google's or Apple's native SDK in a mobile app) works too. - Turning a provider off closes new sign-ins with it, but its current Users and their sessions stay. - Some providers may be hard to reach from servers in Iran; test sign-in before you publish. ## Policies: passwords, CAPTCHA and account {#policies} - **Password rules:** minimum length, required characters (none; letters and digits; lowercase, uppercase and digits; or lowercase, uppercase, digits and symbols), whether changing the password from a session older than 24 hours needs a confirmation code, and **leaked-password protection**: a password found in the list of known leaked passwords is refused. The check runs fully offline inside Arianet and the password is never sent to any outside service. New rules apply to passwords created or changed from then on. - **CAPTCHA:** with Cloudflare Turnstile or hCaptcha. The Site Key goes in your app's widget and the Secret stays on Arianet's server only. Your app sends the widget's token in the `captchaToken` option of the sign-up, sign-in, one-time code and password recovery methods. - **Account settings:** **confirm email changes from both addresses** (current and new), **manual identity linking** (a signed-in User can link or unlink, say, GitHub), Access Token lifetime, app name and the language of messages (Persian with the English text below it, or English). ## Email: templates and your own SMTP {#email} - **Emails** (sign-up confirmation, invitation, magic link, password recovery, email change, reauthentication) are sent by default by Arianet on behalf of your app, in Persian and English. Sending from Arianet's server is rate-limited. - **Custom templates:** write the text of each kind of email yourself (Go templates; variable values are escaped automatically) and see a **preview** with sample data before saving. **Reset** brings back the default message. - **Your own SMTP:** send the emails from your own mail server: host, port (465 with TLS, others with mandatory STARTTLS), username and password, and sender (address and name). Send a **test email** before saving; wrong settings mean Users never get their confirmation email. - **SMS codes (SMS OTP)** are only available on Plans with SMS ([SMS](#sms)), unless you send the SMS yourself with the [Send SMS hook](#hooks). Existing Users can sign in with phone and password on every Plan. ## SMS {#sms} ### Sending SMS codes {#sms-sending} - SMS sign-in needs a Plan with SMS. Whether your Plan includes SMS, and its monthly SMS quota, is shown in the panel; its use is in [Usage](https://docs.ariaservice.net/en/baas/usage). - Phone numbers are accepted in international form (`+989121234567`) or the Iranian local form (`09121234567`); spaces, dashes and Persian digits are fine. They are all stored the same way, so `0912…` and `+98912…` are the same User. - Sending codes is rate limited too: one code per number per minute (by default) and a set number of SMS per hour for the whole Project ([Rate Limits](#rate-limits)). Beyond that: `429 over_sms_send_rate_limit`. - Codes are sent from a dedicated Arianet line for BaaS. The text is fixed: «کد تأیید \{app name\}: …», valid for 5 minutes. It cannot be changed and cannot carry links. For your own text or SMS service, use the [Send SMS hook](#hooks). ### SMS log {#sms-log} The **SMS** («پیامک‌ها») tab lists every SMS this Project's Auth has sent (sign-in code, phone change and MFA): | Column | Meaning | |---|---| | **Time** | When it was sent | | **Number** | The recipient's phone | | **Purpose** | Sign-in code, phone change or MFA | | **Code** | Only the last two digits, such as `••••56` | | **State** | Sent, with the operator, delivered (with the delivery time) or failed (with the reason) | | **Line and operator** | The sender line and the recipient's operator | | **Message id** | The same `message_id` as in the Auth API [send response](https://docs.ariaservice.net/en/baas/auth-api#send-response) | - The full code is never stored or shown, so nobody with console access can sign in as a User. - **Filter by number** to find the messages to one phone. - When you open the log, message states are refreshed from the operator's delivery reports. - Messages sent before 28 November 2026 are not in the log. ## URLs {#urls} The **Site URL** and **allowed redirect URLs** (as in [Sign-in methods and URLs](#settings)) can be edited in this tab too. `*` matches within one part of an address and `**` matches anything; an origin without a path covers all its paths. Addresses not listed here are never redirect targets, so a sign-in link cannot send your Users to another site. **Test an address** («آزمایش یک آدرس») tells you whether an address is allowed. The addresses of this Project's [Sites](https://docs.ariaservice.net/en/baas/sites#auth), their custom domains and [git previews](https://docs.ariaservice.net/en/baas/git#previews) are allowed automatically; you do not list them here. ## Rate Limits {#rate-limits} Request limits for sign-up, sign-in, sending email and SMS, code verification and token refresh, **per IP address**. A value of 0 means the Plan's value; more than the Plan's limit is not possible. Past the limit the answer is `429` with a wait time. ## Sessions {#sessions} - **Time-box:** a session is ended after this time, however active it is. - **Inactivity:** a session not refreshed for this long is ended. - **Single session per User:** a new sign-in ends the User's other sessions. 0 means no limit; otherwise between 300 seconds and one year. Sessions past these limits end at their next refresh. Each User's sessions, and ending them, are on that User's page. ## MFA (multi-factor authentication) {#mfa} Users can enrol a second **factor**: **TOTP** (an authenticator app) or an **SMS code** (only on a Plan with SMS or with the Send SMS hook). In this tab you decide, per kind, whether Users can add it and whether sign-in with it is accepted, and the maximum number of factors per User. After a factor is verified the User's session reaches level `aal2`, and its token says so; with RLS you can require `aal2` for sensitive data: ```sql create policy "sensitive needs mfa" on public.payouts as restrictive for all to authenticated using ((auth.jwt() ->> 'aal') = 'aal2'); ``` From your app: `client.auth.mfa.enroll`, `challenge` and `verify`. ## Hooks {#hooks} An Auth hook hands one step of Auth to your code: | Hook | What it does | |---|---| | **Custom Access Token** | Change or add claims before every token is issued (for example the user's role from your own Table) | | **Send Email** | The code and link of Auth emails are given to you to send yourself; Arianet sends no email | | **Send SMS** | The SMS code is given to you to send with your own SMS service (phone sign-in without the Plan's SMS) | | **MFA Verification Attempt** | Every MFA verification attempt is reported to you and you can reject it (depending on the Plan) | | **Password Verification Attempt** | Every password sign-in attempt is reported to you; you can reject it and end the User's sessions (depending on the Plan) | It runs in one of two places: - **A function in this Project's Database:** runs as `service_role` with one `jsonb` argument and returns `jsonb`; at most 3 seconds. No Secret needed. - **An HTTPS endpoint:** the request is signed with HMAC-SHA256. Headers: `webhook-id`, `webhook-timestamp` and `webhook-signature` (`v1,` plus the base64 HMAC-SHA256 of `id.timestamp.body`). The Secret is shown only once, when it is created. A hook error stops that step (for example the sign-in). ## Audit Logs {#audit-logs} Auth events (sign-up, sign-in, sign-out, password change, factor enrolment, admin actions on a User, …) with time and User. Filters: event type, email, User ID and start time. ## MAU limit **MAU** is the number of distinct Users who signed in or refreshed their token in the current month (UTC). The Plan sets the MAU limit, shown in the panel. If that limit is hard, once it is reached new sign-ups are refused until the month ends; existing Users keep signing in ([Usage and limits](https://docs.ariaservice.net/en/baas/usage#limits)). --- title: "Storage: files" description: "Storage in the Arianet BaaS panel - create public or private Buckets, file size and type limits, a file browser with upload, move and preview, Signed URLs, Storage Policies from ready-made templates and S3 access." url: https://docs.ariaservice.net/en/baas/storage markdown: https://docs.ariaservice.net/en/baas/storage.md language: en --- # Storage: files **Storage** keeps your app's files: profile pictures, documents, videos. Files live in **Buckets**; a Bucket is like a top-level folder, such as `avatars` or `documents`. Access to files is decided by the Bucket type (public or private) and by Storage Policies. From your app, use the [Storage API](https://docs.ariaservice.net/en/baas/storage-api). ## Create a Bucket {#create-bucket} **New Bucket** («Bucket جدید») is a four-step wizard: 1. **Bucket name** («نام Bucket»): English letters and digits, `_`, `.` and `-`. The name cannot be changed later. 2. **Access** («دسترسی»): - **Private — recommended** («خصوصی (Private) — پیشنهادی»): only Users allowed by a Policy, and the Service Key, can see the files. For temporary sharing, create a Signed URL. - **Public** («عمومی (Public)»): anyone with a file's address can download it without signing in. Only for public content such as site images; never put personal or confidential data in a public Bucket. 3. **Limits** («محدودیت‌ها», optional): - **Maximum size per file (MB)**: below the Plan's per-file limit (your plan's value is shown in the panel). - **Allowed file types**: such as `image/png` or `image/*`; empty means any type. 4. **Review and create** («مرور و ساخت»). The Bucket is created empty. You can change its access and limits later from the Bucket page. ## Browse and upload files {#objects} Opening a Bucket shows its files and folders (name, size, last change). The current path is above the table; click a folder to enter it. ![Files in a Bucket](https://docs.ariaservice.net/en/img/panel/baas-storage-objects.jpg) - **Upload file** («بارگذاری فایل»): choose files or drag and drop them onto the page. Files are uploaded to the current path with the progress of each, and a large upload resumes where it stopped after a dropped connection. Each file goes **directly from your browser to this Project's Storage** through a short-lived signed upload URL and does not pass through the panel, so large files upload without a middleman. - **Narrow screens (mobile):** each file's size, time and actions are shown under its name. - **Multi-select:** tick several files and delete them together. - **Move and rename:** write the new path; a `/` moves the file to another folder. Moving to another Bucket is possible too, and that Bucket's file size and type limits apply to copies and moves as well. - **Preview** of images, PDFs and text (only the start of a large text file), and **Copy URL** (the public URL or a Signed URL). - **Folders** are not created separately: write the file name with a path (such as `users/42/avatar.png`) and the folders appear. - **Search file name** («جستجوی نام فایل») in the current path. - **Download:** files are always downloaded as attachments. - **Signed URL:** creates a temporary link with which anyone can download the file, without signing in, until it expires. Choose the **validity** («مدت اعتبار», 10 minutes, 1 hour, 1 day or 7 days) and click **Create link** («ساخت لینک»). - **Delete file:** deleted for good; links you made for it stop working too. ## Manage a Bucket {#manage-bucket} The buttons at the top of a Bucket page: - **Make public** / **Make private** («عمومی کردن» / «خصوصی کردن»): when a Bucket becomes private, its public file links stop working and access is only through Policies and Signed URLs. - **Empty** («خالی کردن»): every file in the Bucket is deleted for good; the Bucket itself stays. - **Delete Bucket** («حذف Bucket»): only an empty Bucket can be deleted. Type the Bucket name to confirm. ## Storage Policies {#policies} The **Policies** tab decides what `anon` and signed-in Users may do with files (RLS on `storage.objects` and `storage.buckets`). Without a Policy, no file is visible or writable through the API. The Service Key, the console and S3 keys bypass Policies, and a public Bucket needs no Policy for its public links. **New Policy** is a three-step wizard: 1. **Template:** - **Public read:** everyone (`anon` and signed-in Users) reads this Bucket's files through the API. - **Read for signed-in Users:** `authenticated` only. - **Each User their own folder:** the file path starts with `auth.uid()` (such as `/avatar.png`) and each User works only in their own folder. - **Owner only:** each User sees and changes only the files they uploaded (`owner_id`). - **Custom:** write the name, operation, roles and the `USING` and `WITH CHECK` conditions yourself. The helpers `storage.foldername(name)`, `storage.filename(name)` and `storage.extension(name)` are available. 2. **Bucket and operations:** which Bucket and which operations (read, upload, update, delete) the Policy covers. One Policy is created per operation. 3. **Review SQL:** the SQL that will run. ![Storage Policy templates](https://docs.ariaservice.net/en/img/panel/baas-storage-policy-templates.jpg) ## S3 access {#s3} The Project's Buckets can also be reached with S3-compatible tools and libraries (such as `aws-cli`, `rclone` or any SDK). The **S3 access** tab shows the Endpoint (`https://.baas.arianet.app/storage/v1/s3`), the Region and the addressing style (path-style, `forcePathStyle: true`). - **New S3 key** creates an Access Key ID and Secret Access Key. **The secret is shown only once.** - S3 keys are **at the Service Key's level** and bypass Policies; keep them on your server only. You can **revoke** a key at any time. - Each Bucket's file size and type limits and the Plan's limits apply to S3 requests too. The number of active keys and whether S3 access is included depend on the Plan; this tab says what your Plan has. ```bash aws s3 ls s3://avatars --endpoint-url https://.baas.arianet.app/storage/v1/s3 ``` ## Reaching files from your app - Files in a **public Bucket** download without a key from `https://.baas.arianet.app/storage/v1/object/public//`. - For a **private Bucket**, and for uploading to any Bucket, the User must be allowed by a **Policy on files**. Until you write one, only the Service Key and the panel can reach the files. A sample "each User only their own folder" Policy is in [Storage API: RLS on files](https://docs.ariaservice.net/en/baas/storage-api#storage-rls). ## Limits {#limits} - The Plan sets the total file size and the size of one file; your plan's limits are shown in the panel and on the [Usage](https://docs.ariaservice.net/en/baas/usage) page. If the Storage limit is hard, once the quota is full new uploads are refused until you delete files or move to a bigger Plan. - The Storage size in [Usage](https://docs.ariaservice.net/en/baas/usage) is re-measured within about a minute after files are uploaded or deleted. - File downloads count towards the monthly **Egress**. - To protect your users, HTML, SVG, XML and JavaScript files are sent as attachments (downloads), not as pages a browser runs. Serving them inline depends on the Plan and needs an identity-verified account. - Resumable (TUS) uploads for large files and image transformation on download are in the [Storage API](https://docs.ariaservice.net/en/baas/storage-api#resumable). Whether image transformation is available depends on the Plan. --- title: "Edge Functions" description: "Edge Functions in Arianet BaaS - TypeScript and JavaScript code on each Project's own endpoint, created from a template in the console or with the CLI, verify_jwt, secrets and environment variables, testing, logs, versions and rollback." url: https://docs.ariaservice.net/en/baas/functions markdown: https://docs.ariaservice.net/en/baas/functions.md language: en --- # Edge Functions **Edge Functions** run your TypeScript or JavaScript code on the server, for work that must not live in client-side code: receiving webhooks, calling another service's API with a secret key, processing before writing to the database, or proxying an AI service. Every function has an address: ``` https://.baas.arianet.app/functions/v1/ ``` It is called with any method (`GET`, `POST`, …) and sub-path (`/functions/v1//a/b`) and works with the client libraries' `functions.invoke`: ```js const { data, error } = await client.functions.invoke('hello-world', { body: { name: 'Ali' } }) ``` The top of the **Functions** page shows the endpoint, the number of functions and this month's invocations against the Plan's limits; below are the function list, [secrets](#secrets) and [settings](#settings). ## Creating a function {#create} **New function** is a three-step wizard: 1. **Choose a template:** - **Hello world:** takes JSON and returns a greeting; for getting started. - **Database query:** connects to this Project's database with the client library and passes the request's Authorization on, so RLS applies. - **Webhook signature verify:** checks the HMAC-SHA256 signature of the raw body (verify_jwt off, secret `WEBHOOK_SECRET`). - **AI API proxy:** forwards a chat request to a compatible endpoint and streams the answer; the API key stays in a secret. 2. **Name and access:** the name (lowercase letters, digits and `-`) forms the function's address. See **verify_jwt** [below](#verify-jwt). 3. **Review and deploy:** check the code and address and deploy. The function is ready a few seconds later. ## Writing code {#code} Register the handler with `Deno.serve`; it takes a standard web Request and returns a Response: ```ts Deno.serve(async (req) => { const { name } = await req.json().catch(() => ({ name: 'world' })) return Response.json({ message: `Hello ${name}!` }) }) ``` - Import packages with the `npm:`, `jsr:` and `https:` prefixes (such as `import { Hono } from 'npm:hono'`). - `req.url` sees the path as `//`, so routers such as Hono work with `basePath('/')`. - Responses are streamed (Server-Sent Events work too). - `console.log`/`console.error` output is stored in the [Logs](#function-page) tab. - A function can reach other internet services but not internal or private addresses; writing to disk and running processes are not allowed either. ### Environment variables {#env} Available with `Deno.env.get`: | Variable | Value | |---|---| | `ARIANET_BAAS_URL` | The Project's address (`https://.baas.arianet.app`) | | `ARIANET_BAAS_ANON_KEY` | The Anon Key | | `ARIANET_BAAS_DB_URL` | The direct database connection string (owner privileges) | | `ARIANET_BAAS_SERVICE_ROLE_KEY` | The Service Key; **only** when "Expose the Service Key" is on in [settings](#settings) | | Your secrets | Every secret you defined under [Secrets](#secrets) | ### CORS {#cors} The platform answers the browser's preflight (`OPTIONS`) for every origin itself and adds `Access-Control-Allow-Origin` to every response; your function needs no CORS code. Code ported from elsewhere that sets its own CORS headers keeps working. ## verify_jwt {#verify-jwt} **On** by default: only requests with a valid `Authorization: Bearer ` header of this Project are accepted: the Anon Key, the Service Key or a signed-in user's token. Without it the answer is `401`. For a function that an outside service calls without a JWT (such as a payment gateway's webhook), turn verify_jwt off and check the request yourself (for example with a signature). With it off, anyone who knows the address can call the function and use up your invocation quota. ## A function's page {#function-page} ![A function's editor](https://docs.ariaservice.net/en/img/panel/baas-function-editor.jpg) | Tab | What it does | |---|---| | **Code** | Editor for the function's files; **Deploy new version** publishes the changes | | **Test** | A test call with method, sub-path, headers and body, as `anon`, `service_role` or without Authorization; shows the status, headers, body and duration of the response | | **Invocations** | Charts of calls, errors and response time | | **Logs** | Invocations and code output of the last 7 days, with filters | | **Versions** | The deployed versions; **roll back** by activating an earlier version | | **Settings** | Turn verify_jwt on or off and delete the function | A deploy does not interrupt a running function: the next call runs the new version. ## Secrets {#secrets} A secret is a confidential value every function of the Project reads with `Deno.env.get('NAME')` (such as `STRIPE_KEY`). - Secrets are **write-only**: after saving, the value is never shown again; you see only a digest to tell when it changed. - Names starting with `ARIANET_` are reserved for the system. - A changed secret applies from the next call; no redeploy is needed. ## Settings {#settings} **Expose the Service Key:** when on, functions see `ARIANET_BAAS_SERVICE_ROLE_KEY` and connect to the database with full access (no RLS). Off by default; turn it on only when you need it. ## Limits {#limits} The number of functions, bundle size, monthly invocations, maximum run time per call and memory are set by the Plan; the current values are shown at the top of the Functions page. If the invocation limit is hard (depending on the Plan), once the monthly quota is used up calls are refused until the end of the month. A call that runs past its time limit is stopped with `504`. ## With the CLI {#cli} These commands are in the current CLI ([CLI](https://docs.ariaservice.net/en/cli#more)). ```bash arianet baas functions new hello-world # arianet/functions/hello-world/index.ts from a template arianet baas functions serve hello-world # run locally with Deno, reloading on every change arianet baas functions deploy hello-world arianet baas functions deploy # every function folder arianet baas functions deploy webhook-receiver --no-verify-jwt arianet baas functions list arianet baas functions download hello-world arianet baas functions secrets set STRIPE_KEY= [--env-file .env] arianet baas functions secrets list arianet baas functions delete hello-world ``` `serve` needs Deno installed on your machine. With [`arianet baas link`](https://docs.ariaservice.net/en/cli#link) you can leave out ``. --- title: "Realtime" description: "Realtime in Arianet BaaS - Websocket channels for Broadcast between clients, Presence and live database changes (Postgres Changes) that respect RLS, private channels with policies, and the Inspector in the console." url: https://docs.ariaservice.net/en/baas/realtime markdown: https://docs.ariaservice.net/en/baas/realtime.md language: en --- # Realtime **Realtime** provides Websocket channels for live apps: chat, notifications, collaborative editing, showing who is online, or updating a page when data changes in the database. Its endpoint: ``` wss://.baas.arianet.app/realtime/v1/websocket ``` The protocol is compatible with the Realtime module of the client libraries; create the client with the Project's address and Anon Key. Each channel has three features: | Feature | What it does | |---|---| | [Broadcast](#broadcast) | Sends a message from one client to the other clients of the same channel, also from REST or from the database | | [Presence](#presence) | Who is in the channel right now (for example "online") | | [Postgres Changes](#postgres-changes) | Receives a table's `INSERT`, `UPDATE` and `DELETE`, only the rows RLS allows | ## Broadcast {#broadcast} ```js const room = client.channel('room-1', { config: { broadcast: { self: false, ack: true } } }) room.on('broadcast', { event: 'message' }, ({ payload }) => console.log(payload)) room.subscribe((status) => { if (status === 'SUBSCRIBED') { room.send({ type: 'broadcast', event: 'message', payload: { text: 'hello' } }) } }) ``` - `self: true` also returns the message to its sender; `ack: true` gets a confirmation for every send. - **From a server over REST:** `POST /realtime/v1/api/broadcast` with the body `{"messages": [{"topic": "room-1", "event": "message", "payload": {...}}]}` (1 to 100 messages). - **From the database:** in SQL or a trigger: ```sql select realtime.broadcast('room-1', 'message', '{"text": "hi"}'::jsonb, false); -- topic, event, payload, private select realtime.send('{"text": "hi"}'::jsonb, 'message', 'room-1', false); -- payload, event, topic, private ``` `realtime.broadcast_changes(...)` sends a row change as a broadcast from inside a trigger. For tables with many subscribers of different identities, broadcasting from the database is lighter than Postgres Changes. ## Presence {#presence} ```js const room = client.channel('room-1', { config: { presence: { key: userId } } }) room.on('presence', { event: 'sync' }, () => console.log(room.presenceState())) room.subscribe(async (status) => { if (status === 'SUBSCRIBED') await room.track({ online_at: new Date().toISOString() }) }) ``` `track` records your presence and `untrack` removes it. A client that joins gets the full state, then only the changes (joins and leaves). When a client's connection drops, its presence is removed automatically. ## Postgres Changes {#postgres-changes} ```js client .channel('todos-changes') .on('postgres_changes', { event: '*', schema: 'public', table: 'todos', filter: 'user_id=eq.' + userId }, (change) => console.log(change.eventType, change.new, change.old)) .subscribe() ``` - `event`: `INSERT`, `UPDATE`, `DELETE` or `*`. Without `table`, every enabled table of the schema. - `filter`: `column=op.value` with the operators `eq`, `neq`, `lt`, `lte`, `gt`, `gte` and `in` (such as `status=in.(open,closed)`). - **The table must have Realtime enabled** (see below). Otherwise the channel gets a system error message. - **RLS per client:** each client receives changes only for rows the table's `SELECT` policies let it see. A `DELETE` reaches everyone allowed to read the table, but with RLS on, `old` holds only the primary key. - Delivery is "at most once": changes made while a client is disconnected are not resent; after reconnecting, read the data once from the API. ### Enabling Realtime for a table {#enable} On the Realtime page, in **Realtime tables**, click **Enable Realtime** next to the table, or **Enable for a table**. The wizard has three steps: choose the table, **Previous row** (by default `UPDATE` and `DELETE` send only the primary key of the previous row; turn this on if you need the old value of every column), and SQL review. You can do the same in a migration: ```sql alter publication baas_realtime add table public.todos; ``` > **warning** If a table's RLS is off, every client with the Anon Key receives all of its changes. Turn RLS on and write policies before enabling Realtime. ## Private channels {#private-channels} A public channel is open to every client with the Anon Key. A channel joined with `private: true` opens only if the policies on the `realtime.messages` table allow it: ```js const room = client.channel('room-' + userId, { config: { private: true } }) ``` | Action | Policy needed on `realtime.messages` | |---|---| | Joining and receiving broadcasts | `SELECT` | | Sending broadcasts | `INSERT` with `extension = 'broadcast'` | | Tracking presence | `INSERT` with `extension = 'presence'` | | Seeing others' presence | `SELECT` | In a policy, `realtime.topic()` is the name of the channel being checked: ```sql create policy "own room read" on realtime.messages for select to authenticated using (realtime.topic() = 'room-' || auth.uid()::text); create policy "own room write" on realtime.messages for insert to authenticated with check (realtime.topic() = 'room-' || auth.uid()::text and extension = 'broadcast'); ``` **New policy** on the Realtime page offers these templates: a personal channel per user, all signed-in users read, all signed-in users send, and channels with a prefix (such as `room:`). Until you write a policy, only the Service Key can join private channels. When the user's token changes, the client library sends the new token to the channels; an expired token closes the channel. ## Inspector {#inspector} With the **Inspector** at the bottom of the Realtime page, join a channel and watch Broadcast, Presence, Postgres Changes and system messages live. It connects with an API key of this Project (Anon or Service Key) and is handy for testing policies. ## Limits and usage {#limits} The top of the Realtime page shows the Plan's limits (concurrent connections, messages per second, channels per connection, maximum payload size) and this month's usage (messages and peak concurrent connections). A connection or message over a limit is refused with a system message. --- title: "Sites: frontend hosting" description: "Sites in Arianet BaaS - publish your frontend's build output (React, Vue, Angular or plain HTML) at a ready HTTPS address .site.arianet.app next to the same Project's backend; deploy from the panel or the CLI, SPA fallback, clean URLs, headers and redirects, rollback, custom domains and limits." url: https://docs.ariaservice.net/en/baas/sites markdown: https://docs.ariaservice.net/en/baas/sites.md language: en --- # Sites: frontend hosting **Sites** («Sites») publishes your frontend's build output (a folder such as `dist`, `build` or `out`) at a ready HTTPS address, next to the same Project's backend. The Project's Database, Auth and Storage keep working as they are, and the frontend talks to the Project's endpoint (`https://.baas.arianet.app`). - Every Site has its own address: **`https://.site.arianet.app`**, with an automatic SSL certificate. - Every deploy creates a **new, immutable version**. One version is **live**, and one click brings back an earlier one. - Deploy three ways: drop the folder in the panel, run `arianet baas sites deploy`, or automatically on every push with [Git and Deploy](https://docs.ariaservice.net/en/baas/git). - For static files and single-page apps (SPAs). Server-side rendering (SSR) is not supported yet; put server code in [Edge Functions](https://docs.ariaservice.net/en/baas/functions). ## The Sites page {#sites-page} Open **Sites** in the Project's menu. The top of the page shows the Sites' use against the Plan: **number of Sites** («تعداد Site»), **Sites storage** («فضای Siteها», every kept version together) and **egress this month** («Egress این ماه», the Sites' outbound traffic), plus the limit of one deploy (files and size). Each Site shows its address, when its live deploy was published and its file count and size. **Manage and deploy** («مدیریت و Deploy») opens that Site's page. ## Create a Site {#create} **New Site** («Site جدید», or **Create your first Site**) is a step-by-step wizard: 1. **What is a Site?** A short explanation and the address the Site will be published at. 2. **Site name:** the name is part of the address (`.site.arianet.app`) and can be changed later. - 3 to 40 characters: lowercase letters (`a-z`), digits and dashes (`-`); starting and ending with a letter or digit. - Two dashes in a row (`--`) are reserved (for [preview](https://docs.ariaservice.net/en/baas/git#previews) addresses). - Some common names (such as `www`, `api`, `admin`) are reserved. - The name is unique in the whole Region; if it is taken, pick another. 3. **Path behaviour:** [SPA fallback and Clean URLs](#routing). The defaults suit most React, Vue and Angular apps. 4. **Review:** check the name, address and settings and press **Create Site** («ساخت Site»). The Site is created empty and shows nothing until its first deploy. A Site's storage and egress count against the Plan. ## Deploy from the panel {#deploy-panel} On a Site's page, the **Deploy** card: 1. Drag the build output folder onto the card or press **Choose folder** («انتخاب پوشه»). **The folder's contents become the Site's root**: choose the folder that holds `index.html` itself (not its parent). The panel warns when there is no `index.html` at the root. 2. The file count and size are shown. A folder over the limit of one deploy is refused before the upload. 3. Leave **Publish right after the deploy (Live)** on to put the new version on the Site's address at once; with it off, the version is made ready but not published. 4. The steps are shown with progress: **Preparing the deploy**, **Packing files**, **Uploading**, **Checking files** and **Final check and publish**. **Cancel** stops it before the end. Files are packed in the browser and uploaded straight to the Project's storage. Only regular files and folders are accepted; a link (symlink) or a forbidden path refuses the whole deploy and nothing is left half done. If the browser cannot read a dropped folder, use "Choose folder" or the CLI. ## Deploy with the CLI {#deploy-cli} ```bash npm run build && arianet baas sites deploy ./dist --site shop arianet baas sites deploy 12 ./out --site docs --create # create the Site first if it is missing arianet baas sites deploy ./dist --site shop --no-promote # ready, not live ``` - `deploy` packs and uploads the folder's files and publishes the new version. It checks the file count and size against the Plan before uploading. - Paths listed in a `.arianetignore` file (at the folder's root; one pattern a line, `#` for comments, `dir/` for folders) are left out; `.git` and `.DS_Store` are never sent. - Symbolic links are skipped with a warning. - For CI, create an [API token](../authentication.md) with the `baas:sites:manage` scope. Every command and flag is in the [`arianet baas sites` reference](../cli-reference/baas.md#arianet-baas-sites). ## Deploys and rollback {#rollback} The **Deploys** card lists every version, newest first, with its state (**Published**, **Ready**, **Uploading** or **Failed**), source (panel, CLI or Git), file count, size and time. - **Publish** («انتشار»): publishes a ready version. - **Roll back to the previous version** / **Roll back to this version** («برگشت»): an earlier version is published again at once. Nothing is uploaded or built again. - **Delete deploy** («حذف Deploy»): deletes the version and its files. The live version cannot be deleted; publish another one first. - The **10 newest versions** besides the live one (and those a preview serves) are kept; older ones are removed automatically with a new deploy. From the terminal: `arianet baas sites rollback --site shop` (the version before the live one) or `arianet baas sites rollback 12 41 --site shop` (a given version). ## Path behaviour {#routing} | Setting | Effect | When | |---|---|---| | **SPA fallback** | A path without a file (such as `/dashboard/settings`) is answered with `index.html`, so the app's router opens it. | Keep it on for React, Vue, Angular and any single-page app. | | **Clean URLs** | `/about` serves `about.html`, and `/about.html` redirects to `/about`. | For multi-page sites with one HTML file per page (static exports of Next.js, Astro, …). | Other rules: - A path ending in `/` serves that folder's `index.html`; a folder without the `/` redirects to the one with it. - When no file matches and SPA fallback is off, `404.html` (if the deploy has one) is served with status `404`. - Folder listings are never shown. Only `GET` and `HEAD` are answered. ## Headers and redirects {#headers-redirects} The **Site settings** («تنظیمات Site») card holds the name, path behaviour, **Headers** and **Redirects**; changes apply **without a new deploy**. - **Header:** a path (exact, or a prefix ending in `*` such as `/assets/*`), a name and a value. For example `Cache-Control: public, max-age=31536000` for `/assets/*`. Up to 50 rules. The service's own security and base headers cannot be changed. - **Redirect:** a source (a path or a prefix with `*`, such as `/blog/*`), a target (a path from `/` or a full `http(s)` address) and status `301`, `302`, `307` or `308`. Up to 100 rules; the first match wins. From the terminal: ```bash arianet baas sites update 12 shop --spa-fallback --header '/assets/* Cache-Control: public, max-age=600' arianet baas sites update 12 shop --redirect '/old /new 301' ``` ### Caching and compression {#caching} A Site gets sensible caching without any setting: HTML files with `no-cache` (always fresh), files whose names carry a hash (such as `index-BxT2kLp9.js` from build tools) for a year as immutable, and everything else revalidated on each request. Answers carry an `ETag`, and text files are sent gzip-compressed. ## Rename and delete a Site {#rename-delete} - **Rename:** the Site's address moves from the old name to the new one at once and **the old address stops answering**. Update your app's links and settings. Custom domains stay attached to the Site, but their CNAME must point at the new address. - **Delete Site:** the Site, every deploy, its files and its custom domains are deleted for good. Type the Site's name to confirm. The Project's Database and backend are untouched. ## A custom domain for a Site {#custom-domain} The **Custom Domains** card on a Site's page publishes that Site on your own domain (such as `www.example.com`): 1. Press **Add domain** («افزودن دامنه») and enter the domain. 2. Create the records the panel shows in the domain's DNS: a **CNAME** to `.site.arianet.app` and a **TXT** that proves ownership. 3. Once the records are correct, an SSL certificate is issued automatically and the domain goes live. Whether custom domains are available depends on the Plan, and the Project's domains and every Site's count together against the Plan's limit ([Project custom domains](https://docs.ariaservice.net/en/baas/platform#custom-domains)). Removing a domain leaves the Site's own address unchanged; delete the DNS records yourself. ## Sites and Auth {#auth} Every Site's address and every active custom domain of it are **automatically** allowed redirect targets of the same Project's [Auth](https://docs.ariaservice.net/en/cli-reference/auth#urls): email links and provider sign-ins can return to the Site without you listing the address. Renaming or deleting a Site moves or removes it too. The list you wrote yourself is not changed. In the frontend code, take the Project's endpoint and anon key from [API Keys and Connect](https://docs.ariaservice.net/en/baas/api-keys) (or `arianet baas env`). **Never put the Service Key in frontend code** ([Security](https://docs.ariaservice.net/en/baas/security#service-key)). ## Project state and Sites {#project-state} - A Site needs no database to answer: a Project that was [paused for idleness](https://docs.ariaservice.net/en/baas/faq#idle-pause) still serves its Sites. Site visits are not "requests" and do not keep the Project awake. - When you pause a Project yourself, its Sites stop answering too (`503`). The same holds for a suspended Project (`403`). - Site visits do not appear in the API request [Logs](https://docs.ariaservice.net/en/baas/logs). ## Limits {#limits} The Plan sets the number of Sites per Project, the size and file count of one deploy, the Sites storage (every kept version) and the monthly Sites egress. - Your Plan's exact figures are always shown at the top of the Sites page. The number of Sites and the size and file count of one deploy are hard limits. - Whether storage and egress are hard too depends on the Plan. When they are, a new deploy is refused once storage is full (`site_storage_limit`; delete old deploys), and once the month's egress is used up the Sites answer `402` until the month ends. - The number of Sites across the account also has an [account quota](https://docs.ariaservice.net/en/baas/quotas). ## Common errors {#errors} | Code | Meaning and fix | |---|---| | `site_name_taken` | The name is taken in the Region; pick another. | | `invalid_site_name` | The name breaks the rule (3-40 characters of `a-z`, digits and `-`). | | `site_limit` | The Plan's number of Sites is reached; delete a Site or upgrade the Plan. | | `too_many_files` / `deployment_too_large` | The files exceed the limit of one deploy; leave out extras (source maps, large media) or keep media in [Storage](https://docs.ariaservice.net/en/baas/storage). | | `site_storage_limit` | The Project's Sites storage is full; delete old deploys or upgrade the Plan. | | `unsafe_entry` / `unsafe_path` / `duplicate_path` | The folder holds a link, an unusual file or a forbidden path name. | | `empty_archive` / `invalid_archive` | The folder is empty or the package arrived broken; try again. | | `deployment_expired` | The one-hour upload window ended; deploy again. | | `too_many_uploads` | Several deploys of this Site are waiting for their upload; try again shortly. | | `deployment_live` | The live version cannot be deleted; publish another one first. | | `quota_exceeded` | The [account quota](https://docs.ariaservice.net/en/baas/quotas) of Sites is full; request an increase. | ## Permissions Seeing Sites needs `baas:view`; every change (create, deploy, publish, settings, delete) needs `baas:sites:manage`, and adding a custom domain also needs `baas:projects:manage` ([Members](https://docs.ariaservice.net/en/baas/platform#members)). Every change is recorded in the account's activity log. --- title: "Git and Deploy" description: "Git and Deploy in Arianet BaaS - one-click connect of a GitHub or GitLab repository (or a self-managed GitLab with a token), the repository layout (arianet/migrations, arianet/functions, arianet/config.toml and package.json), automatic production deploys on every push, a preview per branch and merge request, promote, redeploy and cancel, build settings and variables, commit statuses and troubleshooting by error code." url: https://docs.ariaservice.net/en/baas/git markdown: https://docs.ariaservice.net/en/baas/git.md language: en --- # Git and Deploy With **Git and Deploy** («Git و Deploy») you connect a **GitHub** or **GitLab** repository to the Project, and the repository becomes the source of the whole app: the frontend, the database migrations, the Edge Functions and the settings. - Every **push to the production branch** builds and publishes the Site and applies the migrations, functions and `config.toml` to the Project. - Every **other branch and every pull/merge request** gets a **preview** at its own address; production is not touched. - Each deploy's status shows next to the commit on GitHub or GitLab, and one click **promotes** a preview to production. Open **Git و Deploy** in the Project's menu. With no repository connected you see the **Connect repository** («اتصال Repository») button and the suggested repository layout. > **Without git too** The same works without git: deploy the Site with [Sites](https://docs.ariaservice.net/en/baas/sites) and the backend with [`arianet baas push`](#push) from the terminal. ## Sample project: arianet-baas-starter {#starter} The fastest way to start is [**arianet-baas-starter**](https://github.com/ariaservice/arianet-baas-starter): a small but complete Persian "Notes" app (RTL, Vazirmatn font, light and dark) built with Vite and TypeScript, ready to deploy with Git, that shows every part of Arianet BaaS working together: | Feature | In the sample | |---|---| | [Auth](https://docs.ariaservice.net/en/baas/auth-api) | sign-up and sign-in with email and password, and guest (anonymous) sign-in without any email or SMS when `anonymous_enabled` is on | | [Database and RLS](https://docs.ariaservice.net/en/baas/security) | a notes table with owner-only policies in `arianet/migrations` | | [Storage](https://docs.ariaservice.net/en/baas/storage-api) | the private `note-images` bucket in `config.toml`, per-user folder policies, images shown through signed URLs | | [Realtime](https://docs.ariaservice.net/en/baas/realtime) | changes in one tab or device appear in the others at once, still filtered by RLS | | [Edge Functions](https://docs.ariaservice.net/en/baas/functions) | the `note-stats` function (text statistics) with `verify_jwt` and shared code in `_shared` | To build your own app from it: 1. On GitHub, open [arianet-baas-starter](https://github.com/ariaservice/arianet-baas-starter), click **Use this template** and create your repository (it can be private). 2. In the panel, open the Project, go to **Git و Deploy**, click **Connect with GitHub** («اتصال با GitHub») and pick the new repository ([connect steps](#connect)). 3. In the **Settings** step Vite is detected (`npm run build`, output `dist`); name the Site and confirm. The first deploy starts by itself: the migrations, the bucket, the function and the Site are applied, and `ARIANET_BAAS_URL` and `ARIANET_BAAS_ANON_KEY` are set during the build. Local development and every file are explained in the sample's README. Live demo: [arianet-notes-demo.site.arianet.app](https://arianet-notes-demo.site.arianet.app). ## One-click connect with GitHub or GitLab {#connect} > **New to this?** If you do not know what GitHub or a repository is, [Start with no tech background](https://docs.ariaservice.net/en/baas/github-for-beginners) walks through every step from creating an account to the first deploy. To work with an AI assistant: [Build with AI](https://docs.ariaservice.net/en/baas/build-with-ai). **Connect repository** is a wizard that needs no token: 1. **Git host** («میزبان Git»): choose **GitHub** or **GitLab** (gitlab.com) ("no token; only approve access"). For GitLab on your own server choose [Self-managed GitLab](#self-managed). 2. **Arianet's access** («دسترسی آریانت»): before going to GitHub or GitLab, read what Arianet can and can never do ([below](#access)) and press **Continue to GitHub** or **Continue to GitLab**. 3. Approve access on GitHub or GitLab: - **GitHub:** install Arianet's app on your account or organization, choosing **only the repositories you want** (`Only select repositories`), then authorize. - **GitLab:** `Authorize` the Arianet application. 4. You come back to the panel. **Choose repository** («انتخاب Repository»): repositories are listed with their name, whether they are private, default branch and last update; use **Search repository…** to find one. On GitHub, if a repository is missing, press **Configure Arianet's access on GitHub** («دسترسی Arianet را در GitHub تنظیم کنید») and add it to the installation. 5. **Settings** («تنظیمات»): the panel reads the repository and proposes the settings: app type, package manager, build command, output folder and Site name (from the repository's name). Pick the **production branch** («Branch اصلی (Production)») and change the [build settings](#build-settings) if needed. 6. **Connect and deploy** («اتصال و Deploy»): the connection is saved, a webhook is registered on the repository and the first deploy starts; the panel takes you to its live log. The first deploy applies the repository's migrations, `config.toml` and functions to this Project. Migrations already applied (from the CLI or the console) are not run again. To connect you need enough rights on the repository: **Admin** or **Maintain** on GitHub, **Maintainer** or higher on GitLab. An account you linked once is used again without the trip to GitHub or GitLab ("connected with GitHub as @…"); press **Another account** («حساب دیگر») for a different one. ### What Arianet can access {#access} | Arianet can | Arianet can never | |---|---| | Read the code of **only the repositories** you choose. | Change your code or push anything. | | Add a **webhook** so a push starts a deploy. | See your other repositories (on GitHub only the ones you choose; on GitLab only the projects you choose and connect are used). | | Show the deploy's result next to your commits (commit status). | Access your password. | - The permissions of Arianet's GitHub app on a repository: read contents (`Contents: read`) and `Metadata`, and write only `Commit statuses` and `Webhooks`. It has no access to your account settings. - The tokens obtained from GitHub or GitLab are stored encrypted, never shown or written to a log, and never available to the build (your code). - A linked account belongs to the member who linked it; other members of the Arianet account cannot browse or connect repositories with it. ### Revoking access {#revoke} - **In the panel:** the **Linked accounts** («حساب‌های متصل») card on the Git and Deploy page lists the identities you linked. **Disconnect** («قطع اتصال») ends Arianet's access to that account's repositories. If the account is still used by a Project, [disconnect](#disconnect) that Project's repository first. - **On GitHub:** in your account (or organization) settings, `Applications` → `Installed GitHub Apps`, `Configure` Arianet's app (`ariaservice`) to take repositories away, or `Uninstall` it; you can also `Revoke` it under `Authorized GitHub Apps`. - **On GitLab:** in `Preferences` → `Applications` → `Authorized applications`, press `Revoke` for **Arianet**. Once access is revoked, the connection shows "needs reconnecting" in the panel and deploys fail with `git_reauth_required`. Press **Reconnect to GitHub** (or GitLab) to make the same connection active again. ## Self-managed GitLab and token connections {#self-managed} For GitLab on your own server, choose **Self-managed GitLab** («GitLab سازمانی / شخصی (Self-managed)») in the first step: 1. Enter **your GitLab address** with `https` and without `/api/v4` (such as `https://gitlab.example.com`). The server must be reachable from the internet. 2. **Create a token on your GitLab** opens the personal access token page with the name `Arianet` and the `api` scope filled in. Press `Create`, set an expiry date and paste the token in the panel. 3. Paste the repository path (such as `group/subgroup/my-app`) or its full address, and enter the production branch. For **GitHub Enterprise**, or if you prefer a token, press **Connect with a token (advanced)** («اتصال با Token (پیشرفته)») in the first step. The token must be for this repository only: | Host | Token | Permissions | |---|---|---| | GitHub / GitHub Enterprise | Fine-grained personal access token, with `Only select repositories` and only this repository | `Contents: Read-only`, `Webhooks: Read and write`, `Commit statuses: Read and write` (`Metadata: Read-only` is implied) | | GitLab | Project access token (`Settings → Access tokens`) | `Role: Maintainer` (registering the webhook needs it), scopes `api` and `read_repository` | For GitHub Enterprise enter the server's API address (usually ending in `/api/v3`). The token is stored encrypted and only its last four characters are shown. Before it expires, save a new one with **Change connection** («تغییر اتصال»); with an expired token deploys fail with `fetch_failed` or `repository_token_refused`. If the repository belongs to an organization, its owner may have to approve the token. ## Repository layout {#layout} ```text / package.json # the Site (optional): built with npm run build arianet/ config.toml # Auth, buckets, Cron and function settings migrations/0001_init.sql # in name order, in one transaction functions/hello/index.ts # one directory per function functions/_shared/ # code shared by every function ``` Every part is optional: a repository with only `arianet/migrations` applies only migrations, and one with only a frontend only publishes the Site. The paths can be changed in the [connection settings](#build-settings). The backend is read straight from the repository at the exact commit and needs no build (at most 2,000 files and 64 MB a deploy). ### Migrations: `arianet/migrations` {#migrations} - The `.sql` files right in this directory (not in subdirectories), **in name order**. Start the names with a number or a timestamp: `0001_init.sql`, `20261129093000_orders.sql`. - All files not applied yet run together in **one transaction**: all of them or none. Do not put `BEGIN` or `COMMIT` in them. - The history is the same as [`arianet baas db push`](https://docs.ariaservice.net/en/cli#migrations) and the console's: a file applied before is not run again. - **Do not change an applied file.** If the text of a file that already ran changes, the deploy is refused with `migration_changed`; put the change in a new migration file. - At most 200 files and 2 MB of SQL. ### Functions: `arianet/functions` {#functions} - Every subdirectory is an [Edge Function](https://docs.ariaservice.net/en/baas/functions), and the directory's name is the function's: `arianet/functions/hello/index.ts`. - Entry file: `index.ts` (or `index.js`, `index.mjs`, `index.tsx`, `index.jsx`, `main.ts`, `main.js`), or the one named in `[functions.] entrypoint`. - Put shared code in `arianet/functions/_shared/` and import it as `../_shared/x.ts`; it goes into every function's bundle. - A function whose code did not change is not redeployed. Functions the repository does not hold are left as they are (not deleted). ### Settings: `arianet/config.toml` {#config-toml} ```toml [auth] site_url = "https://shop.example.com" redirect_urls = ["https://shop.example.com/*"] email_enabled = true phone_enabled = false anonymous_enabled = false disable_signup = false [auth.providers.google] # secrets never go in the repository: set them in the panel enabled = true client_id = "1234.apps.example" [storage.buckets.avatars] public = true file_size_limit = 5242880 allowed_mime_types = ["image/png", "image/jpeg"] [cron.cleanup] schedule = "0 3 * * *" sql = """ delete from events where at < now() - interval '30 days'; """ [cron.ping] schedule = "*/15 * * * *" enabled = true http = { url = "https://shop.example.com/api/ping", method = "POST" } [functions.hello] verify_jwt = false entrypoint = "index.ts" ``` | Section | Keys | |---|---| | `[auth]` | `site_url`, `redirect_urls`, `email_enabled`, `phone_enabled`, `anonymous_enabled`, `disable_signup` ([Auth](https://docs.ariaservice.net/en/cli-reference/auth#settings)) | | `[auth.providers.]` | `enabled`, `client_id` ([Providers](https://docs.ariaservice.net/en/cli-reference/auth#providers)) | | `[storage.buckets.]` | `public`, `file_size_limit` (bytes), `allowed_mime_types` ([Storage](https://docs.ariaservice.net/en/baas/storage#create-bucket)) | | `[cron.]` | `schedule`, `enabled`, and `sql = "…"` or `http = {url, method, headers, body, timeout_ms}` ([Cron](https://docs.ariaservice.net/en/baas/integrations#cron)) | | `[functions.]` | `verify_jwt`, `entrypoint` ([verify_jwt](https://docs.ariaservice.net/en/baas/functions#verify-jwt)) | - Every deploy compares the named values with the Project and applies **only the differences**; the deploy's page lists the changes (create, update, unchanged). - **Anything the file does not name is not changed or deleted.** A bucket, Cron job or provider taken out of the file stays in the Project; delete it in the panel. - An unknown key is refused with its line number (`invalid_config`). Never write secrets (such as a provider's secret) in the file; set them in the panel or with the CLI. ### The Site: `package.json` {#site} When the connection has a Site, the frontend is built in the app directory and published to the [Site](https://docs.ariaservice.net/en/baas/sites): - **Install:** the package manager comes from the lock file (`pnpm-lock.yaml` → pnpm, `yarn.lock` → yarn, else npm; with a lock file, `npm ci`). - **Build:** ` run build` when `package.json` has a `build` script. - **Output:** the first existing folder of `dist`, `build`, `out` and `public`, or the one you set. - A repository with no `package.json` but with `index.html` or `public/` is published as a static Site without a build. - App types detected automatically: Next.js (static export, `out`), Nuxt (`generate`, `.output/public`), Astro, Vite, Create React App and plain HTML. Server-side rendering (SSR) is not supported yet; build a static output. ## Production and the production branch {#production} The **production branch** is the branch whose pushes update production; leave it empty for the repository's default branch. A production deploy runs these steps in order, and **the first step that fails ends the deploy, with the Project keeping what it had**: | Step | What it does | |---|---| | **Reading the repository** | `config.toml`, migrations and functions are read at the commit. | | **Check** | Every function's bundle is built, the migrations are compared with the history (nothing runs) and the settings' differences are computed. | | **Build** | The frontend is built and uploaded, but not published yet. | | **Migrations** | The new migrations run in one transaction. | | **Settings (config.toml)** | The differences are applied. | | **Functions** | Changed functions are deployed. If this step or the next fails, the functions this deploy changed go back to their previous version. | | **Publishing the Site** | The new Site version is published **last**, in one switch. | - A commit that is queued, running or deployed on its branch already is not queued again. A newer commit of a branch **supersedes** the older queued deploys. - With an **app directory (root directory)** set, a push that changes nothing under it deploys nothing (handy in a monorepo). - A Project paused for idleness wakes up for a deploy. A Project you paused yourself takes no deploys (`project_not_active`). - **Deploy now** («Deploy الان») deploys a branch's latest commit without a new push: the production branch as production, any other branch as a preview. ## Previews {#previews} Every push to another branch, and every pull request (GitHub) or merge request (GitLab) opened, reopened or updated, gets a **preview**: - Address: **`https://--.site.arianet.app`**; for example branch `feature/checkout` of Site `shop` is `https://feature-checkout--shop.site.arianet.app`. The branch name is lowercased and every other character becomes a `-`; very long branches are shortened and end in a short hash. - A preview is only **built and checked**: migrations, settings and functions are **not** applied to the Project, and production does not change. A preview talks to the same backend (Database and Auth) of the Project, so it works on real data. - Previews are served with the Site's rules (SPA fallback, headers, redirects) and `X-Robots-Tag: noindex` (kept out of search engines), and are automatically allowed Auth redirect targets. - Deleting the branch or closing (or merging) the request removes its preview. The **Previews** card lists every preview with its address and last update, and **Delete** removes one by hand; the next push to that branch builds it again. - The number of previews per Site has a Plan limit; at the limit, the least recently updated preview goes first. - Pull requests from forks (other people's repositories) are **never built**; unknown code never runs on your Project. - Previews can be turned off in the connection settings. ## Promote, redeploy and cancel {#promote} In the **Deploys** list (filtered by kind, state and branch) and on each deploy's page: - **Promote to production:** makes a production deploy from a ready preview's commit and **reuses its build** (no new build). That commit's migrations, `config.toml` and functions are applied to the Project and the main Site is published with that version. - **Redeploy:** a new deploy of the same commit; the build runs again and uses build minutes. - **Cancel:** a queued deploy is canceled at once, a running one stops at its next step and its build is removed. The Project keeps what it had before the deploy; nothing is left half done. To roll back only the frontend, use [Roll back to the previous version](https://docs.ariaservice.net/en/baas/sites#rollback) on the Site's page. Migrations do not roll back; write a new migration to undo a database change. ## The deploy page and log {#deployment-page} **Details and log** («جزئیات و Log») of a deploy shows: - The commit (message, author and a link to it), branch, **source** (push, pull/merge request, manual, redeploy or promote), creation time, duration and **build time**. - **State:** queued, building, deploying, ready, failed, canceled or superseded; while running, the current step. - **Steps:** what was read (number of migrations and functions, whether there is a config.toml), the migrations that ran, the settings changed and the functions deployed. - The **live log** of install and build; tokens are replaced with `[redacted]`. - For a failed deploy, the reason in Persian with the service's error text below it ([errors](#errors)). The 200 newest deploys of a Project are kept. ## Commit status {#commit-status} Every deploy sets a status named `arianet/baas` on its commit: `pending` when it starts and `success` or `failure` when it ends, linked to the deploy's page in the panel. Pull/merge requests show the same status, so you can require it before merging on GitHub or GitLab. ## Build settings and variables {#build-settings} **Connection settings** («تنظیمات اتصال», or **Change connection** for a token connection) holds: | Setting | Notes | |---|---| | **Production branch** | Empty: the repository's default branch | | **App directory (root directory)** | In a monorepo, this app's folder; every other path is relative to it. Empty: the repository's root | | **Previews** | On or off | | **Build the frontend and publish it to a Site** | Off: only the backend (migrations, functions and config.toml) is applied | | **Site name** | The Site the build is published to; created with SPA fallback on when missing | | **Package manager** | Automatic (from the lock file), npm, pnpm or yarn | | **Install command** / **Build command** / **Output folder** | Empty: detected automatically | | **Build environment variables** | Name and value, such as `VITE_API_URL` | | **Backend paths in the repository** | Migrations (`arianet/migrations`), functions (`arianet/functions`), the config file (`arianet/config.toml`) | - **Build environment:** Node.js 22 with npm, pnpm 9 and yarn 1. Each build runs isolated, with no access to the repository token or the Project's keys. - **Build variables are not secret** and are shown in the console; never put passwords, the Service Key or server keys there. Whatever the build sees is published in the frontend code. - `ARIANET_BAAS_URL` and `ARIANET_BAAS_ANON_KEY` (this Project's endpoint and anon key) and `CI=1` are set automatically. A framework that only passes prefixed variables to browser code (such as `VITE_` or `NEXT_PUBLIC_`) does not see these two; add build variables such as `VITE_BAAS_URL` and `VITE_BAAS_ANON_KEY` with the values from [API Keys and Connect](https://docs.ariaservice.net/en/baas/api-keys) (the anon key is made for browser code). - Setting changes apply from the next deploy. ## Build limits {#limits} The **Builds this month** («Build در این ماه») card shows the minutes used and the Plan's limits. Build time counts from the start to the end of each build. The Plan sets the build minutes a month, concurrent builds per Project, the time limit of one build, the build resources (CPU and RAM) and the previews per Site; your plan's values are shown on this card. - If the minutes limit is hard (depending on the Plan), once the month's minutes are used up builds do not run until the next month (`build_minutes_exhausted`). Deploys without a Site (backend only) use no build minutes. ## Disconnect the repository {#disconnect} **Disconnect** («جدا کردن», type the repository path to confirm): the webhook is removed from the repository, queued deploys are canceled, every preview is removed and later pushes no longer deploy. The published Site, the Database, the functions and the deploy history stay, and you can connect again later. If the webhook cannot be removed, the panel tells you to delete it in the repository's settings yourself. **Change repository** (one-click) or changing the host and repository (token connection) removes the old webhook and registers one on the new repository. ## Permissions {#permissions} - Seeing the Git and Deploy page needs `baas:view`; connecting, changing, disconnecting, deploy, redeploy, cancel, promote and deleting previews need `baas:git:manage` ([Members](https://docs.ariaservice.net/en/baas/platform#members)). - **Each deploy runs with the permissions of the member who last saved the connection**, and only those a deploy needs (Site, functions, Auth settings, SQL and Cron, buckets). The Git page lists them. If that member lacks one a step needs, the step fails with `forbidden`: git never gives anyone more than they had. Save the connection again as a member with enough rights. - Every connect, change, deploy, promote and disconnect is recorded in the account's activity log (never a token). ## From the terminal {#cli} ```bash arianet baas git connect --provider github --repo acme/shop --token-file token.txt --site shop arianet baas git status # repository, webhook and this month's build minutes arianet baas git deployments arianet baas git deploy --branch feature/checkout --follow arianet baas git logs --follow arianet baas git promote arianet baas git redeploy arianet baas git cancel arianet baas git previews # and previews rm arianet baas git update --production-branch main --build-command "pnpm build" arianet baas git disconnect ``` One-click connect is done in the panel only; `git connect` in the CLI uses a token. Every flag: [the `arianet baas git` reference](../cli-reference/baas.md#arianet-baas-git). ### `arianet baas push`: the same deploy without git {#push} ```bash arianet baas push --dry-run # what would change arianet baas push arianet baas push 12 --dir apps/shop --skip-functions ``` Applies a directory's backend in the order a git deploy does: the migrations not applied yet (in one transaction), the differences of `config.toml`, and the functions. Everything is checked before anything changes. The Site is not part of `push`; publish it with `arianet baas sites deploy`. Unlike a git deploy, a failure part way does not undo the steps before it (migrations are still one transaction). [The `arianet baas push` reference](../cli-reference/baas.md#arianet-baas-push) ## Errors {#errors} ### Errors of a deploy {#deploy-errors} | Code | Meaning and fix | |---|---| | `invalid_repository` | The repository's layout is not valid: over 2,000 files or 64 MB in the backend paths, or wrong paths. | | `invalid_config` | `config.toml` has an error (unknown key or bad value); the line number is in the error text. | | `invalid_function` | A function's bundle could not be built; check the entry file and the imports. | | `migration_changed` | The text of a migration that already ran has changed; restore the file and put the change in a new one. | | `migration_failed` | Running the migrations failed and **none was applied**; the SQL error is in the log. | | `forbidden` | The member who saved the connection lacks this step's permission; save the connection again with enough rights. | | `project_not_active` | The Project was paused by its owner; resume it in [Settings](https://docs.ariaservice.net/en/baas/settings#pause) first. | | `build_failed` | Install or build failed; see the log. Try `npm ci && npm run build` on your own machine once. | | `build_timeout` | The build ran past the Plan's time limit. | | `build_out_of_memory` | The build ran out of memory; make it lighter or take a bigger Plan. | | `build_minutes_exhausted` | This month's build minutes are used up; wait for next month or upgrade the Plan. | | `builds_unavailable` | Builds do not run in this Region yet; a connection without a Site (backend only) works. | | `fetch_failed` | Fetching the code from the repository failed; check the token and its access. | | `git_reauth_required` | Arianet's access on GitHub or GitLab expired or was revoked; [reconnect](#revoke). | | `upload_failed` / `build_lost` | Uploading the build output failed or the build was lost midway; deploy again. | | `bucket_refused` | One of the buckets in `config.toml` was refused (for example, over the Plan's limit). | | `storage_unavailable` | Storage did not answer; deploy again shortly. | | `disconnected` / `canceled` | The repository was disconnected midway / the deploy was canceled. | | `deployment_failed` | Another failure; see the log. | In every case the Project keeps what it had before the deploy. ### Errors when connecting {#connect-errors} | Code | Meaning and fix | |---|---| | `repository_permission` | You need the Admin or Maintain role (GitHub) or Maintainer (GitLab) on the repository, and on GitHub Arianet's app must be installed on it. | | `repository_unreachable` | The repository was not found; check its path and the token's access to it. | | `repository_token_refused` | The token is wrong, expired or revoked. | | `repository_token_permission` | The token lacks permissions; give it [the ones needed](#self-managed). | | `branch_not_found` / `path_not_found` | The branch or the app directory is not in the repository. | | `git_host_unavailable` | The git host does not answer; try again shortly. | | `git_host_not_allowed` | Connecting to this git host is not allowed (for example, the server is not reachable from the internet). | | `git_connected` | A repository is already connected to this Project; use "Change repository". | | `oauth_state_invalid` / `oauth_denied` / `oauth_exchange_failed` | The connection expired, access was not approved on GitHub or GitLab, or the approval did not complete; start again. | | `git_account_in_use` | This linked account is still used by a Project; disconnect that Project's repository first. | | `git_oauth_unavailable` | One-click connect is not on in this Region; connect with a token. | | `deployment_running` / `deployment_finished` / `not_a_preview` | A deploy of this commit is running; a finished deploy cannot be canceled; only a ready preview can be promoted. | - **Webhook not registered:** if the Git page says "Webhook not registered", pushes do not deploy by themselves. Check the token's webhook permission and save the connection again; until then **Deploy now** works. - **The return page says "this connection has expired":** the browser does not remember the connection (another tab, or after closing the browser). Start the connection again from the Git and Deploy page. In a private browser window where temporary storage is blocked, one-click connect does not work. ## Not supported yet {#not-yet} One-click connect for GitHub Enterprise and self-managed GitLab (connect with a token); a cache between builds; build environments other than Node.js; several Sites in one connection; reviewing and approving `config.toml` changes before they apply; automatically deleting a function, bucket or Cron job taken out of the repository; server-side rendering (SSR). --- title: "Backup and restore" description: "Backups in Arianet BaaS - automatic daily backups and manual backups, downloading a backup file, a safe restore with a safety backup, and point-in-time recovery (PITR) depending on the Plan." url: https://docs.ariaservice.net/en/baas/backups markdown: https://docs.ariaservice.net/en/baas/backups.md language: en --- # Backup and restore The **Backups** page (Database menu) keeps backups of each Project's database and rolls the Project back to an earlier backup. ## Backup policy {#policy} The **Backup policy** card at the top shows what your Plan includes: - **Retention:** how many days each backup is kept before it is deleted automatically. - **Daily backup time (UTC):** the hour the automatic backup is taken every day. - **Concurrent manual backups:** how many manual backups you can keep at once. - **Point-in-time recovery (PITR):** whether your Plan has it. All of these values come from the Plan. ## Manual backup {#manual} **New backup** takes a backup right now; do this before risky changes (a large migration, deleting data). Progress is shown on the same page; once ready, the backup appears in the list with type "manual", size, start time and expiry time. ## Download {#download} Every ready backup can be downloaded. The file is a standard Postgres dump (custom format) that `pg_restore` restores on any other Postgres as well: ```bash pg_restore --no-owner --dbname "postgres://…" backup.dump ``` Downloading needs the project management and SQL execution permissions (`baas:projects:manage` and `baas:sql:execute`) and is logged. [Vault](https://docs.ariaservice.net/en/baas/integrations#vault) secret values are in the backup in encrypted form only. ## Restore {#restore} **Restore** is a three-step wizard: 1. **What happens?** Restore returns the whole database to its state at the time of the backup. Data written after that time is lost. Storage files do not change; Auth users and the list of files live in the database, so they return to that time. 2. **Choose the source:** a ready backup, or (if your Plan has PITR) a point in time for point-in-time recovery. 3. **Review and confirm:** type the project's `ref` to confirm. The restore runs in the background in this order; you can close the window and follow its state on the Backups page: 1. **Traffic paused:** the Project's connections are closed and requests are refused for the moment. 2. **Safety backup:** a backup of the current state is taken, so you can go back if you restored by mistake. 3. **Restore** in one transaction: it happens completely or not at all. 4. **Resume:** the Project answers again. If the restore fails, the Project goes back to work and the safety backup stays in the list. ## Point-in-time recovery (PITR) {#pitr} On **Plans with PITR**, besides the daily backups, the database's changes are archived continuously, and you can return the Project to **any moment** of the last few days (per your Plan); for example one minute before a mistaken `DELETE`. Give the time in the "Choose the source" step; the rest works like a normal restore, and the recovered state is also kept in the list as a manual backup. > **Limitation** If a table has `FORCE ROW LEVEL SECURITY`, backups of that Project fail and the tool's error is shown in the backup list. Remove `FORCE` from such tables (normal RLS is enough). --- title: "Direct connections and Database Settings" description: "Direct database connections in Arianet BaaS with psql, ORMs and Postgres tools, and the Database Settings - connection string, password reset, SSL enforcement, network restrictions, statement timeout and size." url: https://docs.ariaservice.net/en/baas/database-settings markdown: https://docs.ariaservice.net/en/baas/database-settings.md language: en --- # Direct connections and Database Settings ## Direct database connections {#direct-connection} Every project has its own Postgres endpoint: ``` .db.baas.arianet.app:5432 ``` Connect `psql`, ORMs, migration tools, GUI clients or any other Postgres tool with the **connection string** from the **Database Settings** page. Connections go through the **pooler in transaction mode**, over **TLS**. ```bash psql "postgres://postgres.:@.db.baas.arianet.app:5432/postgres?sslmode=require" ``` - Copy the connection string from this page. The password is not shown here; take it with **Reveal database password** on [API Keys and connection](https://docs.ariaservice.net/en/baas/api-keys#direct-connection), or make a new one with [Reset password](#password). - The user name is `postgres.`, so tools that do not send the server name (SNI) in TLS still reach the right Project. - This connection has **database owner privileges**, like the SQL Editor; RLS does not restrict it. Never put the password in client-side code or a public repository. - **Transaction mode:** each transaction may run on a different server connection, so session state does not survive between transactions: `SET` outside a transaction, named prepared statements, `LISTEN`/`NOTIFY` and advisory locks held across transactions. In ORMs that create prepared statements, turn on their pooler-compatible option (for example `pgbouncer=true` or `prepareThreshold=0`, depending on the tool). - Concurrent connections are limited by your Plan. - If the Project was paused for inactivity, the first connection wakes it and asks the client to reconnect a few seconds later. **When a connection is refused:** with **SSL enforced** only encrypted connections are accepted, and **network restrictions** admit only the allowed IPs/CIDRs. A refused connection gets a clear error message (for example a connection without SSL, from an address that is not allowed, or to a paused Project) that your tool displays. ## Database Settings {#settings} The **Database Settings** page (Database menu) has these cards: ### Database connection The connection string, host, port, database name and user name for your tools and servers. If the external endpoint is not offered in your Region yet, this card says so. ### Database password {#password} The current password cannot be shown. If you lost it or it leaked, click **Reset password**: a new password is created, shown **only once**, and the old one stops working at once. Type the project's `ref` to confirm. Before you do this, know where the old password is used, because those connections will be cut. Needs the `baas:keys:manage` permission. ### Enforce SSL {#ssl} On by default: connections without SSL are refused. Turning it off accepts unencrypted connections too, and data can be read on the way; turn it off only temporarily, for an old tool without SSL. ### Network restrictions {#network} Accept direct connections only from allowed addresses. **Edit** is a two-step wizard: add CIDRs (use `/32` for a single IPv4 address or `/128` for IPv6), then review and save. Up to 50 IPv4 and IPv6 entries. An empty list means every address is allowed. ![Editing network restrictions](https://docs.ariaservice.net/en/img/panel/baas-db-network-restrictions.jpg) Network restrictions apply to direct database connections only; the REST API, Auth and Storage stay reachable from anywhere, and their access is decided by the keys and policies. ### Limits and size {#limits} The database's current size against the Plan's limit, the **statement timeout** (the longest a statement may run) and the maximum number of concurrent connections. If the database became read-only because it is full, you see a warning here; delete data or upgrade the Plan. Changing SSL enforcement and network restrictions needs the `baas:projects:manage` permission, and every change is recorded in the account's activity. --- title: "Integrations" description: "Integrations in Arianet BaaS - signed Database Webhooks on table changes, Cron for scheduled SQL and HTTP, durable message Queues with SQL functions, and Vault for encrypted secrets." url: https://docs.ariaservice.net/en/baas/integrations markdown: https://docs.ariaservice.net/en/baas/integrations.md language: en --- # Integrations The **Integrations** section has four tools that do background work without a separate server. The **Integrations overview** shows each one with its current count against the Plan's limit. | Tool | What it does | |---|---| | [Database Webhooks](#webhooks) | Sends a signed HTTP request to your service on every change of a table | | [Cron](#cron) | Runs SQL or an HTTP request on a schedule | | [Queues](#queues) | A durable message queue inside the database for background jobs | | [Vault](#vault) | Keeps your keys and passwords encrypted | ## Database Webhooks {#webhooks} A webhook on `INSERT`, `UPDATE` and/or `DELETE` of a table sends one `POST` request to your address for every changed row. **New webhook** is a four-step wizard: name and table, events, destination (URL, custom headers, response timeout and enabled) and review and save. The last step shows the generated SQL and a sample payload. ![Reviewing a new webhook](https://docs.ariaservice.net/en/img/panel/baas-webhook-wizard.jpg) The request body: ```json { "type": "UPDATE", "table": "todos", "schema": "public", "record": { "id": 1, "title": "buy bread", "done": true }, "old_record": { "id": 1, "title": "buy bread", "done": false } } ``` On `INSERT`, `old_record` is empty (`null`); on `DELETE`, `record` is empty. ### Verifying the signature {#webhook-signature} Every webhook has a secret (prefixed `whsec_`) that is shown **only once**, when the webhook is created. Every request carries these headers: | Header | Value | |---|---| | `X-Arianet-Webhook-Id` | The id of this delivery | | `X-Arianet-Webhook-Timestamp` | The send time (Unix seconds) | | `X-Arianet-Webhook-Signature` | `v1=` followed by the hex HMAC-SHA256 of `timestamp + "." + body` with the secret | Example in Node.js: ```js import crypto from 'node:crypto' function verify(req, rawBody, secret) { const ts = req.headers['x-arianet-webhook-timestamp'] const sig = req.headers['x-arianet-webhook-signature'] // "v1=" const expected = 'v1=' + crypto.createHmac('sha256', secret).update(`${ts}.${rawBody}`).digest('hex') const fresh = Math.abs(Date.now() / 1000 - Number(ts)) < 300 return fresh && crypto.timingSafeEqual(Buffer.from(sig), Buffer.from(expected)) } ``` ### Delivery and retries {#webhook-delivery} - A `2xx` answer means delivered. Any other answer or a connection error is retried after 10 seconds, 30 seconds, 2 minutes and 10 minutes (five attempts in all). The latest state of each delivery is shown on the webhook's page for 7 days. - The response timeout is 1 to 10 seconds. A body larger than 1 MB is not sent. - The URL must be `http` or `https` on port 80, 443 or 1024 to 65535. **Nothing is sent to internal or private addresses** (private, loopback, link-local and the like), and redirects are not followed. - An event may arrive twice, so use `X-Arianet-Webhook-Id` to drop duplicates. ## Cron {#cron} A cron job is a recurring task that, on a schedule, either runs **SQL** or sends an **HTTP request** (method, URL, headers, body and timeout). **New cron job** is a four-step wizard: name and type, schedule, what runs, and review and save. ![Scheduling a cron job](https://docs.ariaservice.net/en/img/panel/baas-cron-wizard.jpg) - **Schedule:** a ready pattern (every minute, every hour, every day, …), a five-field cron expression (`min hour day-of-month month day-of-week`, such as `*/5 * * * *` or `0 3 * * mon-fri`), or a simple interval such as `30 seconds`. **All times are UTC**; the wizard shows the Tehran time equivalent and the next five runs. - The Plan sets the number of jobs and the shortest gap between two runs. - **SQL** runs with database owner privileges, in one transaction, under the Plan's statement timeout. - **HTTP** has the same limits as webhooks: nothing is sent to internal addresses. - If the previous run has not finished, the next one does not start. **Run now** runs the job once right away. The run history, with results and errors, is kept for 7 days. ## Queues {#queues} A queue is a durable message queue inside your database, for background jobs such as sending email: messages are backed up with the database and are not lost until they are processed. ![The Queues page](https://docs.ariaservice.net/en/img/panel/baas-queues.jpg) Create queues in the panel; apps work with them through SQL functions. These functions can be executed only by the `service_role` role (the Service Key, server side): ```sql -- send a message (delay in seconds) select pgmq_public.send('jobs', '{"task": "send_email", "to": "user@example.com"}'::jsonb, 0); -- read up to 5 messages; hidden from other readers for 30 seconds select * from pgmq_public.read('jobs', 30, 5); -- read and remove the next message in one step select * from pgmq_public.pop('jobs'); -- after processing: archive or delete select pgmq_public.archive('jobs', 1); select pgmq_public.delete('jobs', 1); ``` A message that is read but neither archived nor deleted before its hidden time ends becomes readable again, so a crashed worker loses no message. The fuller set of functions (`send_batch`, `set_vt`, `purge_queue`, `metrics`) is in the `pgmq` schema. In the panel you see each queue's messages, send a test message, delete a message or purge the queue. The Plan sets the number of queues. ## Vault {#vault} Vault keeps the keys and passwords your SQL or database functions need (such as a payment service's API key) **encrypted** in the database, with the Project's own key. - **Add secret:** a name (such as `stripe_key`), a description and the value. After saving, the value is visible only through **Reveal**, and every reveal is logged. To replace a leaked value, set a new one here. - Apps read the value from SQL with the `service_role` role: ```sql select decrypted_secret from vault.decrypted_secrets where name = 'stripe_key'; -- create and update from SQL select vault.create_secret('s3cr3t', 'my_secret', 'what it is for'); select vault.update_secret('', 'new value', 'my_secret', 'what it is for'); ``` - A backup file holds the values in encrypted form only. - The Plan sets the number of secrets. Managing the Vault needs the `baas:keys:manage` permission. > **Edge Functions secrets** The secrets [Edge Functions](https://docs.ariaservice.net/en/baas/functions#secrets) read with `Deno.env.get` are separate from the Vault and are defined on the Functions page. --- title: "API Keys and Connect" description: "Arianet BaaS API keys (Anon Key, Service Key, Publishable Key, Secret Key), revealing a key safely, key rotation with a 72-hour overlap, addresses, connection code samples and the direct Database connection." url: https://docs.ariaservice.net/en/baas/api-keys markdown: https://docs.ariaservice.net/en/baas/api-keys.md language: en --- # API Keys and Connect **API Keys and Connect** («API Keys و اتصال») has everything your app needs to connect to the Project in one place: keys, addresses, code samples per language and the direct Database connection details. ![API Keys and Connect](https://docs.ariaservice.net/en/img/panel/baas-api-keys-connect.jpg) ## Key types {#key-types} | Key | Format | Role | Where to use it | |---|---|---|---| | **Anon Key** | JWT (`eyJ…`) | `anon` | Client-side code (browser, mobile). RLS and Policies limit what it can reach. | | **Publishable Key** | `baas_pub_…` | `anon` | Same use as the Anon Key in the newer format; safe for clients. | | **Service Key** | JWT (`eyJ…`) | `service_role` | Servers only. **It bypasses RLS** and has full access to all data, files and User management. | | **Secret Key** | `baas_sec_…` | `service_role` | Same use as the Service Key in the newer format; servers only. | Send the key in the `apikey` header (or in `Authorization: Bearer`). When a User is signed in, `apikey` stays the Anon/Publishable Key and the User's own token goes in `Authorization: Bearer` ([REST API: headers](https://docs.ariaservice.net/en/baas/rest-api#headers)). > **Never put the Service Key or Secret Key in client-side code** Anyone who has these keys can read, change and delete all data without any limit. Keep them only in server environment variables or CI secrets, and never commit them to a repository. [Security and best practices](https://docs.ariaservice.net/en/baas/security) ## Reveal a key {#reveal} Keys are hidden and only their first characters are shown. **Show** («نمایش») displays the full key and hides it again after one minute. Every reveal is recorded in your account's activity log, and reveals per Project are rate-limited. Revealing a key needs the `baas:keys:manage` permission. ## Rotate keys {#rotate} **Rotate keys** («چرخش Keyها») replaces the Project's signing key and its Anon and Service Keys. Use it after a possible key leak, when team members change, or on a regular security schedule. Its three steps: 1. **What happens?** («چه اتفاقی می‌افتد؟») - A new signing key and new Anon and Service Keys are created. - The current keys keep working for **72 hours** (state "retiring") and are then revoked. - Update your apps with the new keys within that window; after it, the old keys get an access error. - Users are not signed out and no data changes. 2. **Prepare** («آماده‌سازی»): list where you will replace the keys: web and mobile apps, your servers, CI secrets. 3. **Confirm** («تأیید نهایی»): rotation cannot be undone. Notes: - User tokens signed with the previous key are accepted until the overlap ends, and are re-issued with the new key on refresh, so users do not have to sign in again. - Rotating again during an overlap revokes the previous "retiring" keys at once. - Rotation **does not change the Publishable Key or the Secret Key**. - You get a panel notice after a rotation. ## Addresses {#urls} Every part of the Project is on one Endpoint, each under its own path: | Part | Address | |---|---| | Endpoint | `https://.baas.arianet.app` | | REST | `https://.baas.arianet.app/rest/v1` | | Auth | `https://.baas.arianet.app/auth/v1` | | Storage | `https://.baas.arianet.app/storage/v1` | Most client libraries only need the Endpoint and build the paths themselves. ## Connection code samples {#snippets} The **Connection code samples** («نمونه‌کد اتصال») card has ready code for JavaScript / TypeScript, Flutter / Dart, Swift, Kotlin, Python, curl and a `.env` file. If you revealed the Anon Key above, it is filled into the code; otherwise `` appears in its place. The card also shows the client library package name for each language. JavaScript sample: ```js import { createClient } from '' const client = createClient('https://.baas.arianet.app', '') const { data, error } = await client.from('todos').select('*') ``` `.env` sample: ```bash ARIANET_BAAS_URL=https://.baas.arianet.app ARIANET_BAAS_ANON_KEY= ``` `arianet baas env` prints the same variables ([CLI](https://docs.ariaservice.net/en/cli#env)). ## Direct Database connection {#direct-connection} For SQL tools (such as `psql` or graphical clients), migration tools and ORMs, the **Direct Database connection** («اتصال مستقیم به Database») card gives the host, port, database name, user name, `sslmode` and a connection string. **Show Database password** («نمایش رمز Database») puts the password in the connection string (this reveal is recorded too). ```bash psql "postgres://postgres.:@.db.baas.arianet.app:5432/postgres?sslmode=require" ``` This connection has the Database owner's access and goes through a pooler in transaction mode. The limits of transaction mode, SSL enforcement, network restrictions and password changes are in [Direct connections and Database Settings](https://docs.ariaservice.net/en/baas/database-settings). For backups, use [Backup and restore](https://docs.ariaservice.net/en/baas/backups). --- title: "Usage and limits" description: "The Arianet BaaS Usage page - this month's Database, Storage, Egress, MAU, requests and SMS OTP against the Plan's limits, daily charts, the 80 and 100 percent warnings and what happens at a limit." url: https://docs.ariaservice.net/en/baas/usage markdown: https://docs.ariaservice.net/en/baas/usage.md language: en --- # Usage and limits The **Usage** page shows the Project's use in the current period against the Plan's limits, with a daily chart for each item. ## Usage period The usage period is the **calendar month in UTC**; its start and end are shown at the top. Egress and MAU start from zero every month. Database and Storage are current levels and do not reset with the month. ## What is counted | Item | What is counted | |---|---| | **Database** | The current Database size (Tables, indexes, and the Auth and Storage data), measured every few minutes. | | **Storage** | The total size of the files in all Buckets; re-measured within about a minute after files are uploaded or deleted. | | **Egress** | The size of the responses the Project sent this month (REST, Auth and file downloads). | | **MAU** | The number of distinct Users who signed in or refreshed their token this month. | | **Requests** («درخواست‌ها») | The number of requests to the Endpoint (no limit; for information). | | **SMS OTP** («پیامک OTP») | The number of SMS codes sent ([SMS](https://docs.ariaservice.net/en/cli-reference/auth#sms)). | | **Realtime messages** («پیام‌های Realtime») | Messages sent or received on [Realtime](https://docs.ariaservice.net/en/baas/realtime) channels. | | **Concurrent Realtime connections (peak)** («اتصال هم‌زمان Realtime (بیشینه)») | The highest number of concurrent Realtime connections in the period. | Sites use (count, storage and egress) is shown at the top of the [Sites](https://docs.ariaservice.net/en/baas/sites#limits) page and build minutes on the [Git and Deploy](https://docs.ariaservice.net/en/baas/git#limits) page. Account-wide limits (number of Projects, totals of the Plans) are under [Account quota](https://docs.ariaservice.net/en/baas/quotas). The same figures appear in short on the Project's card in the Project list and on the [Overview](https://docs.ariaservice.net/en/baas/projects#overview). From the terminal: `arianet baas usage `. ## Warnings For Database, Storage, Egress and MAU you get a notice when usage reaches **80 %** and then **100 %** of the Plan's limit. Each warning is sent once per item per month. If usage passes both thresholds between two checks, you only get the 100 % warning. ## Reaching a limit {#limits} Whether a limit is hard or usage beyond it is billed separately depends on the Plan and is shown in the panel. When a limit is hard, at 100 %: | Item | Effect | Until | |---|---|---| | **Egress** | Every request to the Project is refused with `402 egress_limit_reached`. | the month ends or the Plan changes | | **MAU** | New sign-ups (and anonymous sign-in, or a one-time code for an unknown address) are refused with `422 signup_disabled`. Existing Users keep signing in. | the month ends or the Plan changes | | **Storage** | Uploads and copies are refused with `413` (`QuotaExceeded`) and nothing is stored. Reading and deleting files works. | files are deleted or the Plan changes | | **Database** | The Database becomes **read-only**: reads work, writes are refused. If it still grows, the Project is paused and suspended with the reason "Database space full". Once the size is back under the limit, it is writable again. | the size goes down or the Plan changes | These states take effect within a minute or two of crossing a limit and are lifted just as fast when the month starts or the Plan changes. ## Other limits Requests per second, concurrent Database connections, the longest SQL statement through the API, the size of one file and the [automatic pause](https://docs.ariaservice.net/en/baas/faq#idle-pause) are also set by the Plan; your plan's values are shown in the panel. Requests over the rate limit are refused with `429 rate_limit_exceeded` and a `Retry-After` header. The maximum rows per REST response is set in the Project's [API settings](https://docs.ariaservice.net/en/baas/settings#api-settings). --- title: "Account quota and increases" description: "The account quota in Arianet BaaS - the limits on Projects, paid Projects, the totals of the Plans' Database, Storage and monthly egress, and Sites across the whole account, the «سهمیهٔ حساب» strip on the Project list, the quota_exceeded error and requesting an increase." url: https://docs.ariaservice.net/en/baas/quotas markdown: https://docs.ariaservice.net/en/baas/quotas.md language: en --- # Account quota and increases Arianet BaaS has two kinds of limits: | | Plan limit | Account quota | |---|---|---| | **Applies to** | One Project | Your whole Arianet account, every Project together | | **Example** | One Project's Database size, its monthly egress, its number of Sites | How many Projects you can have, the total Database of every Project | | **Shown on** | [Usage](https://docs.ariaservice.net/en/baas/usage), [Sites](https://docs.ariaservice.net/en/baas/sites#limits), [Git and Deploy](https://docs.ariaservice.net/en/baas/git#limits) | The **account quota** («سهمیهٔ حساب») strip above the Project list | | **Raised by** | [Changing the Plan](https://docs.ariaservice.net/en/baas/settings#change-plan) | **Requesting an increase** | ## What the quota covers {#resources} | On the strip | Meaning | |---|---| | **Project** | The account's live Projects (any Plan). A Project being created counts too. | | **Paid Project** («Project پولی») | Projects on a paid Plan. | | **Database** | The sum of every Project's **Plan Database limit**, in GB (rounded up). | | **Storage** | The sum of every Project's Plan Storage limit, in GB. | | **Monthly egress** («Egress ماهانه») | The sum of every Project's Plan monthly egress limit, in GB. | | **Site** | The Sites of every Project. | > **Totals of Plan limits, not of use** Database, Storage and egress count each Project's **Plan limit**, not what it actually uses. For example (hypothetical), three Projects on a Plan with a 10 GB Database take 30 GB of the Database quota, even when empty. So the quota is checked when you create a Project or upgrade a Plan, not when you write data. ## The account quota strip {#strip} At the top of the **Projects** page, the **account quota** strip shows each item as "used of limit" (such as «۲ از ۵»; an item without a limit says «نامحدود», unlimited). An item at 80% turns amber and a full one red. Hover an item for its full name. If the quota cannot be read the strip is hidden and never stands in your way. ## When the quota is full {#exceeded} An action that **adds** something past the quota is refused and nothing changes: - creating a Project (Projects and, for a paid Plan, paid Projects and the Database, Storage and egress totals) - changing to a bigger Plan - accepting a [transfer](https://docs.ariaservice.net/en/baas/settings#transfer) of a Project from another account - creating a Site The panel shows «سقف سهمیهٔ حساب پر است» ("the account quota is full") with the details, for example "your account's limit of BaaS projects is 5 and 5 of it is used. Request a quota increase to continue.", with a **Request a quota increase** («درخواست افزایش سهمیه») link. The API and the CLI return the same as `403 quota_exceeded` with the details `resource`, `used`, `requested` and `limit`. Only what grows is judged: if your quota is lowered, existing Projects and Sites keep working unchanged, deleting or shrinking is always possible, and moving to a smaller Plan frees quota. ## Requesting an increase {#request} 1. Press **Request increase** («درخواست افزایش») on the account quota strip (or the **Request a quota increase** link in the error). The account's resource quota page opens with that item, usually the one that is full or nearly so. 2. Enter the amount you need (and, if the form asks, why) and submit. 3. Support reviews the request and lets you know. Once approved, the new limit applies at once. The resource quota page is also in the account menu and shows the BaaS quotas next to the account's other resources ([Resource quota](../panel/billing.md#resource-quota)). > **tip** Before creating many Projects or Sites for a large project, check the strip and file the request early. ## Projects per Plan {#free} Apart from the account quota, a Plan can limit how many Projects an account has on that Plan. That limit is part of the Plan and is not raised by a quota request; each Plan's limit is shown when [creating a project](https://docs.ariaservice.net/en/baas/projects#plan-picker). --- title: "Logs" description: "The Arianet BaaS Logs page - the Project's requests of the last 7 days, filtered by source, level, status, method, path and Request ID, with each request's details and saved queries." url: https://docs.ariaservice.net/en/baas/logs markdown: https://docs.ariaservice.net/en/baas/logs.md language: en --- # Logs The **Logs** page shows the Project's requests of the **last 7 days**, to find errors and see how your app behaves. ![The Logs page](https://docs.ariaservice.net/en/img/panel/baas-logs.jpg) ## Columns | Column | Meaning | |---|---| | **Time** («زمان») | When the request arrived | | **Source** («منبع») | The part that answered: Gateway, REST, Auth, Storage, SQL (SQL Editor runs) and others | | **Level** («سطح») | `error` (`5xx` or failed SQL), `warning` (`4xx`) or `info` | | **Method** and **Path** («مسیر») | HTTP method and path | | **Status** («وضعیت») | HTTP status code | | **Duration** («مدت») | Response time in milliseconds | | **IP** | The client's address, with the last part masked (such as `185.126.7.x`) | Clicking a log opens its **details**: Request ID, key role (`anon`, `authenticated`, `service_role`) and browser, besides the columns above. ## Filters {#filters} - **Source:** all sources or one source. - **Level:** all, `error`, `warning` or `info`. - **Status:** all, `2xx` success, `3xx`, `4xx` client error, `5xx` server error. - **Method:** such as `GET` or `POST`. - **Range:** last hour, 6 hours, 24 hours, 7 days or a custom range. - **Search:** part of a path, or a full **Request ID** to find one exact request. **Refresh** («تازه‌سازی») reloads the list and **Show older** («نمایش قدیمی‌تر») loads the next page. Logs appear a few seconds after the request. ## Saved queries {#saved-queries} Keep filter combinations you use often (such as "5xx errors in REST") with **Save query** («ذخیرهٔ Query») and a short name, to apply them again with one click. ## Privacy - Paths are stored as templates: ids and numbers are replaced, and a file's path after the Bucket name is shown as `{path}`. - **Query strings, request bodies and headers are never stored**, so no key or token is in the logs. - Client IP addresses are masked. From the terminal: `arianet baas logs --since 1h --status 5` ([CLI](https://docs.ariaservice.net/en/cli#logs)). > **Finding one request** Every response from the Endpoint has an `X-Request-Id` header. When you contact support, send that id with the time of the request. --- title: "Advisors, Reports, Custom Domains and Members" description: "Arianet BaaS platform tools - Advisors for database security and performance checks, Reports on the Project's usage and behaviour, Custom Domains with automatic SSL, and Members based on Arianet IAM." url: https://docs.ariaservice.net/en/baas/platform markdown: https://docs.ariaservice.net/en/baas/platform.md language: en --- # Advisors, Reports, Custom Domains and Members ## Advisors {#advisors} **Advisors** checks the database for **security** and **performance** every day and, for each finding, gives an explanation, a fix and suggested SQL. Examples: a table in an exposed schema without RLS, a policy that re-evaluates `auth.uid()` for every row, a foreign key without an index. ![Advisors](https://docs.ariaservice.net/en/img/panel/baas-advisors.jpg) - Two tabs, **Security** and **Performance**, each with its count of findings. Findings are grouped by severity (`ERROR`, `WARN`, `INFO`). - **Run check** repeats the check right now; the time of the last check is shown next to it. - Open a finding to see its explanation, fix and suggested SQL. Read the SQL before running it; it changes the database. - When a new `ERROR` finding appears, you are notified. From the terminal ([CLI](https://docs.ariaservice.net/en/cli#more)): `arianet baas advisors ` (`--run` runs the check now). ## Reports {#reports} **Reports** shows the Project's usage and behaviour over **1 hour, 24 hours, 7 days or 30 days**: ![Reports](https://docs.ariaservice.net/en/img/panel/baas-reports.jpg) - **API:** total requests, errors, average response time and P95, requests by status class, breakdown by method and source, and the busiest paths. - **Auth:** sign-ups and sign-ins, and MAU against the Plan's limit. - **Storage:** file size, daily egress and Storage requests. - **Database**, **Realtime** and **Functions:** the usage of each over the same range. To find a specific request use [Logs](https://docs.ariaservice.net/en/baas/logs); for the monthly limits use [Usage](https://docs.ariaservice.net/en/baas/usage). ## Custom Domains {#custom-domains} Instead of `.baas.arianet.app`, a Project can answer on your own domain, such as `api.example.com`. Whether Custom Domains are available, and how many you can add, is set by the Plan. 1. **Add domain:** type the full domain or subdomain and confirm. 2. **DNS records:** the panel shows two records to create in your domain's DNS: a **CNAME** to the project endpoint and a **TXT** record proving ownership. 3. Once both records are correct, an **SSL certificate is issued automatically** and the domain goes live. Until then the current endpoint keeps working unchanged. Once live, REST, Auth, Storage, Realtime and Functions work on the new domain too, and **Auth runs on that domain**: email links and the provider sign-in callback use your domain (register the new callback URL in the provider's settings). The `.baas.arianet.app` address keeps working. To serve a [Site](https://docs.ariaservice.net/en/baas/sites#custom-domain) on your own domain, add the domain on that Site's page; its CNAME points at `.site.arianet.app`. Project and Site domains count together against the Plan's limit. From the terminal ([CLI](https://docs.ariaservice.net/en/cli#more)): `arianet baas domains list ` and `arianet baas domains remove `. ## Members {#members} Team members' access to BaaS Projects is managed in **Arianet IAM**; BaaS has no separate team system. The **Members** page shows who in the account can access this Project, and at what level: | Permission | What it allows | |---|---| | `baas:view` | Viewing the Project and its data | | `baas:projects:manage` | Managing the Project (Plan, pause, delete, transfer, backups, domains) | | `baas:sql:execute` | Running SQL, webhooks, Cron and Queues | | `baas:keys:manage` | Managing API keys, the database password and the Vault | | `baas:functions:manage` | Creating, deploying and testing Edge Functions | | `baas:storage:manage` | Managing Storage (buckets and files) | | `baas:auth-users:manage` | Managing Auth Users | | `baas:sites:manage` | Creating, deploying, publishing and deleting [Sites](https://docs.ariaservice.net/en/baas/sites) | | `baas:git:manage` | Connecting [Git](https://docs.ariaservice.net/en/baas/git) and managing deployments and previews | Access can be granted for the whole account, a workspace or **a single Project**; for access to one Project only, choose the "specific resource" level in IAM. The **Manage access in IAM** button takes you there. Only the account owner or someone with IAM management sees the member list. IAM details are in the [team guide](../panel/team.md). --- title: "Project settings" description: "Arianet BaaS Project settings - rename, pause and resume, the automatic pause schedule, API settings, transferring a Project to another account, changing the Plan and deleting a Project." url: https://docs.ariaservice.net/en/baas/settings markdown: https://docs.ariaservice.net/en/baas/settings.md language: en --- # Project settings The **Settings** («تنظیمات») page has the Project name, Plan, pause and resume, the automatic pause schedule, API settings, transfer and deleting the Project. ![Project settings](https://docs.ariaservice.net/en/img/panel/baas-settings.jpg) ## Project name The name is for display only; the `ref` and Endpoint do not change with it. The same naming rule as [creating a Project](https://docs.ariaservice.net/en/baas/projects#create) applies: English letters, digits, `-` and `_`, no spaces, up to 64 characters. Type the new name and click **Save** («ذخیره»). ## Pause and resume {#pause} - **Pause Project** («توقف Project»): the Project stops answering but the Database, Users and files are kept. Apps using the Project get `503 project_paused` from that moment. A Project you paused yourself is not woken by requests. - **Resume Project** («ادامهٔ کار Project»): everything comes back as it was. The "Resume Project" button also appears at the top of every page of a paused Project. The [automatic pause](#auto-pause) for idleness is different and ends with the next request ([FAQ](https://docs.ariaservice.net/en/baas/faq#idle-pause)). ## Automatic pause schedule {#auto-pause} Depending on the Plan, a Project that gets no request for a while is paused automatically to free resources (the Plan sets how long); data and files are kept. This card shows the **last request** and the **estimated pause time**. After the pause, the Project resumes with the "Resume Project" button on this page or with the first request. ## API settings {#api-settings} - **Maximum Rows per response:** the most Rows the REST API returns in one response (default 1,000). For more, paginate. - **Sign-in token lifetime:** how long Users' access tokens are valid (default 1 hour). The client library refreshes the token automatically before it expires. **Edit** is a two-step wizard (values, review). The change applies to the next requests and your apps need no key change. Which Schemas the REST API serves is set on the [Database page](https://docs.ariaservice.net/en/baas/database#schemas). From the terminal ([CLI](https://docs.ariaservice.net/en/cli#more)): `arianet baas api-settings get ` and `arianet baas api-settings set `. ## Transfer a Project {#transfer} Give the Project, with all its data, to another Arianet account. **Transfer Project** («انتقال Project») is a four-step wizard: transfer to another account, **target account** (the receiving Arianet account's numeric ID), **confirm with the ref**, and review and send. - A transfer needs **both sides**: the request goes to the owner of the target account and nothing moves until they accept. The receiver has 7 days to accept, and until then you can cancel the request. - After acceptance, ownership and the Project's cost move to the target account, and the Plan is charged to the target account's wallet. You no longer have access to the Project. The Endpoint, keys and data do not change. - From the terminal ([CLI](https://docs.ariaservice.net/en/cli#more)): `arianet baas transfer `, and for the receiver `arianet baas transfer list`, `accept ` or `decline `. ## Change Plan {#change-plan} **Change Plan** («تغییر Plan») is a three-step wizard: 1. **Choose a Plan** («انتخاب Plan»): pick the new Plan. Changing the Plan does not move your data; the Endpoint and keys stay the same. 2. **Compare** («مقایسه»): the current and new Plan's limits side by side. If your current usage does not fit one of the new limits you get a warning; after the change the Project may become read-only or limited. 3. **Review and confirm** («مرور و تأیید»): read the price and effect, and confirm. If the new Plan has a price, it is charged to your wallet; with too little balance the change is not made and the current Plan stays. The new limits apply at once. The Plans you can switch to, with their limits, are shown in the wizard; if no other Plan is offered, the wizard says no other Plan is on sale. ## Delete a Project {#delete} **Deleting a Project** («حذف Project») cannot be undone. Its three steps: 1. **What is lost** («چه چیزی از بین می‌رود»): the Database with all Tables and Rows; all Auth Users and their sessions; all Buckets and files; the keys and Endpoint (apps get errors from that moment). The Project's monthly charge stops too. 2. **Before deleting** («پیش از حذف»): if you need the data, take a [backup](https://docs.ariaservice.net/en/baas/backups) and download it (or run `pg_dump` over the [direct connection](https://docs.ariaservice.net/en/baas/database-settings#direct-connection)) and download important Storage files, then confirm that you did. 3. **Confirm with ref** («تأیید با ref»): to avoid mistakes, type the Project's `ref` exactly and click **Delete Project permanently** («حذف قطعی Project»). Deleting takes a moment and the Project disappears from your list. > **Permissions** Renaming, pausing, API settings, transfer, changing the Plan and deleting need the `baas:projects:manage` permission. If you are a team member and a button is disabled, ask the account owner for access. --- title: "REST API reference" description: "Arianet BaaS REST API reference - the apikey and Authorization headers, reading with select, filters, ordering, paging, insert, upsert, update, delete, calling Functions with rpc and the error format." url: https://docs.ariaservice.net/en/baas/rest-api markdown: https://docs.ariaservice.net/en/baas/rest-api.md language: en --- # REST API reference Every Table and View in the `public` Schema gets an automatic API at `https://.baas.arianet.app/rest/v1/
`. A new Table is available in the API at once. Each request runs with the role of its key or User, and **RLS and Policies** decide which Rows are seen or changed. ```bash BAAS_URL=https://.baas.arianet.app ANON_KEY= ``` ## Headers {#headers} | Header | Value | |---|---| | `apikey` | **Required.** The Anon Key or Publishable Key (on a server: the Service Key or Secret Key). | | `Authorization` | `Bearer ` when a User is signed in; the request runs as `authenticated` with that User's id. Without it, the key's role is used (`anon` or `service_role`). | | `Content-Type` | `application/json` for request bodies. | | `Prefer` | Response behaviour: `return=representation` (return the written Rows), `return=minimal`, `count=exact`, `resolution=merge-duplicates` or `resolution=ignore-duplicates` (upsert). Separate several with commas. | | `Range` | Paging by Row range, such as `Range: 0-24` (with `Range-Unit: items`). | | `Accept` | `application/json` (default) or `text/csv`. | Roles: | Role | With | RLS | |---|---|---| | `anon` | Anon/Publishable Key without a User token | applies | | `authenticated` | a User's token in `Authorization` | applies; `auth.uid()` is that User's id | | `service_role` | Service/Secret Key | **bypassed** | Browsers can call the API directly: responses allow CORS for any origin, because keys (not cookies) authorise requests. ## Read {#select} ### `GET /rest/v1/{table}` ```bash # all columns curl "$BAAS_URL/rest/v1/todos?select=*" -H "apikey: $ANON_KEY" # chosen columns, with an alias and a cast curl "$BAAS_URL/rest/v1/todos?select=id,title,createdAt:created_at,price::text" -H "apikey: $ANON_KEY" ``` - `select` picks the columns; without it, all columns are returned. `alias:column` renames and `column::type` casts. - **JSON columns:** `select=meta->color,meta->>size` (`->` returns JSON, `->>` text). - **Related Tables** (through a foreign key) in the same request: `select=id,title,author(id,name)` for a to-one reference, `select=id,name,todos(id,title)` for the related Rows. With `author!inner(name)` only Rows that have a related Row are returned. - A response has at most **1000 Rows**; for more, [page](#paging) through them. ## Filters {#filters} A filter is `column=operator.value` in the query string. Several filters are combined with AND. | Operator | Meaning | Example | |---|---|---| | `eq` | equal | `status=eq.done` | | `neq` | not equal | `status=neq.done` | | `gt`, `gte` | greater than, or equal | `price=gte.1000` | | `lt`, `lte` | less than, or equal | `created_at=lt.2026-12-01` | | `like`, `ilike` | pattern (`*` instead of `%`); `ilike` ignores case | `title=ilike.*milk*` | | `in` | one of the values | `id=in.(1,2,3)` | | `is` | `null`, `true`, `false` | `deleted_at=is.null` | | `cs`, `cd` | array/JSON contains / is contained in | `tags=cs.{work,urgent}` | | `ov` | array or range overlap | `tags=ov.{a,b}` | | `fts`, `plfts`, `phfts`, `wfts` | full-text search | `body=fts.hello` | | `not.` | negates any operator | `status=not.eq.done` | | `or` / `and` | combine conditions | `or=(status.eq.new,priority.gt.3)` | ```bash curl "$BAAS_URL/rest/v1/todos?select=*&done=is.false&or=(priority.gte.3,title.ilike.*urgent*)" \ -H "apikey: $ANON_KEY" -H "Authorization: Bearer $TOKEN" ``` Put values containing commas, parentheses or dots in `"` and URL-encode them. Filter on a related Table: `select=*,todos(*)&todos.done=eq.false`. ## Ordering {#order} `order=column.asc` or `order=column.desc`, with `nullsfirst` / `nullslast`, several columns separated by commas: ```bash curl "$BAAS_URL/rest/v1/todos?select=*&order=done.asc,created_at.desc.nullslast" -H "apikey: $ANON_KEY" ``` ## Paging {#paging} With `limit` and `offset`: ```bash curl "$BAAS_URL/rest/v1/todos?select=*&order=id&limit=25&offset=50" -H "apikey: $ANON_KEY" ``` Or with the `Range` header. For the total count, send `Prefer: count=exact`; the response then has a `Content-Range` header such as `50-74/312`: ```bash curl -i "$BAAS_URL/rest/v1/todos?select=*" -H "apikey: $ANON_KEY" \ -H "Range: 0-24" -H "Prefer: count=exact" ``` On large Tables, `count=planned` or `count=estimated` is faster. Always page with an `order` so the order is stable. ## Insert {#insert} ### `POST /rest/v1/{table}` ```bash curl -X POST "$BAAS_URL/rest/v1/todos" \ -H "apikey: $ANON_KEY" -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" -H "Prefer: return=representation" \ -d '{"title": "Buy bread"}' ``` - For several Rows, send an array: `[{"title": "a"}, {"title": "b"}]`. - Without `Prefer: return=representation` the answer is `201` with no body. - The Row must pass the `WITH CHECK` of an `INSERT` Policy, otherwise you get error `42501`. - `?columns=title,done` reads only these columns from the body. ## Upsert {#upsert} Insert, or update when the key already exists: ```bash curl -X POST "$BAAS_URL/rest/v1/profiles?on_conflict=user_id" \ -H "apikey: $ANON_KEY" -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" \ -H "Prefer: resolution=merge-duplicates,return=representation" \ -d '{"user_id": "", "display_name": "Ali"}' ``` - `on_conflict` names the unique column or columns (default: the primary key). - `resolution=ignore-duplicates` skips duplicate Rows. - An upsert needs both an `INSERT` and an `UPDATE` Policy. ## Update {#update} ### `PATCH /rest/v1/{table}` ```bash curl -X PATCH "$BAAS_URL/rest/v1/todos?id=eq.42" \ -H "apikey: $ANON_KEY" -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" -H "Prefer: return=representation" \ -d '{"done": true}' ``` **Always add a filter.** Without one, every Row the Policies allow is changed. Rows the `UPDATE` Policy does not see are left alone (without an error). ## Delete {#delete} ### `DELETE /rest/v1/{table}` ```bash curl -X DELETE "$BAAS_URL/rest/v1/todos?id=eq.42" \ -H "apikey: $ANON_KEY" -H "Authorization: Bearer $TOKEN" ``` As with updates, without a filter every allowed Row is deleted. `Prefer: return=representation` returns the deleted Rows. ## Call a Function with rpc {#rpc} ### `POST /rest/v1/rpc/{function}` Any Function in the `public` Schema can be called. Arguments are sent as JSON by parameter name: ```sql create function public.todo_stats(min_priority int) returns table (done boolean, total bigint) language sql stable as $$ select done, count(*) from public.todos where priority >= min_priority group by done $$; ``` ```bash curl -X POST "$BAAS_URL/rest/v1/rpc/todo_stats" \ -H "apikey: $ANON_KEY" -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" \ -d '{"min_priority": 2}' ``` - `stable` or `immutable` Functions can also be called with `GET` and query parameters: `GET /rest/v1/rpc/todo_stats?min_priority=2`. - A Function runs as the caller and RLS applies, unless it was created `security definer`. In a `security definer` Function always `set search_path = ''` and check access yourself. - Filters, `order` and `limit` also work on the result of Functions that return a table. ## Errors {#errors} **Errors about reaching the Project** (before the request reaches the API) look like this: ```json {"code": "invalid_api_key", "message": "…", "request_id": "…"} ``` | HTTP | `code` | Meaning | |---|---|---| | `401` | `no_api_key` | No `apikey` header was sent. | | `401` | `invalid_api_key` | The key is wrong or revoked (for example an old key after a rotation's overlap). | | `402` | `egress_limit_reached` | The Plan's monthly Egress is used up (when the limit is hard). | | `403` | `project_suspended` | The Project is suspended. | | `404` | `project_not_found` | No Project at this address. | | `429` | `rate_limit_exceeded` | More requests than the Plan allows; retry after `Retry-After` seconds. | | `503` | `project_resuming` | The Project is starting after an automatic pause; retry after `Retry-After` (about 5 seconds). | | `503` | `project_paused` | You paused the Project. | | `503` | `project_provisioning` | The Project is still being created. | | `502` | `upstream_unavailable` | The service did not answer for a moment; retry. | **API and Database errors** look like this: ```json {"code": "42501", "message": "new row violates row-level security policy for table \"todos\"", "details": null, "hint": null} ``` `code` is either the Database's own SQLSTATE (for example `42501` permission or Policy violation, `23505` duplicate value, `23503` foreign key violation, `42P01` the Table does not exist, `22P02` invalid value for the column type) or the REST layer's own code for errors such as a bad parameter. Compatible client libraries understand these codes. Every response has an `X-Request-Id` header; include it when you report a problem. > **Other Schemas** Only the `public` Schema is served by the REST API. Read Tables of other Schemas through a Function in `public`, or from a server over the [direct connection](https://docs.ariaservice.net/en/baas/api-keys#direct-connection). --- title: "Auth API reference" description: "Arianet BaaS Auth API reference - sign-up, password and one-time code (OTP) sign-in, magic link, token refresh, user details, sign-out, password recovery, the JWT claims and using auth.uid() in Policies." url: https://docs.ariaservice.net/en/baas/auth-api markdown: https://docs.ariaservice.net/en/baas/auth-api.md language: en --- # Auth API reference The Auth API signs up and signs in your app's users at `https://.baas.arianet.app/auth/v1`. Its protocol is compatible with the common client libraries (JavaScript, Dart, Swift, Kotlin); if you use a library, it sends these requests for you. Every request needs the `apikey` header with the Anon Key or Publishable Key. Requests about the signed-in User also send their token in `Authorization: Bearer `. ```bash BAAS_URL=https://.baas.arianet.app ANON_KEY= ``` ## Session {#session} A successful sign-in returns a session: ```json { "access_token": "eyJ…", "token_type": "bearer", "expires_in": 3600, "expires_at": 1795000000, "refresh_token": "…", "user": {"id": "…", "email": "ali@example.com", "role": "authenticated", "…": "…"} } ``` - `access_token` is a JWT valid for **one hour**. Send it in `Authorization: Bearer` on REST and Storage requests. - `refresh_token` gets a new session and **changes on every use**; always keep the latest one. Reusing an old refresh token (after 10 seconds) is treated as theft and the whole session is revoked. ## Sign up {#signup} ### `POST /auth/v1/signup` ```bash curl -X POST "$BAAS_URL/auth/v1/signup" \ -H "apikey: $ANON_KEY" -H "Content-Type: application/json" \ -d '{"email": "ali@example.com", "password": "a-strong-password", "data": {"display_name": "Ali"}}' ``` - With an email or phone (`"phone": "+989121234567"`) and a password. `data` is free-form user data (`user_metadata`). - With **email confirmation** on (the default), the User comes back without a session and a confirmation email is sent; the User signs in after clicking the link. With confirmation off, a session is returned at once. - The email link returns to `?redirect_to=` (if it is in the allowed list) or to the Site URL ([Auth settings](https://docs.ariaservice.net/en/cli-reference/auth#settings)). - **Anonymous sign-in:** when enabled, `POST /auth/v1/signup` with no email and password creates an anonymous User with a session. - When sign-ups are closed or the Plan's MAU limit is reached (when it is hard): `422` with `error_code: "signup_disabled"`. ## Password sign-in {#password} ### `POST /auth/v1/token?grant_type=password` ```bash curl -X POST "$BAAS_URL/auth/v1/token?grant_type=password" \ -H "apikey: $ANON_KEY" -H "Content-Type: application/json" \ -d '{"email": "ali@example.com", "password": "a-strong-password"}' ``` With a phone: `{"phone": "+989121234567", "password": "…"}`. Wrong password or address: `400` with `invalid_credentials`. Unconfirmed email: `email_not_confirmed`. ## One-time code (OTP) and magic link {#otp} ### `POST /auth/v1/otp` ```bash # email: a sign-in link and a 6-digit code are sent curl -X POST "$BAAS_URL/auth/v1/otp" \ -H "apikey: $ANON_KEY" -H "Content-Type: application/json" \ -d '{"email": "ali@example.com", "create_user": true}' # phone: an SMS code (only on a Plan with SMS) curl -X POST "$BAAS_URL/auth/v1/otp" \ -H "apikey: $ANON_KEY" -H "Content-Type: application/json" \ -d '{"phone": "+989121234567"}' ``` #### Send response {#send-response} A successful answer (`200`) describes the message that was sent: ```json { "message_id": "01m8hjz4jq2r150s5jay8ytfmh", "channel": "sms", "phone": "+989121234567", "sent_at": "2026-11-28T18:00:00Z", "expires_at": "2026-11-28T18:05:00Z", "expires_in": 300 } ``` | Field | Meaning | |---|---| | `message_id` | The SMS gateway's id for the message; an empty string (`""`) for email | | `channel` | `sms` or `email` | | `phone` or `email` | The recipient; a phone is always in international form (`+98…`) | | `sent_at` | When it was sent (RFC 3339) | | `expires_at` | When the code expires (RFC 3339) | | `expires_in` | The code's lifetime in seconds (default 300) | - `POST /auth/v1/resend` and [`POST /auth/v1/recover`](#recover) return the same answer. - The answer has the same shape whether or not the account exists, so nobody can probe which accounts exist. - Use `expires_in` in your app for a countdown and to enable the "send again" button. ### `POST /auth/v1/verify` ```bash curl -X POST "$BAAS_URL/auth/v1/verify" \ -H "apikey: $ANON_KEY" -H "Content-Type: application/json" \ -d '{"type": "email", "email": "ali@example.com", "token": "123456"}' ``` - `type` is `email` for an emailed code and `sms` for an SMS code. A successful answer is a session. - `create_user: false` only lets existing Users in. - Codes and links are valid for **5 minutes** and single use (the lifetime and code length can be changed in [Auth settings](https://docs.ariaservice.net/en/cli-reference/auth#settings)). After 5 wrong codes, the code is revoked. - Sending is rate-limited: one message per recipient every 60 seconds (`POST /auth/v1/resend` sends again). - Write phone numbers in international form (`+989121234567`) or the Iranian local form (`09121234567`); spaces and Persian digits are accepted too. Both forms are normalised to `+98…` and stored that way. ## Refresh the session {#refresh} ### `POST /auth/v1/token?grant_type=refresh_token` ```bash curl -X POST "$BAAS_URL/auth/v1/token?grant_type=refresh_token" \ -H "apikey: $ANON_KEY" -H "Content-Type: application/json" \ -d '{"refresh_token": ""}' ``` Refresh before `expires_at` (client libraries do this automatically). ## User details {#user} ### `GET /auth/v1/user` ```bash curl "$BAAS_URL/auth/v1/user" -H "apikey: $ANON_KEY" -H "Authorization: Bearer $TOKEN" ``` ### `PUT /auth/v1/user` Changes `data` (merged; `null` removes a key), `password`, `email` or `phone`. A new address gets a confirmation message. ```bash curl -X PUT "$BAAS_URL/auth/v1/user" \ -H "apikey: $ANON_KEY" -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \ -d '{"data": {"display_name": "Ali R."}}' ``` ## Sign out {#logout} ### `POST /auth/v1/logout` ```bash curl -X POST "$BAAS_URL/auth/v1/logout?scope=local" \ -H "apikey: $ANON_KEY" -H "Authorization: Bearer $TOKEN" ``` `scope`: `local` (this session), `others` (all other sessions) or `global` (all sessions). The answer is `204`. The access token stays valid until its one hour runs out but can no longer be refreshed. ## Password recovery {#recover} ### `POST /auth/v1/recover` ```bash curl -X POST "$BAAS_URL/auth/v1/recover" \ -H "apikey: $ANON_KEY" -H "Content-Type: application/json" \ -d '{"email": "ali@example.com"}' ``` A recovery link is emailed. The answer is the [send response](#send-response) (`channel` is `email`) and is the same for existing and unknown addresses, so nobody can probe which accounts exist. After signing in through the link, the User sets a new password with `PUT /auth/v1/user` and `{"password": "…"}`. ## Other paths | Path | Purpose | |---|---| | `GET /auth/v1/settings` | The Project's enabled sign-in methods | | `GET /auth/v1/.well-known/jwks.json` | Public keys to verify JWT signatures (no key needed) | | `POST /auth/v1/resend` | Send the confirmation email or code again; answers like the [send response](#send-response) | | `POST /auth/v1/reauthenticate` | A code to confirm a sensitive action (password change) | | `/auth/v1/admin/users` | User management from a server; **Service Key** only ([Auth in the panel](https://docs.ariaservice.net/en/cli-reference/auth#users) does the same) | ## Sign-in with OAuth and OpenID Connect {#oauth} After [setting up the provider in the panel](https://docs.ariaservice.net/en/cli-reference/auth#providers): ```js await client.auth.signInWithOAuth({ provider: 'github', // google, gitlab, azure, apple, discord, bitbucket, linkedin_oidc, twitter options: { redirectTo: 'https://app.example.com/auth/callback' }, }) ``` - Path: `GET /auth/v1/authorize?provider=&redirect_to=` sends the User to the provider, which brings them back to `/auth/v1/callback`. The User then returns to `redirect_to` with the tokens; `redirect_to` must be in the [allowed redirect URLs](https://docs.ariaservice.net/en/cli-reference/auth#urls). - **PKCE** (recommended, with the `code_challenge` parameter; the client library does it for you) and **implicit** (tokens in the URL's `#`) are both supported. - **Sign-in with an ID token:** a mobile app signed in with Google's or Apple's native SDK turns the ID token into a session with `POST /auth/v1/token?grant_type=id_token` (in the library: `signInWithIdToken`). - **Identity linking:** a signed-in User links another account with `GET /auth/v1/user/identities/authorize` and unlinks one with `DELETE /auth/v1/user/identities/{id}` (the last identity cannot be unlinked). Linking an account to an anonymous User makes them permanent. - A provider that is off answers `provider_disabled`. ## Multi-factor authentication (MFA) {#mfa} | Path | Purpose | |---|---| | `POST /auth/v1/factors` | Enrol a factor: `{"factor_type": "totp"}` (the answer has a QR code and secret) or `{"factor_type": "phone", "phone": "+98…"}` | | `POST /auth/v1/factors/{id}/challenge` | Start a verification (for phone, an SMS code is sent) | | `POST /auth/v1/factors/{id}/verify` | `{"challenge_id", "code"}`; on success a new session with `aal: "aal2"` | | `DELETE /auth/v1/factors/{id}` | Remove a factor (needs an `aal2` session) | In the client library: `client.auth.mfa.enroll`, `challenge`, `verify` and `getAuthenticatorAssuranceLevel`. In Policies check `(auth.jwt() ->> 'aal') = 'aal2'` ([example](https://docs.ariaservice.net/en/cli-reference/auth#mfa)). ## CAPTCHA {#captcha} When [CAPTCHA is on](https://docs.ariaservice.net/en/cli-reference/auth#policies), sign-up, password sign-in, one-time codes and password recovery need the widget's token; in the client library pass it as `options.captchaToken`. Without it the answer is `captcha_failed`. ## Errors {#errors} ```json {"error_code": "invalid_credentials", "msg": "Invalid login credentials"} ``` Common codes: `validation_failed`, `invalid_credentials`, `email_not_confirmed`, `phone_not_confirmed`, `user_already_exists`, `weak_password`, `signup_disabled`, `otp_expired`, `over_email_send_rate_limit`, `over_sms_send_rate_limit`, `over_request_rate_limit`, `refresh_token_already_used`, `session_not_found`, `user_banned`, `phone_provider_disabled`. Compatible client libraries read this `error_code`. ## JWT claims {#jwt} The `access_token` is signed with the Project's key (ES256) and carries these claims: | Claim | Value | |---|---| | `iss` | `https://.baas.arianet.app/auth/v1` | | `aud` | `authenticated` | | `sub` | the User's id (`uuid`) | | `role` | `authenticated` | | `exp`, `iat` | expiry (one hour after issue) and issue time | | `session_id` | the session id | | `email`, `phone` | the User's email and phone | | `app_metadata`, `user_metadata` | app data (only a server changes it) and user data (the sign-up `data`) | | `aal`, `amr` | assurance level (`aal1`) and sign-in method (`password`, `otp`, `magiclink`, …) | | `is_anonymous` | whether the User is anonymous | To verify the signature on your own server, read the public keys from `/auth/v1/.well-known/jwks.json`. During a [key rotation](https://docs.ariaservice.net/en/baas/api-keys#rotate) the previous key stays in this list until the overlap ends. ## auth.uid() in Policies {#auth-uid} When a request reaches REST or Storage with `Authorization: Bearer `, the token's signature is checked, the request runs as its `role` (`authenticated`), and the token's claims are handed to the Database. These functions read them in Policies and Functions: | Function | Value | |---|---| | `auth.uid()` | the `sub` claim: the signed-in User's id (`uuid`); `null` for `anon` | | `auth.role()` | `anon`, `authenticated` or `service_role` | | `auth.email()` | the User's email | | `auth.jwt()` | all claims as `jsonb` | Example: each User sees and writes only their own Rows, and only Users whose `app_metadata.role` is `admin` see everything: ```sql alter table public.todos enable row level security; create policy "own rows" on public.todos for all to authenticated using (auth.uid() = user_id) with check (auth.uid() = user_id); create policy "admins read all" on public.todos for select to authenticated using ((auth.jwt() -> 'app_metadata' ->> 'role') = 'admin'); ``` Your Tables can reference Users: `user_id uuid references auth.users (id) on delete cascade`. To create a profile Row for every new User automatically, add a Trigger on `auth.users` with a `security definer` Function. --- title: "Storage API reference" description: "Arianet BaaS Storage API reference - Buckets, uploading, downloading, listing, moving and deleting files, Signed URLs for download and upload, and RLS on files with storage.objects." url: https://docs.ariaservice.net/en/baas/storage-api markdown: https://docs.ariaservice.net/en/baas/storage-api.md language: en --- # Storage API reference The Storage API at `https://.baas.arianet.app/storage/v1` manages the Project's files and is compatible with the common client libraries. Each request runs with the role of its key or User, and **Policies on `storage.objects`** decide who can see or write which file ([RLS on files](#storage-rls)). ```bash BAAS_URL=https://.baas.arianet.app ANON_KEY= ``` Headers as in the [REST API](https://docs.ariaservice.net/en/baas/rest-api#headers): always `apikey`, plus `Authorization: Bearer ` for a signed-in User. The Service Key bypasses Policies. ## Buckets {#buckets} | Request | Purpose | |---|---| | `GET /storage/v1/bucket` | List Buckets | | `GET /storage/v1/bucket/` | One Bucket | | `POST /storage/v1/bucket` | Create: `{"id": "avatars", "name": "avatars", "public": false, "file_size_limit": 5242880, "allowed_mime_types": ["image/*"]}` | | `PUT /storage/v1/bucket/` | Change `public`, `file_size_limit` (`null` removes the limit) or `allowed_mime_types` | | `POST /storage/v1/bucket//empty` | Delete every file in the Bucket | | `DELETE /storage/v1/bucket/` | Delete an empty Bucket (not empty: `409`) | Buckets are usually created and changed in the [panel](https://docs.ariaservice.net/en/baas/storage#create-bucket) or with the Service Key. A Bucket name starts with a letter or digit and has English letters and digits, `_`, `.` and `-`. Do not name a Bucket `public`, `authenticated`, `info`, `sign`, `upload`, `list`, `move` or `copy` (they clash with API paths). ## Upload {#upload} ### `POST /storage/v1/object/{bucket}/{path}` ```bash curl -X POST "$BAAS_URL/storage/v1/object/avatars//avatar.png" \ -H "apikey: $ANON_KEY" -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: image/png" \ --data-binary @avatar.png ``` - The body is the file itself (or a multipart form). Answer: `{"Id": "…", "Key": "avatars//avatar.png"}`. - To replace an existing file send `x-upsert: true`, or use `PUT` on the same path; without it a duplicate name is an error. - `cache-control` (such as `max-age=3600`) is stored with the file and sent on download. - **Limits:** the smaller of the Plan's per-file limit and the Bucket's own `file_size_limit`. A bigger file: `413`. A type not in `allowed_mime_types`: `415`. The Plan's total Storage quota is full (when the limit is hard): `413` with `code: "QuotaExceeded"`. - A file name is 1 to 1024 bytes with no leading, trailing or doubled `/` and no `.` or `..` segment. Folders are just path segments and are not created separately. ## Download {#download} | Request | Access | |---|---| | `GET /storage/v1/object/public//` | public Buckets only; **no key** | | `GET /storage/v1/object/authenticated//` | by Policy, with key and token | | `GET /storage/v1/object/sign//?token=…` | with a [Signed URL](#signed-urls), no key | | `GET /storage/v1/object/info//` | file details: size, type, `etag`, timestamps | - `?download` sends the file as an attachment; `?download=name.png` with a chosen name. - `Range` and `If-None-Match` headers are supported. - HTML, SVG, XML and JavaScript files are sent as attachments unless your Plan and identity-verified account allow inline serving ([Storage](https://docs.ariaservice.net/en/baas/storage#limits)). ```html logo ``` ## List, move and delete {#manage} | Request | Purpose | |---|---| | `POST /storage/v1/object/list/` | List one folder level: `{"prefix": "users/42/", "limit": 100, "offset": 0, "sortBy": {"column": "name", "order": "asc"}, "search": ""}`. Folders come back with `id: null`. | | `POST /storage/v1/object/move` | Move or rename: `{"bucketId": "avatars", "sourceKey": "a.png", "destinationKey": "b.png"}` (with `destinationBucket` to another Bucket) | | `POST /storage/v1/object/copy` | Copy, same body | | `DELETE /storage/v1/object//` | Delete one file | | `DELETE /storage/v1/object/` | Delete several files: `{"prefixes": ["a.png", "docs/b.pdf"]}` | ## Signed URLs {#signed-urls} A Signed URL is a temporary link anyone can use to download the file, without a key or sign-in, until it expires. Whoever creates it must be allowed to read (`select`) that file by a Policy. ### `POST /storage/v1/object/sign/{bucket}/{path}` ```bash curl -X POST "$BAAS_URL/storage/v1/object/sign/documents//report.pdf" \ -H "apikey: $ANON_KEY" -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" \ -d '{"expiresIn": 3600}' ``` The answer is `{"signedURL": "/object/sign/documents/…/report.pdf?token=…"}`; the full link is `https://.baas.arianet.app/storage/v1` + `signedURL`. - `expiresIn` in seconds, from 1 second to 7 days. - Several files at once: `POST /storage/v1/object/sign/` with `{"expiresIn": 600, "paths": ["a.pdf", "b.pdf"]}`. - Each link is valid only for that Project, that file and that action (download), and cannot be tampered with. **Signed uploads** (for example, uploading straight from a browser without handing over a token): `POST /storage/v1/object/upload/sign//` returns `{url, token}` (the creator must be allowed to `insert`); then send the file with `PUT /storage/v1/object/upload/sign//?token=…`. The link is valid for 2 hours. ## RLS on files {#storage-rls} File details live in the `storage.buckets` and `storage.objects` Tables in the Project's own Database, and **RLS is on for both with no Policy**. Until you write a Policy, `anon` and `authenticated` cannot see or upload any file; only the Service Key (and the panel) can. A public Bucket only opens downloads from the `public` path; listing, uploading and deleting still need Policies. Write Policies on `storage.objects` in the [SQL Editor](https://docs.ariaservice.net/en/baas/sql-editor). Useful columns: `bucket_id`, `name` (the file's full path) and `owner_id`. Helper functions: `storage.foldername(name)` (the array of folders), `storage.filename(name)` and `storage.extension(name)`. Example: in the `avatars` Bucket, each User can upload, see, replace and delete files only in a folder named after their own id: ```sql create policy "avatars: read own folder" on storage.objects for select to authenticated using (bucket_id = 'avatars' and (storage.foldername(name))[1] = auth.uid()::text); create policy "avatars: upload to own folder" on storage.objects for insert to authenticated with check (bucket_id = 'avatars' and (storage.foldername(name))[1] = auth.uid()::text); create policy "avatars: replace own files" on storage.objects for update to authenticated using (bucket_id = 'avatars' and (storage.foldername(name))[1] = auth.uid()::text); create policy "avatars: delete own files" on storage.objects for delete to authenticated using (bucket_id = 'avatars' and (storage.foldername(name))[1] = auth.uid()::text); ``` | Action | Policy needed | |---|---| | Download (non-public), list, create a Signed URL | `select` | | Upload | `insert` | | Upload with `x-upsert` (replace) | `insert`, `select` and `update` | | Move and rename | `select` and `update` | | Delete | `select` and `delete` | For a private Bucket that everyone signed in may read but only its owners may write to, use `bucket_id = '…'` alone instead of the folder condition in the `select` Policy. ## Resumable uploads (TUS) {#resumable} For large files or unstable connections, use the standard **TUS 1.0** protocol at `POST /storage/v1/upload/resumable`; any TUS client library (such as `tus-js-client` or Uppy) works. If the connection drops, the upload continues where it stopped. ```js import * as tus from 'tus-js-client' const upload = new tus.Upload(file, { endpoint: 'https://.baas.arianet.app/storage/v1/upload/resumable', headers: { authorization: `Bearer ${accessToken}`, apikey: ANON_KEY, 'x-upsert': 'true' }, metadata: { bucketName: 'videos', objectName: `${userId}/intro.mp4`, contentType: 'video/mp4' }, chunkSize: 6 * 1024 * 1024, onProgress: (sent, total) => console.log(Math.round((sent / total) * 100) + '%'), }) upload.start() ``` - Metadata: `bucketName`, `objectName`, `contentType`, `cacheControl` and `metadata` (JSON). - Policies, the Bucket's file size and type limits and the Plan's quota are checked when the upload starts, and Policies again when it finishes. - An upload is valid for 24 hours and only whoever started it can continue it. ## Image transformation {#image-transformation} Resize or crop an image on download, without storing separate copies: ``` GET /storage/v1/render/image/public//?width=400&height=400&resize=cover&quality=75 GET /storage/v1/render/image/authenticated//?width=200 (with a token, per Policy) ``` | Parameter | Value | |---|---| | `width`, `height` | 1 to 2500 pixels; with only one of them the aspect ratio is kept | | `resize` | `cover` (crop to fill the box), `contain` (fit inside the box), `fill` (stretch) | | `quality` | 20 to 100, default 80 | - Input JPEG, PNG, GIF (first frame only) and WebP; output JPEG or PNG (a transparent image stays PNG). - The source image is at most 25 MB and 25 megapixels. Results are cached. - **Signed URL with a transformation:** pass `transform` to `POST /storage/v1/object/sign//` (such as `{"expiresIn": 3600, "transform": {"width": 200}}`); the link opens only the transformed version, not the original file. - Whether image transformation is available depends on the Plan; without it the answer is `403 FeatureNotEnabled`. ## S3 access {#s3} `https://.baas.arianet.app/storage/v1/s3` is an S3-compatible endpoint (path-style, any Region name accepted, Signature Version 4). Create a key in the [S3 access](https://docs.ariaservice.net/en/baas/storage#s3) tab. ```bash export AWS_ACCESS_KEY_ID= AWS_SECRET_ACCESS_KEY= aws s3 cp ./report.pdf s3://documents/2026/report.pdf --endpoint-url https://.baas.arianet.app/storage/v1/s3 ``` - S3 requests run with the Service Key's access and **bypass Policies**; Bucket limits, the Plan's file size and the quota still apply. A key works only for its own Project. - Supported: list, create (private) and delete empty Buckets; list, upload, copy, download (with Range) and delete files; batch delete; and multipart uploads (at most 7 days). ACLs, tagging and versioning are not supported (`501`). --- title: "CLI: the arianet baas commands" description: "The arianet baas commands of the Arianet CLI - manage Projects and keys, run SQL, migrations with db push, db pull and db diff, link, generate TypeScript types, Edge Functions, environment variables, Storage, Auth Users, Logs and Usage." url: https://docs.ariaservice.net/en/baas/cli markdown: https://docs.ariaservice.net/en/baas/cli.md language: en --- # 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. This guide is for **CLI v0.10.0** and later (update older versions with `arianet upgrade`). Every command and flag, regenerated with each release, is in the [`arianet baas` reference](../cli-reference/baas.md). Installing and signing in are covered in the [CLI guide](../cli.md). - The commands call `https://api.ariaservice.net/baas/v1` with your [API token](../authentication.md). The permissions each command needs are listed under [Security: token permissions](https://docs.ariaservice.net/en/baas/security#token-scopes). - `` is the Project's numeric id (the `ID` column of `arianet baas projects list`), not its `ref`. - Every command accepts `-o json` for JSON output. ## Plans and Projects {#projects} ```bash arianet baas plans # Plans and their limits arianet baas projects list arianet baas projects get # ref, state, Endpoint arianet baas projects create --name shop --plan --wait arianet baas projects rename --name "My shop" arianet baas projects pause arianet baas projects resume arianet baas projects plan arianet baas projects delete --confirm arianet baas actions list | get | wait # running operations (create, pause, …) ``` `--wait` waits until the Database is created. A Project is only deleted with `--confirm` and that Project's `ref`. ## Keys {#keys} ```bash arianet baas keys list # previews only arianet baas keys reveal anon # anon | service | publishable | secret | database arianet baas keys rotate # 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](https://docs.ariaservice.net/en/baas/api-keys#rotate) ## Your app's environment {#env} ```bash arianet baas env > .env.local arianet baas env --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 {#sql} ```bash arianet baas sql "select id, title from todos limit 5" arianet baas sql -f seed.sql cat report.sql | arianet baas sql -f - --read-only --json ``` Like the [SQL Editor](https://docs.ariaservice.net/en/baas/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 {#migrations} ```bash arianet baas db push # the migrations/*.sql files arianet baas db push --dir db/migrations --dry-run arianet baas db pull # current schema to migrations/_remote_schema.sql arianet baas db pull --file - > schema.sql ``` - `db push` applies every `*.sql` file of `--dir` (default `migrations`) not applied yet, in name order. Start file names with a timestamp, such as `20261121093000_create_todos.sql`. - Each file runs in its own transaction together with its record in the `baas_cli.migrations` Table (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 contain `BEGIN` or `COMMIT`. - `db pull` writes one Schema (default `public`) 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-applied` records the snapshot as applied in that Project so `db push` does not run it again. ## TypeScript types {#types} ```bash arianet baas types --lang ts > src/database.types.ts arianet baas types --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 {#storage} ```bash arianet baas storage buckets arianet baas storage buckets create --name avatars [--public] [--size-limit 5242880] [--types image/png,image/jpeg] arianet baas storage buckets empty avatars arianet baas storage buckets delete avatars arianet baas storage ls avatars [users/42/] arianet baas storage upload avatars ./me.png users/42/me.png [--upsert] [--content-type image/png] arianet baas storage download avatars users/42/me.png [local-file | -] arianet baas storage rm avatars users/42/me.png [more paths…] [-y] ``` ## Auth Users {#auth-users} ```bash arianet baas auth users list [--search ali] [--page 2 --per-page 100] arianet baas auth users get arianet baas auth users create --email ali@example.com --password 'S3cret-pass' --email-confirm arianet baas auth users delete ``` ## Logs and Usage {#logs} ```bash arianet baas logs --since 1h arianet baas logs --source rest --status 5 --search /todos arianet baas usage ``` `--source`: `gateway`, `auth`, `storage`, `rest` or `sql`. `--status`: `2`, `3`, `4` or `5`. Logs are kept for 7 days ([Logs](https://docs.ariaservice.net/en/baas/logs)). ## link: tie a directory to a Project {#link} ```bash arianet baas link # link this directory to a Project arianet baas db push # no : 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 `` first works on the linked Project without it (an explicit id still wins). The file holds no secret and can be committed. The default directory of migration files is `arianet/migrations`. ## migration and db diff {#migration-diff} ```bash arianet baas migration new create_orders # an empty arianet/migrations/_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. `db pull` writes Views, Functions and Enums too. ## gen types {#gen-types} ```bash 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](#types)) under a new name; `types` keeps working. ## Sites {#sites} ```bash npm run build && arianet baas sites deploy ./dist --site shop --create arianet baas sites list arianet baas sites rollback --site shop arianet baas sites update shop --spa-fallback ``` Guide: [Sites](https://docs.ariaservice.net/en/baas/sites). Reference: [`arianet baas sites`](../cli-reference/baas.md#arianet-baas-sites). ## Git and push {#git} ```bash arianet baas git connect --provider github --repo acme/shop --token-file token.txt --site shop arianet baas git deployments arianet baas git logs --follow arianet baas git promote arianet baas push --dry-run # this directory's backend without git: migrations, config.toml, functions arianet baas push ``` Guide: [Git and Deploy](https://docs.ariaservice.net/en/baas/git) and [`arianet baas push`](https://docs.ariaservice.net/en/baas/git#push). Reference: [`arianet baas git`](../cli-reference/baas.md#arianet-baas-git) and [`arianet baas push`](../cli-reference/baas.md#arianet-baas-push). ## Edge Functions, Advisors, Domains, transfer and API settings {#more} ```bash 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|add|check|remove … arianet baas transfer | transfer list|status|cancel|accept|decline … arianet baas api-settings get|set arianet baas backups list|create|download|restore|pitr … arianet baas cron|queues|webhooks|vault … arianet baas auth settings|providers|hooks|templates|sms … ``` Details in [Edge Functions](https://docs.ariaservice.net/en/baas/functions#cli), [Advisors](https://docs.ariaservice.net/en/baas/platform#advisors), [Custom Domains](https://docs.ariaservice.net/en/baas/platform#custom-domains), [Project transfer](https://docs.ariaservice.net/en/baas/settings#transfer), [API settings](https://docs.ariaservice.net/en/baas/settings#api-settings), [Backups](https://docs.ariaservice.net/en/baas/backups) and [Integrations](https://docs.ariaservice.net/en/baas/integrations). ## AI tools: `arianet mcp` {#mcp} ```bash arianet mcp --products baas # BaaS tools only arianet mcp --read-only # only tools that change nothing ``` `arianet mcp` runs an MCP (Model Context Protocol) server on stdin/stdout, so AI assistants and MCP-capable editors can work with Arianet's APIs, every BaaS action included, with the CLI's token. Add it to your MCP client as a stdio server with the command `arianet` and the argument `mcp`. - Permissions are your token's scopes, and every call is in the account's activity log. - Read tools run at once; anything that creates, changes or deletes asks for your confirmation, and anything that costs money shows the price first. Secrets are redacted in answers. Reference: [`arianet mcp`](../cli-reference/mcp.md). ## Calling the API directly For anything without its own command, `arianet baas api ` sends any request with your token to `https://api.ariaservice.net/baas/v1` and prints the answer as JSON: ```bash arianet baas api GET /projects//usage ``` --- title: "Security and best practices" description: "Arianet BaaS security - never ship the Service Key in client code, always keep RLS on, how key rotation works, the baas:* permissions of Arianet API tokens and other hardening tips." url: https://docs.ariaservice.net/en/baas/security markdown: https://docs.ariaservice.net/en/baas/security.md language: en --- # Security and best practices In Arianet BaaS your client app (browser or mobile) talks to the Database directly. That is safe as long as you follow two rules: **the Service Key never reaches the client** and **RLS is on for every Table**. ## Never ship the Service Key in client code {#service-key} | Key | Where it may go | |---|---| | Anon Key / Publishable Key | Browser code, mobile apps, anywhere public. It is not a secret; RLS protects the data. | | Service Key / Secret Key | Servers, server-side functions and CI secrets only. | The Service Key bypasses RLS and has full access to every Row, file and User. If it lands in a JavaScript bundle, a mobile app or a public repository, anyone can read and wipe all your data. - Keep it only in server environment variables, and put `.env` files in `.gitignore`. - In front-end frameworks, variables with a public prefix (`NEXT_PUBLIC_`, `VITE_`, `NUXT_PUBLIC_`, `EXPO_PUBLIC_`) are built into browser code; never define the Service Key with these prefixes. - If you think the Service Key leaked, [rotate the keys](https://docs.ariaservice.net/en/baas/api-keys#rotate) at once. ## Always keep RLS on {#rls} - The Table Editor creates every new Table with **RLS on**. A Table with RLS off has a red open-lock icon and a warning. - A Table you create with SQL has no RLS until you turn it on. Always add straight away: ```sql alter table public.my_table enable row level security; ``` - RLS on with no Policy means the API returns no Rows (the safest state). Then open exactly the access you need with Policies ([Policy templates](https://docs.ariaservice.net/en/baas/table-editor#policy-templates)). - For write commands, add `WITH CHECK` as well as `USING`, so a User cannot write a Row in someone else's name. - Do not trust `user_metadata` in a Policy; the User can change it. For roles use `app_metadata` (only a server changes it) or a separate Table. - `security definer` Functions bypass RLS; in them `set search_path = ''` and check the caller with `auth.uid()`. - Files need Policies too: [RLS on files](https://docs.ariaservice.net/en/baas/storage-api#storage-rls). Never put personal data in a public Bucket. Before releasing your app, send a `GET` to each Table with the Anon Key and no token, and make sure nothing comes back that should not. ## How key rotation works {#key-rotation} [Key rotation](https://docs.ariaservice.net/en/baas/api-keys#rotate) replaces the Project's signing key and its Anon and Service Keys: 1. The new keys are created and active at once. 2. The previous keys stay "retiring" for **72 hours** and are still accepted; replace them in every app, server and CI job in that time. 3. After 72 hours the previous keys are revoked (`401 invalid_api_key`) and tokens signed with the previous key are no longer accepted. Your app's users are not signed out: their session is signed with the new key when it refreshes. The Publishable Key and Secret Key do not change with rotation. Rotating again during an overlap revokes the previous retiring keys at once. ## Arianet API token permissions (`baas:*`) {#token-scopes} For the [CLI](https://docs.ariaservice.net/en/cli) and the management API (`https://api.ariaservice.net/baas/v1`), create an [Arianet API token](../authentication.md) with only the permissions it needs. This token is different from a Project's keys: the token manages Projects, the keys reach one Project's data. | Scope | Allows | |---|---| | `baas:projects:read` | Viewing Projects, Plans, Usage, Logs, Database structure, Users and files | | `baas:projects:manage` | Creating, renaming, pausing and resuming, changing the Plan, deleting Projects and changing Auth settings | | `baas:keys:manage` | Revealing and rotating keys and the Database password (and `arianet baas env`) | | `baas:sql:execute` | Running SQL, changing Table structure and Policies, writing Rows, `db push` | | `baas:storage:manage` | Creating and deleting Buckets, uploading and deleting files | | `baas:auth-users:manage` | Creating, changing and deleting Auth Users | | `baas:functions:manage` | Creating, deploying, testing and deleting Edge Functions and their secrets | | `baas:sites:manage` | Creating, deploying, rolling back and deleting [Sites](https://docs.ariaservice.net/en/baas/sites) (adding a Site's domain also needs `baas:projects:manage`) | | `baas:git:manage` | Connecting, changing and disconnecting the [repository](https://docs.ariaservice.net/en/baas/git), deploy, redeploy, cancel, promote and deleting previews | - For a CI job that only applies migrations, `baas:sql:execute` (plus `baas:projects:read` if needed) is enough. - For team members, set permissions per Project in the panel's team section. - Every management action, key reveal and SQL run is recorded in your account's activity log (the SQL text and keys are never recorded). ## More tips - **Sign-ups:** if your app has no public sign-up, turn on "New sign-ups closed" in the [Auth settings](https://docs.ariaservice.net/en/cli-reference/auth#settings). Do not turn email confirmation off. - **Redirect URLs:** list only your own domains as allowed redirects. - **The direct Database connection** has owner access; guard its password like the Service Key. - **Traffic** is always over HTTPS. --- title: "Arianet BaaS FAQ" description: "Arianet BaaS FAQ - automatic pause of Projects, limits, upgrading the Plan, Backups and moving an existing app by changing the URL and key." url: https://docs.ariaservice.net/en/baas/faq markdown: https://docs.ariaservice.net/en/baas/faq.md language: en --- # Arianet BaaS FAQ ## Why was my Project paused? {#idle-pause} Depending on the Plan, a Project that receives **no request** for a while is paused automatically; the Plan sets how long, and [Settings → Automatic pause schedule](https://docs.ariaservice.net/en/baas/settings#auto-pause) shows it. Its data, Users and files are kept in full. - **The next request wakes it up.** That request gets `503` with code `project_resuming` and a `Retry-After: 5` header, and the Project is ready within a few seconds. Your app only needs to retry after a few seconds. - **Resume Project** in the panel brings it back too. - A Project **you** paused is not woken by requests (`503 project_paused`); resume it from the panel or with `arianet baas projects resume`. ## What happens when I reach a Plan limit? {#limits} You get a notice at 80 % and 100 % of each limit. Whether a limit is hard depends on the Plan and is shown in the panel. When a limit is hard and Egress is used up, every request is refused with `402` until the month ends; when MAU is reached, new sign-ups are refused; when Storage is full, uploads are refused; and when the Database is full, it becomes read-only. Details in [Usage and limits](https://docs.ariaservice.net/en/baas/usage#limits). The usage period is the calendar month in UTC. ## How many Projects can I have? The number of Projects per account is set by the [account quota](https://docs.ariaservice.net/en/baas/quotas) and the Plan's limit; each Plan's limits are shown when creating a project. ## How do I upgrade the Plan? {#upgrade} From **Settings → Change Plan** ([guide](https://docs.ariaservice.net/en/baas/settings#change-plan)) or `arianet baas projects plan `. Upgrading does not move your data; the Endpoint and keys stay the same and the new limits apply at once. ## Is my data backed up? {#backups} Yes. Every Project's Database is **backed up automatically every day**, and you can take a **manual backup** at any time, download it, or restore the Project to a backup. Depending on the Plan, **point-in-time recovery (PITR)** is also available. How long backups are kept and how many you can have depend on the Plan. Details in [Backup and restore](https://docs.ariaservice.net/en/baas/backups). Storage files are not part of the Database backup; keep important files separately (`arianet baas storage download` or [S3 access](https://docs.ariaservice.net/en/baas/storage#s3)). Deleting a Project cannot be undone. ## Can I move my app from another service? {#migrate} If your app uses a client library compatible with Postgres/BaaS, **change the URL and key**: 1. Create a Project. 2. Move the Database structure: apply your migration files with `arianet baas db push`, or run the SQL export in the SQL Editor. Policies written with `auth.uid()`, `auth.jwt()` and the roles `anon`, `authenticated` and `service_role` work unchanged. 3. Move the data with `pg_dump --data-only` from the source and `psql` over the [direct connection](https://docs.ariaservice.net/en/baas/database-settings#direct-connection). 4. In your app, change the URL to `https://.baas.arianet.app` and the key to the new Anon Key (`arianet baas env` prints the variables). 5. To move Users, create them with the Service Key through `/auth/v1/admin/users`; existing bcrypt hashes are kept with the `password_hash` field, so Users sign in with their old passwords. Realtime, Edge Functions, OAuth sign-in, MFA, resumable uploads and image transformation work with the same libraries too. The GraphQL endpoint is not offered yet; if your app depends on it, check before moving. ## Can I install Postgres extensions? Yes, from the list of allowed extensions. Turn them on or off with one click in [Database → Extensions](https://docs.ariaservice.net/en/baas/database#extensions). Extensions outside the list cannot be installed. ## Where is my Database kept? In Region Tehran 1 (`thr-1`), inside Iran. A Project's Region is fixed. ## Is my Project isolated from other Projects? Yes. Each Project has its own Database and logins, and no key, token or connection of one Project reaches another Project's Database. --- title: "Connect AI assistants" description: "Connect Claude, ChatGPT, Cursor, VS Code or any MCP client to your Arianet account with the Arianet MCP server - OAuth sign-in, choosing permissions, approving sensitive and paid actions, deploying sites, BaaS and servers with an assistant, and managing and revoking connections." url: https://docs.ariaservice.net/en/ai-assistants markdown: https://docs.ariaservice.net/en/ai-assistants.md language: en --- # Connect AI assistants With the **Arianet MCP server**, your AI assistant (Claude, ChatGPT, Cursor, VS Code or any MCP-compatible client) works on your Arianet account: it reads the state of your servers, creates BaaS projects, deploys sites, checks logs and runs any other operation of the Arianet API, always with the permissions you chose. Server address: ```text https://mcp.ariaservice.net/mcp ``` - **OAuth sign-in:** you never give the assistant a token or password. When you connect, the Arianet panel's consent page opens; you sign in and choose the account and the permissions. - **Permissions you choose:** the default is "View only" («فقط مشاهده»). You can narrow a connection or revoke it at any time. - **Recorded in the activity log:** everything the assistant does appears in the [account activity log](https://docs.ariaservice.net/en/panel/profile#account-activity-log) marked "via AI assistant" («از طریق دستیار هوش مصنوعی»). > **Prefer to run it on your own computer?** [`arianet mcp`](https://docs.ariaservice.net/en/cli#mcp) in the Arianet CLI runs the same tools as a local (stdio) server with your CLI token. This page is about the remote server, which needs no installation. ## Connecting, per client {#connect} In every client, after you add the address the Arianet panel's consent page opens; its steps are described under [the consent page](#consent). ### Claude (web, desktop and mobile) {#claude} 1. In Claude, go to **Settings → Connectors** and choose **Add custom connector**. 2. Enter a name (for example `Arianet`) and the URL `https://mcp.ariaservice.net/mcp`, then choose **Add**. 3. Choose **Connect** and approve the connection on the Arianet panel page. The Claude mobile app does not add new connectors; a connector you add on the web is available on mobile automatically. ### Claude Code {#claude-code} **Recommended: the Arianet plugin.** It adds the MCP server plus two skills, one for building and deploying apps on [Arianet BaaS](https://docs.ariaservice.net/en/sdk) and one for working with your account. Inside Claude Code run: ```text /plugin marketplace add ariaservice/arianet-ai /plugin install arianet@arianet ``` Or add only the MCP server: ```bash claude mcp add --transport http arianet https://mcp.ariaservice.net/mcp ``` Either way, run `/mcp` in Claude Code, select `arianet` and choose **Authenticate** to open the consent page in your browser. ### ChatGPT {#chatgpt} 1. In ChatGPT, go to **Settings → Plugins**, choose **Add**, then **Add custom MCP server**. 2. Enter the URL `https://mcp.ariaservice.net/mcp` and set authentication to OAuth. 3. Approve the connection on the Arianet panel page. Depending on your ChatGPT plan, you may first need to turn on **developer mode** in the settings for the custom MCP server option to appear. ### Cursor {#cursor} **One click:** [Add Arianet to Cursor](https://cursor.com/en/install-mcp?name=arianet&config=eyJ1cmwiOiJodHRwczovL21jcC5hcmlhc2VydmljZS5uZXQvbWNwIn0%3D). Cursor opens and asks you to confirm. Or put this in `~/.cursor/mcp.json` (all projects) or `.cursor/mcp.json` (one project): ```json { "mcpServers": { "arianet": { "url": "https://mcp.ariaservice.net/mcp" } } } ``` Then sign in on `arianet` in Cursor's MCP settings. ### VS Code {#vscode} **One click:** [Install in VS Code](https://vscode.dev/redirect/mcp/install?name=arianet&config=%7B%22type%22%3A%22http%22%2C%22url%22%3A%22https%3A%2F%2Fmcp.ariaservice.net%2Fmcp%22%7D) · [Install in VS Code Insiders](https://insiders.vscode.dev/redirect/mcp/install?name=arianet&config=%7B%22type%22%3A%22http%22%2C%22url%22%3A%22https%3A%2F%2Fmcp.ariaservice.net%2Fmcp%22%7D&quality=insiders). Or run **MCP: Add Server** from the Command Palette, choose **HTTP** and enter `https://mcp.ariaservice.net/mcp`. Or create `.vscode/mcp.json` in your project: ```json { "servers": { "arianet": { "type": "http", "url": "https://mcp.ariaservice.net/mcp" } } } ``` The first time the assistant uses the server, VS Code asks you to sign in to Arianet. ### Gemini CLI {#gemini-cli} Install the Arianet extension (MCP server plus context about Arianet and BaaS): ```bash gemini extensions install https://github.com/ariaservice/arianet-ai ``` Then run `/mcp auth arianet` in Gemini CLI to open the consent page. ### Windsurf {#windsurf} In Cascade, open the MCP config file (**Open MCP config file**) and add: ```json { "mcpServers": { "arianet": { "serverUrl": "https://mcp.ariaservice.net/mcp" } } } ``` Then sign in on `arianet` in Windsurf's MCP settings. ### Codex CLI {#codex} ```bash codex mcp add arianet --url https://mcp.ariaservice.net/mcp codex mcp login arianet ``` ### Other clients {#other-clients} Any client that supports MCP over **Streamable HTTP** with OAuth sign-in can connect; just give it `https://mcp.ariaservice.net/mcp`. Client registration is automatic, so no client ID or secret is needed. The plugin, the extension and these install links are maintained in the public repository [github.com/ariaservice/arianet-ai](https://github.com/ariaservice/arianet-ai). ## The consent page: account and permissions {#consent} The "Request to connect to your Arianet account" page opens on the Arianet panel and shows the name of the application asking to connect. If you did not start this connection yourself, choose "Deny" («رد»). The page is described in full in the [panel guide](https://docs.ariaservice.net/en/panel/profile#allowing-an-assistant). 1. **Account:** choose your personal account or the organisation account the assistant should work on. 2. **Access level:** choose one of: | Level | What the assistant does | |---|---| | **View only** («فقط مشاهده», default) | Only looks; changes nothing. | | **Development and deployment** («توسعه و استقرار») | Creates, deploys and manages (sites, BaaS projects, servers). | | **Full management** («مدیریت کامل») | Everything on the account except managing tokens. | | **Custom** («سفارشی») | You pick each permission yourself. | You decide the level; you can grant less or more than the application asked for. Creating API tokens or granting access to another application is never given to an assistant. 3. **Allow orders and payments** («اجازهٔ سفارش و پرداخت»): off by default, which means the assistant cannot buy anything that costs money. If you turn it on, you also set a **daily spending cap** (default 1,000,000 Toman). 4. For any level above "View only", or with payments allowed, you must re-enter your **password or authenticator app code**. 5. Choose "Approve and connect" («تأیید و اتصال»); the browser returns to your AI client and the connection is ready. At the bottom, the page lists what the assistant can never do: see your password or sign-in codes, read the passwords and private keys of your services, create API tokens, access your other accounts, or spend more than the daily cap. ## Four safety tiers {#safety} Every tool belongs to one of four tiers, and the Arianet server enforces that tier's rule whatever the assistant says: 1. **Reading:** listing servers, deployment status, logs and costs run directly. 2. **Ordinary changes:** such as deploying a new version of a site. They run; your AI client usually asks you first. 3. **Destructive actions:** such as running migrations on a database, rolling a site back, powering off or rebooting a server, and deleting things. The assistant must show you the exact action and get your explicit yes: the server issues a one-time confirmation that is valid for **10 minutes** and bound to exactly those arguments; if anything changes, a new confirmation is needed. Clients that support MCP confirmation dialogs show a confirmation dialog instead. 4. **Paid or irreversible actions:** such as creating a BaaS project, ordering a server, and deleting a server or project. These are approved only by you **in the Arianet panel**, never in the chat. The assistant gives you a link like: ```text https://panel.ariaservice.net/users/ai-connections/approvals/ ``` The page shows exactly which action was requested, with what details and **at what price**. Choose approve or deny and return to the chat; after you approve, the assistant runs exactly that action once. A request that is not approved in time expires and nothing happens. - If **Allow orders and payments** is off, paid actions are refused. - The daily spending cap is counted per connection, per day in Tehran time. - Pending approvals are also listed on the panel's AI connections page. ## The assistant's tools {#tools} ### Task tools {#task-tools} | Tool | What it does | |---|---| | `create_baas_project` | Creates an [Arianet BaaS](https://docs.ariaservice.net/en/sdk) project (approved in the panel) and returns its endpoint and public `anon` key. The `service_role` key is never given to the assistant; get it from the panel. | | `run_baas_migrations` | Runs migrations on the project's database. It is a dry run by default, showing only what would change. | | `deploy_site` | Deploys a site from a Git repository or by uploading files (up to 10 MB). A GitHub repository needs the Arianet GitHub App installed on it; if it is missing, the assistant gives you the install link. | | `deploy_status` | Shows the state of a deployment. | | `get_logs` | Reads build and runtime logs. | | `rollback_site` | Rolls a site back to an earlier deployment. | | `create_server` | Orders a server: first the quote, then your approval in the panel, then creation and progress reports. | | `server_power` | Powers a server on or off, or reboots it. | ### The whole API {#api-tools} - `search_api` and `describe_api`: find the right operation in the Arianet API and describe its inputs. - `call_api`: runs any API operation within the connection's permissions; the same four safety tiers apply. - `whoami`: shows the account and permissions of the current connection. - `account_overview`: a summary of the account, its services and balance. - `estimate_cost`: estimates the cost before an order. ## Example: git-push deploys from your phone {#git-push-deploy} With Claude Code on your phone (or any other client) you can update a site without a computer: 1. Once, ask the assistant to connect the repository to your site with `deploy_site`, for example: "Connect my GitHub repository to the shop site and deploy from the main branch". If the Arianet GitHub App is not installed, the assistant gives you the install link. 2. From then on, every push to the production branch deploys automatically. 3. After a push, ask "What happened to the last deployment?" and the assistant answers with `deploy_status`, or "If it failed, read the logs and tell me why" and it checks with `get_logs`. 4. If the new version is broken, go back to the previous one with `rollback_site` (this needs your explicit confirmation). ## Security and managing connections {#manage} - **Secrets never reach the assistant:** passwords, sign-in codes, private keys and service secrets are never shown to assistants and are removed from responses. - In the panel, open **AI connections** («اتصال‌های هوش مصنوعی», `/users/ai-connections`). For each connection you see the account, permissions, orders-and-payments setting, creation time and last use, and you can: - reduce its permissions; - turn orders and payments off or lower the daily cap; - **Revoke** («قطع اتصال») it, which ends that application's access immediately. - A connection can only be narrowed. For more access, or to allow payments again, revoke it and connect again. - Assistants' activity («فعالیت‌های دستیارها») on the same page opens the [account activity log](https://docs.ariaservice.net/en/panel/profile#account-activity-log) filtered to what assistants did. If you do not recognise an action, revoke that connection. - Changing or resetting your password **revokes every AI connection automatically**; connect again afterwards. ## Troubleshooting {#troubleshooting} | Problem | Fix | |---|---| | `401` or "unauthorized" | The connection expired or was revoked (for example after a password change). Sign in again in the client, or remove the connector and add it again. | | The assistant says it lacks a permission (scope) | Connect again and choose a wider level on the consent page, such as "Development and deployment" or "Custom" with the permission you need. | | A paid action is refused | Orders and payments are off, or the daily cap is used up. Revoke the connection and connect again with payments allowed, or wait for the next day (Tehran time). | | An identity verification message | Managing services needs a [verified account identity](https://docs.ariaservice.net/en/panel/identity); once verified, ask the assistant again. | --- title: "arianet baas" description: "arianet baas command reference: Manage BaaS projects: database, SQL, migrations, keys, storage, auth, edge functions, sites, realtime, cron, backups" url: https://docs.ariaservice.net/en/cli-reference/baas markdown: https://docs.ariaservice.net/en/cli-reference/baas.md language: en --- {/* Generated by `arianet docs gen` from the CLI's command tree. Do not edit by hand: change the CLI's help text instead. */} # arianet baas This reference is generated from the CLI's own help on every release, so it always matches the latest `arianet`. The command help is the same text `arianet --help` prints. For installation, configuration and a guided start, see the [CLI page](../cli.md). The [global flags](https://docs.ariaservice.net/en/cli-reference/#global-flags) work with every command on this page. ## `arianet baas` {#arianet-baas} Manage BaaS projects: database, SQL, migrations, keys, storage, auth, edge functions, sites, realtime, cron, backups Arianet BaaS: each project is a PostgreSQL database with a public endpoint (REST, auth, storage, realtime) and its keys. Create and manage projects, run SQL, manage tables and the database's objects, apply migrations from files, generate TypeScript types, configure auth, deploy edge functions and static sites, deploy from a GitHub or GitLab repository, schedule Cron jobs, queues and webhooks, keep secrets in the Vault, back up and restore, and print the environment your app needs. Every action of the console has a command here. Run arianet baas link in your app's directory once: the project ID, the first argument of the project commands, can then be left out there. Migration files live in arianet/migrations. Projects run in region thr-1. The commands call /baas/v1 on the API host with your API token. Token scopes: baas\:projects\:read (reads, incl. migration list, db pull and diff, gen types, advisors, logs, reports), baas\:projects\:manage (create, rename, move, delete, pause, resume, plan, domains, transfer, api-settings set, auth settings, providers, hooks, secrets and templates, db settings, backups and restores), baas\:keys\:manage (keys reveal and rotate, env, vault, db password reset), baas\:sql\:execute (sql, db push, db pull --mark-applied, tables, db schemas/enums/functions/triggers/views/extensions, import, cron, queues, webhooks, snippets), baas\:storage\:manage (storage writes, policies, S3 keys), baas\:auth-users\:manage (auth users changes, sessions, factors), baas\:functions\:manage (functions deploy, delete, download, source, invoke, config and secrets changes), baas\:sites\:manage (sites create, update, delete, deploy, rollback, deployments delete; sites domains add needs baas\:projects\:manage), baas\:git\:manage (git connect, update, disconnect, deploy, redeploy, cancel, promote, previews rm) (a token without scopes may do everything). --region picks a regional install (default: the product's default region). Add -o json to print the service's answer as is. **Token scopes:** baas\:projects\:read (reads, incl. migration list, db pull and diff, gen types, advisors, logs, reports), baas\:projects\:manage (create, rename, move, delete, pause, resume, plan, domains, transfer, api-settings set, auth settings, providers, hooks, secrets and templates, db settings, backups and restores), baas\:keys\:manage (keys reveal and rotate, env, vault, db password reset), baas\:sql\:execute (sql, db push, db pull --mark-applied, tables, db schemas/enums/functions/triggers/views/extensions, import, cron, queues, webhooks, snippets), baas\:storage\:manage (storage writes, policies, S3 keys), baas\:auth-users\:manage (auth users changes, sessions, factors), baas\:functions\:manage (functions deploy, delete, download, source, invoke, config and secrets changes), baas\:sites\:manage (sites create, update, delete, deploy, rollback, deployments delete; sites domains add needs baas\:projects\:manage), baas\:git\:manage (git connect, update, disconnect, deploy, redeploy, cancel, promote, previews rm) **Usage** ```text arianet baas ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--region` | `string` | | regional install to call, e.g. iran-1 (default: the product's default region) | **Subcommands** - [`actions`](#arianet-baas-actions): Follow asynchronous operations (actions) - [`advisors`](#arianet-baas-advisors): Show the security and performance findings of the database (--run checks now) - [`api`](#arianet-baas-api): Send any request to the /baas/v1 API and print the answer as JSON - [`api-settings`](#arianet-baas-api-settings): Show or change the REST row limit and the JWT expiry - [`auth`](#arianet-baas-auth): The project's end-user authentication: users, settings, providers, hooks, templates, logs - [`backups`](#arianet-baas-backups): Backups of the project's database, restore and point-in-time restore - [`cron`](#arianet-baas-cron): Run SQL or call a URL on a schedule (Cron jobs) - [`db`](#arianet-baas-db): Migrations (push, pull, diff) and the database: settings, schemas, extensions, enums, functions, triggers, views, import, export - [`domains`](#arianet-baas-domains): Serve the project at your own hostname (paid plans) - [`env`](#arianet-baas-env): Print the URL and anon key your app needs, as .env lines or JSON - [`functions`](#arianet-baas-functions): Write, run, deploy and manage the project's edge functions - [`gen`](#arianet-baas-gen): Generate code from the project's database - [`git`](#arianet-baas-git): Deploy from a GitHub or GitLab repository: connect, deployments, logs, previews, promote - [`keys`](#arianet-baas-keys): Show, reveal and rotate a project's keys - [`link`](#arianet-baas-link): Link this directory to a project, so the project ID can be left out here - [`logs`](#arianet-baas-logs): Show the project's request logs (last 7 days) and SQL editor runs - [`migration`](#arianet-baas-migration): Create migration files and compare them with what the project applied - [`plans`](#arianet-baas-plans): List the plans and their limits - [`projects`](#arianet-baas-projects): Create and manage projects - [`push`](#arianet-baas-push): Apply the backend of a directory: migrations, config.toml and functions (what a git deploy does) - [`queues`](#arianet-baas-queues): Message queues in the database - [`realtime`](#arianet-baas-realtime): The realtime endpoint and the tables whose changes it sends - [`reports`](#arianet-baas-reports): Show the API, auth, storage and database report over a range - [`sites`](#arianet-baas-sites): Host static and single-page sites: deploy a build directory, roll back, custom domains - [`snippets`](#arianet-baas-snippets): SQL snippets saved with the project (the SQL editor's) - [`sql`](#arianet-baas-sql): Run SQL as the project's owner (one transaction) and print the result - [`storage`](#arianet-baas-storage): Manage the project's buckets, files, storage policies and S3 keys - [`tables`](#arianet-baas-tables): Create, change and drop tables, their columns, indexes, policies and rows - [`transfer`](#arianet-baas-transfer): Move a project to another Arianet account (it accepts within 7 days) - [`types`](#arianet-baas-types): Alias of gen types: generate TypeScript types of the database - [`unlink`](#arianet-baas-unlink): Remove this directory's project link - [`usage`](#arianet-baas-usage): Show this month's use against the plan - [`vault`](#arianet-baas-vault): Secrets stored encrypted with the project's own key, readable from your SQL - [`webhooks`](#arianet-baas-webhooks): Database Webhooks: POST a table's inserts, updates and deletes to a URL ## `arianet baas actions` {#arianet-baas-actions} Follow asynchronous operations (actions) **Usage** ```text arianet baas actions ``` **Aliases:** `action` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) **Subcommands** - [`get`](#arianet-baas-actions-get): Show one operation - [`list`](#arianet-baas-actions-list): List your latest operations - [`wait`](#arianet-baas-actions-wait): Wait until operations finish; exits non-zero if one fails or the timeout passes ## `arianet baas actions get` {#arianet-baas-actions-get} Show one operation **Usage** ```text arianet baas actions get [flags] ``` **Examples** ```bash arianet baas actions get 812 ``` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas actions list` {#arianet-baas-actions-list} List your latest operations **Usage** ```text arianet baas actions list [flags] ``` **Aliases:** `ls` **Examples** ```bash arianet baas actions list --limit 20 ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--limit` | `string` | | at most this many | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas actions wait` {#arianet-baas-actions-wait} Wait until operations finish; exits non-zero if one fails or the timeout passes **Usage** ```text arianet baas actions wait [...] [flags] ``` **Examples** ```bash arianet baas actions wait 812 813 --timeout 10m ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--timeout` | `duration` | `15m0s` | how long to wait | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas advisors` {#arianet-baas-advisors} Show the security and performance findings of the database (--run checks now) Show what the security and performance advisors found in the project's database: tables without row level security, policies that allow everything, exposed security definer functions, unindexed foreign keys, duplicate indexes and more, each with its level (ERROR, WARN, INFO) and how to fix it. The checks run daily; --run runs them now. **Usage** ```text arianet baas advisors [project-id] [flags] ``` **Aliases:** `advisor`, `lint` **Examples** ```bash arianet baas advisors arianet baas advisors 12 --kind security --run --details ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--details` | `bool` | | print each finding's fix and SQL | | `--kind` | `string` | | only security or performance findings | | `--run` | `bool` | | run the checks now (rate limited) instead of showing the last run | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas api` {#arianet-baas-api} Send any request to the /baas/v1 API and print the answer as JSON **Usage** ```text arianet baas api [flags] ``` **Examples** ```bash arianet baas api GET /openapi.json arianet baas api POST /some/path --data '{"key":"value"}' ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--data` | `string` | | the JSON request body | | `--file` | `string` | | read the JSON request body from this file | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas api-settings` {#arianet-baas-api-settings} Show or change the REST row limit and the JWT expiry **Usage** ```text arianet baas api-settings ``` **Aliases:** `api-setting` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) **Subcommands** - [`get`](#arianet-baas-api-settings-get): Show the API settings - [`set`](#arianet-baas-api-settings-set): Change the API settings ## `arianet baas api-settings get` {#arianet-baas-api-settings-get} Show the API settings **Usage** ```text arianet baas api-settings get [project-id] [flags] ``` **Aliases:** `show` **Examples** ```bash arianet baas api-settings get 12 ``` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas api-settings set` {#arianet-baas-api-settings-set} Change the API settings **Usage** ```text arianet baas api-settings set [project-id] [flags] ``` **Examples** ```bash arianet baas api-settings set --max-rows 500 --jwt-expiry 7200 ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--jwt-expiry` | `int64` | | lifetime of issued access tokens in seconds (300-604800) | | `--max-rows` | `int64` | | most rows one REST request returns (1-100000) | | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--wait` | `bool` | | wait until the operation finishes | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas auth` {#arianet-baas-auth} The project's end-user authentication: users, settings, providers, hooks, templates, logs **Usage** ```text arianet baas auth ``` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) **Subcommands** - [`audit`](#arianet-baas-auth-audit): Show the auth events (sign-ins, sign-ups, token refreshes...), newest first - [`hooks`](#arianet-baas-auth-hooks): Auth hooks: custom access token claims, send email or SMS yourself, verification attempts - [`providers`](#arianet-baas-auth-providers): External sign-in providers (OAuth / OpenID Connect) - [`secrets`](#arianet-baas-auth-secrets): Secrets of the auth configuration: provider:\, smtp, captcha, hook:\ - [`settings`](#arianet-baas-auth-settings): Show or change how the project's auth treats its users - [`sms`](#arianet-baas-auth-sms): Show the SMS log: each code sent, its delivery state, line and operator - [`smtp`](#arianet-baas-auth-smtp): Your own SMTP server (set it with auth settings set --smtp-\*) - [`templates`](#arianet-baas-auth-templates): The emails auth sends: confirm sign-up, invite, magic link, recovery, email change - [`users`](#arianet-baas-auth-users): Manage the project's end users ## `arianet baas auth audit` {#arianet-baas-auth-audit} Show the auth events (sign-ins, sign-ups, token refreshes...), newest first **Usage** ```text arianet baas auth audit [project-id] [flags] ``` **Examples** ```bash arianet baas auth audit 12 --action login --from 2026-11-01T00:00:00Z arianet baas auth audit 12 --search ana@example.com ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--action` | `string` | | only this action, e.g. login | | `--actor` | `string` | | only this user's | | `--from` | `string` | | only after this time (RFC 3339) | | `--ip` | `string` | | only from this address | | `--page` | `string` | | page number | | `--per-page` | `string` | | entries per page | | `--search` | `string` | | search the entries | | `--to` | `string` | | only before this time (RFC 3339) | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas auth hooks` {#arianet-baas-auth-hooks} Auth hooks: custom access token claims, send email or SMS yourself, verification attempts **Usage** ```text arianet baas auth hooks ``` **Aliases:** `hook` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) **Subcommands** - [`disable`](#arianet-baas-auth-hooks-disable): Turn a hook off - [`list`](#arianet-baas-auth-hooks-list): List the hooks and which are on - [`set`](#arianet-baas-auth-hooks-set): Point an auth hook at a database function or an https URL ## `arianet baas auth hooks disable` {#arianet-baas-auth-hooks-disable} Turn a hook off **Usage** ```text arianet baas auth hooks disable [project-id] [flags] ``` **Examples** ```bash arianet baas auth hooks disable 12 custom_access_token ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--wait` | `bool` | | wait until the operation finishes | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas auth hooks list` {#arianet-baas-auth-hooks-list} List the hooks and which are on **Usage** ```text arianet baas auth hooks list [project-id] [flags] ``` **Aliases:** `ls` **Examples** ```bash arianet baas auth hooks list 12 ``` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas auth hooks set` {#arianet-baas-auth-hooks-set} Point an auth hook at a database function or an https URL **Usage** ```text arianet baas auth hooks set [project-id] [flags] ``` **Examples** ```bash arianet baas auth hooks set 12 custom_access_token --enabled --uri pg-functions://postgres/public/access_token_hook arianet baas auth hooks set 12 send_email --enabled --uri https://example.com/hooks/email --generate-secret ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--enabled` | `bool` | | the hook runs | | `--generate-secret` | `bool` | | make a new signing secret for an https hook and show it once | | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--uri` | `string` | | pg-functions://postgres/\/\ or an https:// URL | | `--wait` | `bool` | | wait until the operation finishes | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas auth providers` {#arianet-baas-auth-providers} External sign-in providers (OAuth / OpenID Connect) **Usage** ```text arianet baas auth providers ``` **Aliases:** `provider` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) **Subcommands** - [`disable`](#arianet-baas-auth-providers-disable): Turn a provider off - [`list`](#arianet-baas-auth-providers-list): List the providers and which are on - [`set`](#arianet-baas-auth-providers-set): Turn on or change an external sign-in provider (e.g. google, github, custom:\) ## `arianet baas auth providers disable` {#arianet-baas-auth-providers-disable} Turn a provider off **Usage** ```text arianet baas auth providers disable [project-id] [flags] ``` **Examples** ```bash arianet baas auth providers disable 12 custom:corp ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--wait` | `bool` | | wait until the operation finishes | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas auth providers list` {#arianet-baas-auth-providers-list} List the providers and which are on **Usage** ```text arianet baas auth providers list [project-id] [flags] ``` **Aliases:** `ls` **Examples** ```bash arianet baas auth providers list 12 ``` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas auth providers set` {#arianet-baas-auth-providers-set} Turn on or change an external sign-in provider (e.g. google, github, custom:\) **Usage** ```text arianet baas auth providers set [project-id] [flags] ``` **Examples** ```bash arianet baas auth providers set 12 google --enabled --client-id 123.apps.example --secret-file ./google.secret arianet baas auth providers set 12 custom:corp --enabled --client-id cli --url https://id.example.com --scopes "openid email" ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--additional-client-id` | `stringArray` | | more accepted client IDs (replaces the list) (repeatable, or comma separated) | | `--client-id` | `string` | | the OAuth client ID | | `--enabled` | `bool` | | sign-in with it is on | | `--name` | `string` | | the name shown for a custom provider | | `--scopes` | `string` | | extra scopes, space separated | | `--secret-file` | `string` | | read the client secret from this file (- for standard input); stored sealed | | `--skip-nonce-check` | `bool` | | accept ID tokens without a nonce | | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--url` | `string` | | the issuer URL (custom providers; optional for gitlab and azure) | | `--wait` | `bool` | | wait until the operation finishes | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas auth secrets` {#arianet-baas-auth-secrets} Secrets of the auth configuration: provider:\, smtp, captcha, hook:\ **Usage** ```text arianet baas auth secrets ``` **Aliases:** `secret` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) **Subcommands** - [`set`](#arianet-baas-auth-secrets-set): Set a secret of the auth configuration (sealed; never shown again) - [`unset`](#arianet-baas-auth-secrets-unset): Remove a secret ## `arianet baas auth secrets set` {#arianet-baas-auth-secrets-set} Set a secret of the auth configuration (sealed; never shown again) **Usage** ```text arianet baas auth secrets set [project-id] [flags] ``` **Examples** ```bash arianet baas auth secrets set 12 smtp --value-file ./smtp.password arianet baas auth secrets set 12 hook:send_email --generate ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--generate` | `bool` | | make a hook's signing secret and show it once | | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--value` | `string` | | the value (it stays in your shell history; prefer --value-file) | | `--value-file` | `string` | | read the value from this file (- for standard input) | | `--wait` | `bool` | | wait until the operation finishes | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas auth secrets unset` {#arianet-baas-auth-secrets-unset} Remove a secret **Usage** ```text arianet baas auth secrets unset [project-id] [flags] ``` **Aliases:** `delete`, `rm` **Examples** ```bash arianet baas auth secrets unset 12 hook:send_email --yes ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--wait` | `bool` | | wait until the operation finishes | | `-y`, `--yes` | `bool` | | skip the confirmation prompt | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas auth settings` {#arianet-baas-auth-settings} Show or change how the project's auth treats its users **Usage** ```text arianet baas auth settings ``` **Aliases:** `config` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) **Subcommands** - [`get`](#arianet-baas-auth-settings-get): Show the auth settings, providers and hooks - [`set`](#arianet-baas-auth-settings-set): Change auth settings (only the flags given; --file for providers and hooks too) ## `arianet baas auth settings get` {#arianet-baas-auth-settings-get} Show the auth settings, providers and hooks **Usage** ```text arianet baas auth settings get [project-id] [flags] ``` **Aliases:** `show` **Examples** ```bash arianet baas auth settings get 12 arianet baas auth settings get 12 --section mfa -o json ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--section` | `string` | | only general, sessions, mfa, rate_limits, smtp, captcha, providers or hooks | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas auth settings set` {#arianet-baas-auth-settings-set} Change auth settings (only the flags given; --file for providers and hooks too) **Usage** ```text arianet baas auth settings set [project-id] [flags] ``` **Examples** ```bash arianet baas auth settings set 12 --site-url https://shop.example.com --redirect-url https://shop.example.com/* arianet baas auth settings set 12 --disable-signup --mfa-totp-enroll --session-inactivity-timeout 86400 arianet baas auth settings set 12 --rate-emails-per-hour 30 --password-min-length 10 ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--anonymous-enabled` | `bool` | | anonymous sign-ins | | `--app-name` | `string` | | the app's name in messages | | `--captcha-enabled` | `bool` | | check a CAPTCHA on sign-up and sign-in | | `--captcha-provider` | `string` | | hcaptcha or turnstile | | `--captcha-site-key` | `string` | | the CAPTCHA site key (its secret: auth secrets set captcha) | | `--data` | `string` | | the JSON request body; flags given as well override its fields | | `--disable-signup` | `bool` | | refuse new sign-ups | | `--email-confirm-required` | `bool` | | a new email must be confirmed before sign-in | | `--email-enabled` | `bool` | | sign-in with email | | `--file` | `string` | | read the JSON request body from this file | | `--jwt-expiry` | `int64` | | access token lifetime in seconds (300-604800) | | `--language` | `string` | | language of the platform's messages: fa or en | | `--leaked-password-protection` | `bool` | | refuse passwords known from leaks | | `--manual-linking` | `bool` | | users may link identities themselves | | `--mfa-max-factors` | `int64` | | most factors per user (1-20) | | `--mfa-phone-enroll` | `bool` | | users may enroll phone factors | | `--mfa-phone-verify` | `bool` | | phone factor codes are accepted | | `--mfa-totp-enroll` | `bool` | | users may enroll authenticator apps | | `--mfa-totp-verify` | `bool` | | authenticator app codes are accepted | | `--otp-expiry` | `int64` | | seconds a one-time code is valid | | `--otp-length` | `int64` | | digits of a one-time code | | `--password-min-length` | `int64` | | shortest password | | `--password-required-characters` | `string` | | "", letters_digits, lower_upper_digits or lower_upper_digits_symbols | | `--phone-confirm-required` | `bool` | | a new phone must be confirmed before sign-in | | `--phone-enabled` | `bool` | | sign-in with a phone number | | `--rate-anonymous-per-hour` | `int64` | | anonymous sign-ins per hour (0: the plan's) | | `--rate-emails-per-hour` | `int64` | | emails sent per hour (0: the plan's) | | `--rate-sign-in` | `int64` | | sign-ins per 5 minutes per address (0: the plan's) | | `--rate-sms-per-hour` | `int64` | | SMS sent per hour (0: the plan's) | | `--rate-token-refresh` | `int64` | | token refreshes per 5 minutes (0: the plan's) | | `--rate-verify` | `int64` | | verifications per 5 minutes (0: the plan's) | | `--redirect-url` | `stringArray` | | the URLs a sign-in may redirect to (replaces the list) (repeatable, or comma separated) | | `--secure-email-change` | `bool` | | an email change is confirmed at both addresses | | `--secure-password-change` | `bool` | | a password change needs a recent sign-in | | `--session-inactivity-timeout` | `int64` | | a session ends after this many idle seconds (0: never) | | `--session-timebox` | `int64` | | a session ends after this many seconds (0: never) | | `--single-session` | `bool` | | one session per user (a new sign-in ends the others) | | `--site-url` | `string` | | the app's URL (the default redirect after sign-in) | | `--sms-enabled` | `bool` | | send SMS from the platform's line (within the plan) | | `--smtp-enabled` | `bool` | | send email through your own SMTP server | | `--smtp-host` | `string` | | SMTP host | | `--smtp-port` | `int64` | | SMTP port | | `--smtp-sender-email` | `string` | | sender address | | `--smtp-sender-name` | `string` | | sender name | | `--smtp-user` | `string` | | SMTP user (its password: auth secrets set smtp) | | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--wait` | `bool` | | wait until the operation finishes | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas auth sms` {#arianet-baas-auth-sms} Show the SMS log: each code sent, its delivery state, line and operator **Usage** ```text arianet baas auth sms [project-id] [flags] ``` **Examples** ```bash arianet baas auth sms 12 --phone 09121234567 ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--page` | `string` | | page number | | `--per-page` | `string` | | entries per page | | `--phone` | `string` | | only this phone number | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas auth smtp` {#arianet-baas-auth-smtp} Your own SMTP server (set it with auth settings set --smtp-\*) **Usage** ```text arianet baas auth smtp ``` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) **Subcommands** - [`test`](#arianet-baas-auth-smtp-test): Send a test message through the SMTP server (the flags given over the stored settings) ## `arianet baas auth smtp test` {#arianet-baas-auth-smtp-test} Send a test message through the SMTP server (the flags given over the stored settings) **Usage** ```text arianet baas auth smtp test [project-id] [flags] ``` **Examples** ```bash arianet baas auth smtp test 12 --to me@example.com ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--host` | `string` | | SMTP host | | `--password-file` | `string` | | try this password instead of the stored one (read from the file, - for standard input) | | `--port` | `int64` | | SMTP port | | `--sender-email` | `string` | | sender address | | `--sender-name` | `string` | | sender name | | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--to` | `string` | | the recipient (required) | | `--user` | `string` | | SMTP user | | `--wait` | `bool` | | wait until the operation finishes | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas auth templates` {#arianet-baas-auth-templates} The emails auth sends: confirm sign-up, invite, magic link, recovery, email change **Usage** ```text arianet baas auth templates ``` **Aliases:** `emails`, `template` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) **Subcommands** - [`get`](#arianet-baas-auth-templates-get): Print a template's subject and body - [`list`](#arianet-baas-auth-templates-list): List the templates and which are your own - [`preview`](#arianet-baas-auth-templates-preview): Render a template with example data (nothing is stored or sent) - [`reset`](#arianet-baas-auth-templates-reset): Go back to the platform's message - [`set`](#arianet-baas-auth-templates-set): Use your own template (signup, invite, magiclink, recovery, email_change, reauthentication) ## `arianet baas auth templates get` {#arianet-baas-auth-templates-get} Print a template's subject and body **Usage** ```text arianet baas auth templates get [project-id] [flags] ``` **Examples** ```bash arianet baas auth templates get 12 signup ``` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas auth templates list` {#arianet-baas-auth-templates-list} List the templates and which are your own **Usage** ```text arianet baas auth templates list [project-id] [flags] ``` **Aliases:** `ls` **Examples** ```bash arianet baas auth templates list 12 ``` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas auth templates preview` {#arianet-baas-auth-templates-preview} Render a template with example data (nothing is stored or sent) **Usage** ```text arianet baas auth templates preview [project-id] [flags] ``` **Examples** ```bash arianet baas auth templates preview 12 signup --subject 'Welcome to Shop' --body-file ./signup.html ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--body` | `string` | | the HTML body (prefer --body-file) | | `--body-file` | `string` | | read the HTML body from this file (- for standard input) | | `--subject` | `string` | | the subject | | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--wait` | `bool` | | wait until the operation finishes | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas auth templates reset` {#arianet-baas-auth-templates-reset} Go back to the platform's message **Usage** ```text arianet baas auth templates reset [project-id] [flags] ``` **Examples** ```bash arianet baas auth templates reset 12 recovery --yes ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--wait` | `bool` | | wait until the operation finishes | | `-y`, `--yes` | `bool` | | skip the confirmation prompt | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas auth templates set` {#arianet-baas-auth-templates-set} Use your own template (signup, invite, magiclink, recovery, email_change, reauthentication) **Usage** ```text arianet baas auth templates set [project-id] [flags] ``` **Examples** ```bash arianet baas auth templates set 12 signup --subject "Confirm your account" --body-file signup.html ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--body` | `string` | | the HTML body (prefer --body-file) | | `--body-file` | `string` | | read the HTML body from this file (- for standard input) | | `--subject` | `string` | | the subject | | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--wait` | `bool` | | wait until the operation finishes | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas auth users` {#arianet-baas-auth-users} Manage the project's end users **Usage** ```text arianet baas auth users ``` **Aliases:** `user` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) **Subcommands** - [`create`](#arianet-baas-auth-users-create): Create a user - [`delete`](#arianet-baas-auth-users-delete): Delete a user - [`factors`](#arianet-baas-auth-users-factors): A user's MFA factors - [`get`](#arianet-baas-auth-users-get): Show one user - [`list`](#arianet-baas-auth-users-list): List the project's users - [`send`](#arianet-baas-auth-users-send): Send the user a magic link (or code) or a password recovery message - [`sessions`](#arianet-baas-auth-users-sessions): A user's sessions - [`update`](#arianet-baas-auth-users-update): Change a user: email, phone, password, confirmation, metadata, ban ## `arianet baas auth users create` {#arianet-baas-auth-users-create} Create a user **Usage** ```text arianet baas auth users create [project-id] [flags] ``` **Examples** ```bash arianet baas auth users create 12 --email ana@example.com --password 'S3cret-pass' --email-confirm ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--email` | `string` | | email address | | `--email-confirm` | `bool` | | mark the email as confirmed | | `--password` | `string` | | password | | `--phone` | `string` | | phone number | | `--phone-confirm` | `bool` | | mark the phone as confirmed | | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--wait` | `bool` | | wait until the operation finishes | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas auth users delete` {#arianet-baas-auth-users-delete} Delete a user **Usage** ```text arianet baas auth users delete [project-id] [flags] ``` **Aliases:** `rm` **Examples** ```bash arianet baas auth users delete 12 6f1c2a9e-4b7d-4e1a-9c3f-2d8b5a7e1f40 --yes ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--wait` | `bool` | | wait until the operation finishes | | `-y`, `--yes` | `bool` | | skip the confirmation prompt | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas auth users factors` {#arianet-baas-auth-users-factors} A user's MFA factors **Usage** ```text arianet baas auth users factors ``` **Aliases:** `factor`, `mfa` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) **Subcommands** - [`delete`](#arianet-baas-auth-users-factors-delete): Remove an MFA factor (its sessions go back to aal1) - [`list`](#arianet-baas-auth-users-factors-list): List a user's MFA factors ## `arianet baas auth users factors delete` {#arianet-baas-auth-users-factors-delete} Remove an MFA factor (its sessions go back to aal1) **Usage** ```text arianet baas auth users factors delete [project-id] [flags] ``` **Aliases:** `rm` **Examples** ```bash arianet baas auth users factors delete 12 6f1c2a9e-4b7d-4e1a-9c3f-2d8b5a7e1f40 b2e4c6d8-1a3f-4c5e-8d7b-9f0a1b2c3d4e --yes ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--wait` | `bool` | | wait until the operation finishes | | `-y`, `--yes` | `bool` | | skip the confirmation prompt | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas auth users factors list` {#arianet-baas-auth-users-factors-list} List a user's MFA factors **Usage** ```text arianet baas auth users factors list [project-id] [flags] ``` **Aliases:** `ls` **Examples** ```bash arianet baas auth users factors list 12 6f1c2a9e-4b7d-4e1a-9c3f-2d8b5a7e1f40 ``` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas auth users get` {#arianet-baas-auth-users-get} Show one user **Usage** ```text arianet baas auth users get [project-id] [flags] ``` **Aliases:** `show` **Examples** ```bash arianet baas auth users get 12 6f1c2a9e-4b7d-4e1a-9c3f-2d8b5a7e1f40 ``` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas auth users list` {#arianet-baas-auth-users-list} List the project's users **Usage** ```text arianet baas auth users list [project-id] [flags] ``` **Aliases:** `ls` **Examples** ```bash arianet baas auth users list 12 --search @example.com --per-page 50 ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--page` | `string` | | page number | | `--per-page` | `string` | | users per page (at most 200) | | `--search` | `string` | | search the email, phone or ID | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas auth users send` {#arianet-baas-auth-users-send} Send the user a magic link (or code) or a password recovery message **Usage** ```text arianet baas auth users send [project-id] [flags] ``` **Examples** ```bash arianet baas auth users send 12 6f1c... --type recovery ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--type` | `string` | | magiclink or recovery (required) | | `--wait` | `bool` | | wait until the operation finishes | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas auth users sessions` {#arianet-baas-auth-users-sessions} A user's sessions **Usage** ```text arianet baas auth users sessions ``` **Aliases:** `session` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) **Subcommands** - [`list`](#arianet-baas-auth-users-sessions-list): List a user's sessions - [`revoke`](#arianet-baas-auth-users-sessions-revoke): End one session - [`revoke-all`](#arianet-baas-auth-users-sessions-revoke-all): End every session of a user (signs them out everywhere) ## `arianet baas auth users sessions list` {#arianet-baas-auth-users-sessions-list} List a user's sessions **Usage** ```text arianet baas auth users sessions list [project-id] [flags] ``` **Aliases:** `ls` **Examples** ```bash arianet baas auth users sessions list 12 6f1c2a9e-4b7d-4e1a-9c3f-2d8b5a7e1f40 ``` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas auth users sessions revoke` {#arianet-baas-auth-users-sessions-revoke} End one session **Usage** ```text arianet baas auth users sessions revoke [project-id] [flags] ``` **Examples** ```bash arianet baas auth users sessions revoke 12 6f1c2a9e-4b7d-4e1a-9c3f-2d8b5a7e1f40 0d9e8f7a-6b5c-4d3e-2f1a-0b9c8d7e6f5a --yes ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--wait` | `bool` | | wait until the operation finishes | | `-y`, `--yes` | `bool` | | skip the confirmation prompt | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas auth users sessions revoke-all` {#arianet-baas-auth-users-sessions-revoke-all} End every session of a user (signs them out everywhere) **Usage** ```text arianet baas auth users sessions revoke-all [project-id] [flags] ``` **Examples** ```bash arianet baas auth users sessions revoke-all 12 6f1c2a9e-4b7d-4e1a-9c3f-2d8b5a7e1f40 --yes ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--wait` | `bool` | | wait until the operation finishes | | `-y`, `--yes` | `bool` | | skip the confirmation prompt | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas auth users update` {#arianet-baas-auth-users-update} Change a user: email, phone, password, confirmation, metadata, ban **Usage** ```text arianet baas auth users update [project-id] [flags] ``` **Examples** ```bash arianet baas auth users update 12 6f1c... --email-confirm arianet baas auth users update 12 6f1c... --ban 24h arianet baas auth users update 12 6f1c... --ban none --app-metadata '{"role":"editor"}' ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--app-metadata` | `string` | | app metadata as a JSON object | | `--ban` | `string` | | ban for this long (e.g. 24h, 876000h), or "none" to lift a ban | | `--email` | `string` | | new email address | | `--email-confirm` | `bool` | | mark the email as confirmed | | `--password` | `string` | | new password | | `--phone` | `string` | | new phone number | | `--phone-confirm` | `bool` | | mark the phone as confirmed | | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--user-metadata` | `string` | | user metadata as a JSON object | | `--wait` | `bool` | | wait until the operation finishes | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas backups` {#arianet-baas-backups} Backups of the project's database, restore and point-in-time restore **Usage** ```text arianet baas backups ``` **Aliases:** `backup` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) **Subcommands** - [`create`](#arianet-baas-backups-create): Make a manual backup now - [`download`](#arianet-baas-backups-download): Download a ready backup (a custom-format dump pg_restore reads; - for standard output) - [`list`](#arianet-baas-backups-list): List the backups and the plan's backup policy - [`pitr`](#arianet-baas-backups-pitr): Restore the project to a point in time (paid plans) - [`restore`](#arianet-baas-backups-restore): Restore a backup into the project (traffic paused, a safety backup first) ## `arianet baas backups create` {#arianet-baas-backups-create} Make a manual backup now **Usage** ```text arianet baas backups create [project-id] [flags] ``` **Examples** ```bash arianet baas backups create 12 --wait ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--wait` | `bool` | | wait until the operation finishes | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas backups download` {#arianet-baas-backups-download} Download a ready backup (a custom-format dump pg_restore reads; - for standard output) **Usage** ```text arianet baas backups download [project-id] [local-file] [flags] ``` **Examples** ```bash arianet baas backups download 12 40 shop.dump pg_restore --list shop.dump ``` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas backups list` {#arianet-baas-backups-list} List the backups and the plan's backup policy **Usage** ```text arianet baas backups list [project-id] [flags] ``` **Aliases:** `ls` **Examples** ```bash arianet baas backups list 12 ``` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas backups pitr` {#arianet-baas-backups-pitr} Restore the project to a point in time (paid plans) **Usage** ```text arianet baas backups pitr [project-id] [flags] ``` **Aliases:** `restore-to` **Examples** ```bash arianet baas backups pitr 12 --to 2026-11-28T09:30:00Z --confirm abcdefghij0123456789 --wait ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--confirm` | `string` | | the project's ref, typed to confirm (required) | | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--to` | `string` | | the moment to go back to (RFC 3339, e.g. 2026-11-28T09:30:00Z) (required) | | `--wait` | `bool` | | wait until the operation finishes | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas backups restore` {#arianet-baas-backups-restore} Restore a backup into the project (traffic paused, a safety backup first) **Usage** ```text arianet baas backups restore [project-id] [flags] ``` **Examples** ```bash arianet baas backups restore 12 40 --confirm abcdefghij0123456789 --wait ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--confirm` | `string` | | the project's ref, typed to confirm (arianet baas projects get) (required) | | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--wait` | `bool` | | wait until the operation finishes | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas cron` {#arianet-baas-cron} Run SQL or call a URL on a schedule (Cron jobs) **Usage** ```text arianet baas cron ``` **Aliases:** `crons` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) **Subcommands** - [`create`](#arianet-baas-cron-create): Create a Cron job that runs SQL or calls a URL - [`delete`](#arianet-baas-cron-delete): Delete a Cron job - [`disable`](#arianet-baas-cron-disable): Turn a Cron job off - [`enable`](#arianet-baas-cron-enable): Turn a Cron job on - [`list`](#arianet-baas-cron-list): List the Cron jobs - [`preview`](#arianet-baas-cron-preview): Check a schedule: its shortest interval and next five runs - [`run`](#arianet-baas-cron-run): Run a Cron job once, now - [`runs`](#arianet-baas-cron-runs): Show a Cron job's runs (7 days) - [`update`](#arianet-baas-cron-update): Change a Cron job (the flags given; the rest stays) ## `arianet baas cron create` {#arianet-baas-cron-create} Create a Cron job that runs SQL or calls a URL **Usage** ```text arianet baas cron create [project-id] [flags] ``` **Examples** ```bash arianet baas cron create 12 --name cleanup --schedule "0 3 * * *" --sql "delete from logs where at < now() - interval '30 days'" arianet baas cron create 12 --name ping --schedule "*/10 * * * *" --http-url https://example.com/hook --http-method POST ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--data` | `string` | | the JSON request body; flags given as well override its fields | | `--enabled` | `bool` | | the job runs on its schedule (default true) | | `--file` | `string` | | read the JSON request body from this file | | `--http-body` | `string` | | the request body | | `--http-header` | `stringArray` | | a request header (repeatable name=value) | | `--http-method` | `string` | | GET, POST, PUT, PATCH or DELETE | | `--http-timeout-ms` | `int64` | | the request timeout in milliseconds | | `--http-url` | `string` | | the URL to call | | `--kind` | `string` | | sql or http (default: from --sql or --http-url) | | `--name` | `string` | | job name | | `--schedule` | `string` | | cron schedule, e.g. "\*/5 \* \* \* \*" or "30 seconds" | | `--sql` | `string` | | the SQL to run | | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--wait` | `bool` | | wait until the operation finishes | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas cron delete` {#arianet-baas-cron-delete} Delete a Cron job **Usage** ```text arianet baas cron delete [project-id] [flags] ``` **Aliases:** `rm` **Examples** ```bash arianet baas cron delete 12 3 --yes ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--wait` | `bool` | | wait until the operation finishes | | `-y`, `--yes` | `bool` | | skip the confirmation prompt | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas cron disable` {#arianet-baas-cron-disable} Turn a Cron job off **Usage** ```text arianet baas cron disable [project-id] [flags] ``` **Examples** ```bash arianet baas cron disable 12 3 ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--wait` | `bool` | | wait until the operation finishes | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas cron enable` {#arianet-baas-cron-enable} Turn a Cron job on **Usage** ```text arianet baas cron enable [project-id] [flags] ``` **Examples** ```bash arianet baas cron enable 12 3 ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--wait` | `bool` | | wait until the operation finishes | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas cron list` {#arianet-baas-cron-list} List the Cron jobs **Usage** ```text arianet baas cron list [project-id] [flags] ``` **Aliases:** `ls` **Examples** ```bash arianet baas cron list 12 ``` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas cron preview` {#arianet-baas-cron-preview} Check a schedule: its shortest interval and next five runs **Usage** ```text arianet baas cron preview [project-id] [flags] ``` **Examples** ```bash arianet baas cron preview 12 "*/15 * * * *" ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--wait` | `bool` | | wait until the operation finishes | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas cron run` {#arianet-baas-cron-run} Run a Cron job once, now **Usage** ```text arianet baas cron run [project-id] [flags] ``` **Examples** ```bash arianet baas cron run 12 3 ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--wait` | `bool` | | wait until the operation finishes | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas cron runs` {#arianet-baas-cron-runs} Show a Cron job's runs (7 days) **Usage** ```text arianet baas cron runs [project-id] [flags] ``` **Aliases:** `history` **Examples** ```bash arianet baas cron runs 12 3 --limit 20 ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--before` | `string` | | the next page: runs before this ID | | `--limit` | `string` | | at most this many runs | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas cron update` {#arianet-baas-cron-update} Change a Cron job (the flags given; the rest stays) **Usage** ```text arianet baas cron update [project-id] [flags] ``` **Examples** ```bash arianet baas cron update 12 3 --schedule "0 4 * * *" ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--data` | `string` | | the JSON request body; flags given as well override its fields | | `--enabled` | `bool` | | the job runs on its schedule (default true) | | `--file` | `string` | | read the JSON request body from this file | | `--http-body` | `string` | | the request body | | `--http-header` | `stringArray` | | a request header (repeatable name=value) | | `--http-method` | `string` | | GET, POST, PUT, PATCH or DELETE | | `--http-timeout-ms` | `int64` | | the request timeout in milliseconds | | `--http-url` | `string` | | the URL to call | | `--kind` | `string` | | sql or http (default: from --sql or --http-url) | | `--name` | `string` | | job name | | `--schedule` | `string` | | cron schedule, e.g. "\*/5 \* \* \* \*" or "30 seconds" | | `--sql` | `string` | | the SQL to run | | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--wait` | `bool` | | wait until the operation finishes | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas db` {#arianet-baas-db} Migrations (push, pull, diff) and the database: settings, schemas, extensions, enums, functions, triggers, views, import, export **Usage** ```text arianet baas db ``` **Aliases:** `database` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) **Subcommands** - [`api-docs`](#arianet-baas-db-api-docs): Show the REST API reference: every table, view and function it serves (-o json for all of it) - [`api-schemas`](#arianet-baas-db-api-schemas): Show or set the schemas the REST API serves - [`diagram`](#arianet-baas-db-diagram): Show a schema's tables and foreign keys (-o json for the columns) - [`diff`](#arianet-baas-db-diff): Compare the migration files and the newest schema snapshot with the project - [`enums`](#arianet-baas-db-enums): List, create, change or drop enumerated types - [`export`](#arianet-baas-db-export): Download a table, or the rows of one SELECT, as CSV - [`extensions`](#arianet-baas-db-extensions): List, enable or disable PostgreSQL extensions - [`functions`](#arianet-baas-db-functions): List, create or drop SQL functions (callable at /rest/v1/rpc/\) - [`import`](#arianet-baas-db-import): Import a CSV file into a table in one transaction (a refused row rolls everything back) - [`import-limits`](#arianet-baas-db-import-limits): Show how much one CSV import takes on the project's plan - [`network`](#arianet-baas-db-network): Set the networks allowed to reach the external database endpoint (--any: every address) - [`password`](#arianet-baas-db-password): The direct database login's password - [`pull`](#arianet-baas-db-pull): Write the schema (tables, views, functions, enums, policies...) as a SQL file - [`push`](#arianet-baas-db-push): Apply the migration files (\*.sql) not applied yet, in name order, in one transaction - [`roles`](#arianet-baas-db-roles): List the API roles and your database roles - [`schemas`](#arianet-baas-db-schemas): List, create or drop schemas - [`settings`](#arianet-baas-db-settings): Show the connection strings, SSL, allowed networks, timeout and size - [`ssl`](#arianet-baas-db-ssl): Require SSL on the external database endpoint, or allow plain connections - [`triggers`](#arianet-baas-db-triggers): List, create, enable, disable or drop triggers - [`views`](#arianet-baas-db-views): List, create, refresh or drop views and materialized views ## `arianet baas db api-docs` {#arianet-baas-db-api-docs} Show the REST API reference: every table, view and function it serves (-o json for all of it) **Usage** ```text arianet baas db api-docs [project-id] [flags] ``` **Examples** ```bash arianet baas db api-docs 12 arianet baas db api-docs 12 -o json > api.json ``` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas db api-schemas` {#arianet-baas-db-api-schemas} Show or set the schemas the REST API serves **Usage** ```text arianet baas db api-schemas ``` **Aliases:** `exposed-schemas` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) **Subcommands** - [`get`](#arianet-baas-db-api-schemas-get): Show the schemas the REST API serves (the default first) - [`set`](#arianet-baas-db-api-schemas-set): Set the schemas the REST API serves (1-20, the default first); the REST runtime restarts ## `arianet baas db api-schemas get` {#arianet-baas-db-api-schemas-get} Show the schemas the REST API serves (the default first) **Usage** ```text arianet baas db api-schemas get [project-id] [flags] ``` **Aliases:** `show` **Examples** ```bash arianet baas db api-schemas get 12 ``` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas db api-schemas set` {#arianet-baas-db-api-schemas-set} Set the schemas the REST API serves (1-20, the default first); the REST runtime restarts **Usage** ```text arianet baas db api-schemas set [project-id] [flags] ``` **Examples** ```bash arianet baas db api-schemas set 12 --schema public,app ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--schema` | `stringArray` | | the served schemas, the default first (required) (repeatable, or comma separated) | | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--wait` | `bool` | | wait until the operation finishes | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas db diagram` {#arianet-baas-db-diagram} Show a schema's tables and foreign keys (-o json for the columns) **Usage** ```text arianet baas db diagram [project-id] [flags] ``` **Examples** ```bash arianet baas db diagram 12 --schema public ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--schema` | `string` | | schema (default public) | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas db diff` {#arianet-baas-db-diff} Compare the migration files and the newest schema snapshot with the project Compare the project with this directory: ```text 1. the migration files of --dir with the project's history: files not applied yet (pending), applied files changed since (changed), and recorded names without a file (remote only); 2. the project's schema now (as db pull writes it) with the newest *_remote_schema.sql of --dir, or --against , as a unified diff (- the file, + the project). Leading comment lines and trailing spaces are ignored. ``` Exit status: 0 when there is no difference, 2 when there is one, 1 on an error. **Usage** ```text arianet baas db diff [project-id] [flags] ``` **Examples** ```bash arianet baas db diff arianet baas db diff 12 --against schema.sql arianet baas db diff -o json ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--against` | `string` | | compare the schema with this file instead of the newest snapshot | | `--dir` | `string` | `arianet/migrations` | directory of the migration files and snapshots | | `--schema` | `stringSlice` | `[public]` | schemas to compare (repeatable or comma separated) | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas db enums` {#arianet-baas-db-enums} List, create, change or drop enumerated types **Usage** ```text arianet baas db enums ``` **Aliases:** `enum` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) **Subcommands** - [`add-value`](#arianet-baas-db-enums-add-value): Add a value (at the end, or --before / --after another) - [`create`](#arianet-baas-db-enums-create): Create an enumerated type - [`drop`](#arianet-baas-db-enums-drop): Drop an enumerated type - [`list`](#arianet-baas-db-enums-list): List a schema's enumerated types - [`rename-value`](#arianet-baas-db-enums-rename-value): Rename a value ## `arianet baas db enums add-value` {#arianet-baas-db-enums-add-value} Add a value (at the end, or --before / --after another) **Usage** ```text arianet baas db enums add-value [project-id] [flags] ``` **Examples** ```bash arianet baas db enums add-value 12 status review --after draft ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--after` | `string` | | put it after this value | | `--before` | `string` | | put it before this value | | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--wait` | `bool` | | wait until the operation finishes | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas db enums create` {#arianet-baas-db-enums-create} Create an enumerated type **Usage** ```text arianet baas db enums create [project-id] [flags] ``` **Examples** ```bash arianet baas db enums create 12 status --value draft,published,archived ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--comment` | `string` | | type comment | | `--schema` | `string` | | schema (default public) | | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--value` | `stringArray` | | the values, in order (required) (repeatable, or comma separated) | | `--wait` | `bool` | | wait until the operation finishes | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas db enums drop` {#arianet-baas-db-enums-drop} Drop an enumerated type **Usage** ```text arianet baas db enums drop [project-id] [flags] ``` **Aliases:** `rm` **Examples** ```bash arianet baas db enums drop 12 status --yes ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--cascade` | `bool` | | also drop the columns that use it | | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--wait` | `bool` | | wait until the operation finishes | | `-y`, `--yes` | `bool` | | skip the confirmation prompt | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas db enums list` {#arianet-baas-db-enums-list} List a schema's enumerated types **Usage** ```text arianet baas db enums list [project-id] [flags] ``` **Aliases:** `ls` **Examples** ```bash arianet baas db enums list 12 --schema public ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--schema` | `string` | | schema (default public) | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas db enums rename-value` {#arianet-baas-db-enums-rename-value} Rename a value **Usage** ```text arianet baas db enums rename-value [project-id] [flags] ``` **Examples** ```bash arianet baas db enums rename-value 12 status archived retired ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--wait` | `bool` | | wait until the operation finishes | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas db export` {#arianet-baas-db-export} Download a table, or the rows of one SELECT, as CSV **Usage** ```text arianet baas db export [project-id] [flags] ``` **Examples** ```bash arianet baas db export 12 --table todos --out todos.csv arianet baas db export 12 --query 'select id, title from todos where done' > done.csv ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--name` | `string` | | file name the service suggests for a query export | | `--out` | `string` | `-` | write the CSV to this file (- for standard output) | | `--query` | `string` | | a SELECT whose rows to export (read-only) | | `--table` | `string` | | the table to export (schema.table; public when no schema) | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas db extensions` {#arianet-baas-db-extensions} List, enable or disable PostgreSQL extensions **Usage** ```text arianet baas db extensions ``` **Aliases:** `ext`, `extension` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) **Subcommands** - [`disable`](#arianet-baas-db-extensions-disable): Disable an extension - [`enable`](#arianet-baas-db-extensions-enable): Enable an extension (into the extensions schema) - [`list`](#arianet-baas-db-extensions-list): List the extensions on offer and their state ## `arianet baas db extensions disable` {#arianet-baas-db-extensions-disable} Disable an extension **Usage** ```text arianet baas db extensions disable [project-id] [flags] ``` **Examples** ```bash arianet baas db extensions disable 12 pg_trgm --yes ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--cascade` | `bool` | | also drop what depends on it | | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--wait` | `bool` | | wait until the operation finishes | | `-y`, `--yes` | `bool` | | skip the confirmation prompt | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas db extensions enable` {#arianet-baas-db-extensions-enable} Enable an extension (into the extensions schema) **Usage** ```text arianet baas db extensions enable [project-id] [flags] ``` **Examples** ```bash arianet baas db extensions enable 12 pg_trgm ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--wait` | `bool` | | wait until the operation finishes | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas db extensions list` {#arianet-baas-db-extensions-list} List the extensions on offer and their state **Usage** ```text arianet baas db extensions list [project-id] [flags] ``` **Aliases:** `ls` **Examples** ```bash arianet baas db extensions list 12 ``` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas db functions` {#arianet-baas-db-functions} List, create or drop SQL functions (callable at /rest/v1/rpc/\) **Usage** ```text arianet baas db functions ``` **Aliases:** `fn`, `function` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) **Subcommands** - [`create`](#arianet-baas-db-functions-create): Create a function in sql or plpgsql - [`drop`](#arianet-baas-db-functions-drop): Drop a function, named by its OID (db functions list) - [`list`](#arianet-baas-db-functions-list): List a schema's functions ## `arianet baas db functions create` {#arianet-baas-db-functions-create} Create a function in sql or plpgsql **Usage** ```text arianet baas db functions create [project-id] [flags] ``` **Examples** ```bash arianet baas db functions create 12 open_todos --returns 'setof todos' --language sql \ --body 'select * from todos where not done' --behavior stable arianet baas db functions create 12 add --arg a:int --arg b:int --returns int --language sql --body 'select a + b' ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--arg` | `stringArray` | | an argument as \[name\]\:type\[\:in\|out\|inout\|variadic\]\[\:default=\\] (repeatable) | | `--behavior` | `string` | | volatile, stable or immutable | | `--body` | `string` | | the function body | | `--body-file` | `string` | | read the function body from this file (- for standard input) | | `--comment` | `string` | | function comment | | `--data` | `string` | | the JSON request body; flags given as well override its fields | | `--file` | `string` | | read the JSON request body from this file | | `--language` | `string` | | sql or plpgsql (required) | | `--or-replace` | `bool` | | replace a function with the same arguments | | `--returns` | `string` | | return type, e.g. int, setof todos, trigger, void (required) | | `--returns-set` | `bool` | | returns a set of rows | | `--schema` | `string` | | schema (default public) | | `--search-path` | `stringArray` | | the function's search_path (repeatable, or comma separated) | | `--security-definer` | `bool` | | run with the owner's rights | | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--wait` | `bool` | | wait until the operation finishes | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas db functions drop` {#arianet-baas-db-functions-drop} Drop a function, named by its OID (db functions list) **Usage** ```text arianet baas db functions drop [project-id] [flags] ``` **Aliases:** `rm` **Examples** ```bash arianet baas db functions drop 12 16842 --yes ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--cascade` | `bool` | | also drop what depends on it | | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--wait` | `bool` | | wait until the operation finishes | | `-y`, `--yes` | `bool` | | skip the confirmation prompt | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas db functions list` {#arianet-baas-db-functions-list} List a schema's functions **Usage** ```text arianet baas db functions list [project-id] [flags] ``` **Aliases:** `ls` **Examples** ```bash arianet baas db functions list 12 --schema public ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--schema` | `string` | | schema (default public) | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas db import` {#arianet-baas-db-import} Import a CSV file into a table in one transaction (a refused row rolls everything back) Import a CSV file into a table. By default the first line names the columns; with --no-header give the table column of each CSV column, in order, with --column (an empty name skips that CSV column). An empty field is NULL. The plan caps the rows and bytes of one import (arianet baas db import-limits). **Usage** ```text arianet baas db import [project-id]
[flags] ``` **Examples** ```bash arianet baas db import 12 todos todos.csv arianet baas db import 12 todos data.csv --no-header --column title,done --delimiter ';' ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--column` | `stringArray` | | the table column of each CSV column, in order (default: the header line) | | `--delimiter` | `string` | | field delimiter, one character (default ,) | | `--no-header` | `bool` | | the first line is data, not column names | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas db import-limits` {#arianet-baas-db-import-limits} Show how much one CSV import takes on the project's plan **Usage** ```text arianet baas db import-limits [project-id] [flags] ``` **Examples** ```bash arianet baas db import-limits 12 ``` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas db network` {#arianet-baas-db-network} Set the networks allowed to reach the external database endpoint (--any: every address) **Usage** ```text arianet baas db network [project-id] [flags] ``` **Examples** ```bash arianet baas db network 12 --allow 203.0.113.0/24 --allow 198.51.100.7/32 arianet baas db network 12 --any ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--allow` | `stringArray` | | an allowed network in CIDR notation (repeatable, or comma separated) | | `--any` | `bool` | | allow every address (no restriction) | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas db password` {#arianet-baas-db-password} The direct database login's password **Usage** ```text arianet baas db password ``` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) **Subcommands** - [`reset`](#arianet-baas-db-password-reset): Give the database login a new password, shown once (connections with the old one stop) ## `arianet baas db password reset` {#arianet-baas-db-password-reset} Give the database login a new password, shown once (connections with the old one stop) **Usage** ```text arianet baas db password reset [project-id] [flags] ``` **Examples** ```bash arianet baas db password reset 12 --confirm abcdefghij0123456789 ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--confirm` | `string` | | the project's ref, typed to confirm (required) | | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--wait` | `bool` | | wait until the operation finishes | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas db pull` {#arianet-baas-db-pull} Write the schema (tables, views, functions, enums, policies...) as a SQL file Write the DDL of the project's schemas (default public): extensions, schemas, enums, sequences, tables with their columns, defaults and constraints, indexes, views, materialized views, functions, triggers, row level security, policies and comments (no data, no grants). The file goes to --dir (default arianet/migrations) as \_remote_schema.sql, or to --file (- for standard output). db diff compares the project with the newest such snapshot. The snapshot describes the database as it is, so db push would fail applying it to the same project: --mark-applied records it as applied there (needs baas\:sql\:execute). In a region without the schema endpoint the snapshot is built here from the table introspection: tables only (views are listed but not written, functions are missing). **Usage** ```text arianet baas db pull [project-id] [flags] ``` **Examples** ```bash arianet baas db pull arianet baas db pull 12 --schema public,app arianet baas db pull 12 --file - > schema.sql ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--dir` | `string` | `arianet/migrations` | directory to write the snapshot into | | `--file` | `string` | | write to this file instead (- for standard output) | | `--mark-applied` | `bool` | | record the snapshot as applied in the project, so db push skips it | | `--schema` | `stringSlice` | `[public]` | schemas to write (repeatable or comma separated) | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas db push` {#arianet-baas-db-push} Apply the migration files (\*.sql) not applied yet, in name order, in one transaction Apply every \*.sql file of --dir (default arianet/migrations) that the project has not recorded yet, in lexical name order (create them with arianet baas migration new). The pending files run in one transaction, each followed by its record in baas_cli.migrations (name, checksum, applied_at): if one fails, nothing is applied and the failing file is named. A file that was applied and has changed since is refused: put the change in a new migration file. Files must not contain BEGIN or COMMIT. --dry-run lists what would be applied. In a region without the migrations endpoint, each file runs in its own transaction instead. Needs the baas\:sql\:execute scope. **Usage** ```text arianet baas db push [project-id] [flags] ``` **Examples** ```bash arianet baas db push arianet baas db push 12 --dir db/migrations --dry-run ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--dir` | `string` | `arianet/migrations` | directory of the migration files | | `--dry-run` | `bool` | | list what would be applied; change nothing | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas db roles` {#arianet-baas-db-roles} List the API roles and your database roles **Usage** ```text arianet baas db roles [project-id] [flags] ``` **Examples** ```bash arianet baas db roles 12 ``` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas db schemas` {#arianet-baas-db-schemas} List, create or drop schemas **Usage** ```text arianet baas db schemas ``` **Aliases:** `schema` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) **Subcommands** - [`create`](#arianet-baas-db-schemas-create): Create a schema. Answers with the SQL that ran. - [`drop`](#arianet-baas-db-schemas-drop): Drop a schema (public and the platform's are protected) - [`list`](#arianet-baas-db-schemas-list): List the schemas with counts, and which the REST API serves ## `arianet baas db schemas create` {#arianet-baas-db-schemas-create} Create a schema. Answers with the SQL that ran. **Usage** ```text arianet baas db schemas create [project-id] [flags] ``` **Examples** ```bash arianet baas db schemas create 12 app --grant-api-roles ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--comment` | `string` | | schema comment | | `--grant-api-roles` | `bool` | | give anon, authenticated and service_role what they have in public | | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--wait` | `bool` | | wait until the operation finishes | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas db schemas drop` {#arianet-baas-db-schemas-drop} Drop a schema (public and the platform's are protected) **Usage** ```text arianet baas db schemas drop [project-id] [flags] ``` **Aliases:** `rm` **Examples** ```bash arianet baas db schemas drop 12 app --cascade --yes ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--cascade` | `bool` | | also drop every object in it | | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--wait` | `bool` | | wait until the operation finishes | | `-y`, `--yes` | `bool` | | skip the confirmation prompt | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas db schemas list` {#arianet-baas-db-schemas-list} List the schemas with counts, and which the REST API serves **Usage** ```text arianet baas db schemas list [project-id] [flags] ``` **Aliases:** `ls` **Examples** ```bash arianet baas db schemas list 12 ``` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas db settings` {#arianet-baas-db-settings} Show the connection strings, SSL, allowed networks, timeout and size **Usage** ```text arianet baas db settings [project-id] [flags] ``` **Examples** ```bash arianet baas db settings 12 ``` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas db ssl` {#arianet-baas-db-ssl} Require SSL on the external database endpoint, or allow plain connections **Usage** ```text arianet baas db ssl ``` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) **Subcommands** - [`allow-plain`](#arianet-baas-db-ssl-allow-plain): Accept connections without SSL too - [`enforce`](#arianet-baas-db-ssl-enforce): Refuse connections without SSL ## `arianet baas db ssl allow-plain` {#arianet-baas-db-ssl-allow-plain} Accept connections without SSL too **Usage** ```text arianet baas db ssl allow-plain [project-id] [flags] ``` **Aliases:** `off` **Examples** ```bash arianet baas db ssl allow-plain 12 --yes ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--wait` | `bool` | | wait until the operation finishes | | `-y`, `--yes` | `bool` | | skip the confirmation prompt | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas db ssl enforce` {#arianet-baas-db-ssl-enforce} Refuse connections without SSL **Usage** ```text arianet baas db ssl enforce [project-id] [flags] ``` **Aliases:** `on` **Examples** ```bash arianet baas db ssl enforce 12 ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--wait` | `bool` | | wait until the operation finishes | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas db triggers` {#arianet-baas-db-triggers} List, create, enable, disable or drop triggers **Usage** ```text arianet baas db triggers ``` **Aliases:** `trigger` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) **Subcommands** - [`create`](#arianet-baas-db-triggers-create): Create a trigger that calls a trigger function - [`disable`](#arianet-baas-db-triggers-disable): Disable a trigger - [`drop`](#arianet-baas-db-triggers-drop): Drop a trigger - [`enable`](#arianet-baas-db-triggers-enable): Enable a trigger - [`list`](#arianet-baas-db-triggers-list): List the triggers on a schema's tables ## `arianet baas db triggers create` {#arianet-baas-db-triggers-create} Create a trigger that calls a trigger function **Usage** ```text arianet baas db triggers create [project-id]
[flags] ``` **Examples** ```bash arianet baas db triggers create 12 todos set_updated --timing BEFORE --event UPDATE --function touch_updated_at ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--event` | `stringArray` | | INSERT, UPDATE, DELETE or TRUNCATE (required) (repeatable, or comma separated) | | `--function` | `string` | | the trigger function (required) | | `--function-schema` | `string` | | the trigger function's schema (default public) | | `--orientation` | `string` | | ROW (default) or STATEMENT | | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--timing` | `string` | | BEFORE, AFTER or INSTEAD OF (required) | | `--update-column` | `stringArray` | | only on updates of these columns (repeatable, or comma separated) | | `--wait` | `bool` | | wait until the operation finishes | | `--when` | `string` | | WHEN condition | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas db triggers disable` {#arianet-baas-db-triggers-disable} Disable a trigger **Usage** ```text arianet baas db triggers disable [project-id]
[flags] ``` **Examples** ```bash arianet baas db triggers disable 12 todos set_updated ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--wait` | `bool` | | wait until the operation finishes | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas db triggers drop` {#arianet-baas-db-triggers-drop} Drop a trigger **Usage** ```text arianet baas db triggers drop [project-id]
[flags] ``` **Aliases:** `rm` **Examples** ```bash arianet baas db triggers drop 12 todos set_updated --yes ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--wait` | `bool` | | wait until the operation finishes | | `-y`, `--yes` | `bool` | | skip the confirmation prompt | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas db triggers enable` {#arianet-baas-db-triggers-enable} Enable a trigger **Usage** ```text arianet baas db triggers enable [project-id]
[flags] ``` **Examples** ```bash arianet baas db triggers enable 12 todos set_updated ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--wait` | `bool` | | wait until the operation finishes | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas db triggers list` {#arianet-baas-db-triggers-list} List the triggers on a schema's tables **Usage** ```text arianet baas db triggers list [project-id] [flags] ``` **Aliases:** `ls` **Examples** ```bash arianet baas db triggers list 12 --schema public ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--schema` | `string` | | schema (default public) | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas db views` {#arianet-baas-db-views} List, create, refresh or drop views and materialized views **Usage** ```text arianet baas db views ``` **Aliases:** `view` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) **Subcommands** - [`create`](#arianet-baas-db-views-create): Create a view or materialized view from one SELECT - [`drop`](#arianet-baas-db-views-drop): Drop a view - [`list`](#arianet-baas-db-views-list): List a schema's views - [`preview`](#arianet-baas-db-views-preview): Run one SELECT read-only and show its first 20 rows (what a view would show) - [`refresh`](#arianet-baas-db-views-refresh): Refresh a materialized view - [`security`](#arianet-baas-db-views-security): Turn a view's security_invoker on or off ## `arianet baas db views create` {#arianet-baas-db-views-create} Create a view or materialized view from one SELECT **Usage** ```text arianet baas db views create [project-id] [flags] ``` **Examples** ```bash arianet baas db views create 12 open_todos --query 'select * from todos where not done' --security-invoker ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--comment` | `string` | | view comment | | `--materialized` | `bool` | | a materialized view | | `--or-replace` | `bool` | | replace a view with the same name | | `--query` | `string` | | the SELECT (required) | | `--schema` | `string` | | schema (default public) | | `--security-invoker` | `bool` | | check the caller's rights (row level security applies) | | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--wait` | `bool` | | wait until the operation finishes | | `--with-data` | `bool` | | fill a materialized view now | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas db views drop` {#arianet-baas-db-views-drop} Drop a view **Usage** ```text arianet baas db views drop [project-id] [flags] ``` **Aliases:** `rm` **Examples** ```bash arianet baas db views drop 12 open_todos --yes arianet baas db views drop 12 daily_totals --materialized --yes ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--cascade` | `bool` | | also drop what depends on it | | `--materialized` | `bool` | | it is a materialized view | | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--wait` | `bool` | | wait until the operation finishes | | `-y`, `--yes` | `bool` | | skip the confirmation prompt | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas db views list` {#arianet-baas-db-views-list} List a schema's views **Usage** ```text arianet baas db views list [project-id] [flags] ``` **Aliases:** `ls` **Examples** ```bash arianet baas db views list 12 --schema public ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--schema` | `string` | | schema (default public) | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas db views preview` {#arianet-baas-db-views-preview} Run one SELECT read-only and show its first 20 rows (what a view would show) **Usage** ```text arianet baas db views preview [project-id]
[flags] ``` **Examples** ```bash arianet baas realtime disable 12 todos ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--wait` | `bool` | | wait until the operation finishes | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas realtime enable` {#arianet-baas-realtime-enable} Send a table's changes to realtime subscribers (Postgres Changes) **Usage** ```text arianet baas realtime enable [project-id]
[flags] ``` **Examples** ```bash arianet baas realtime enable 12 todos --old-records ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--old-records` | `bool` | | include the old row in updates and deletes (REPLICA IDENTITY FULL) | | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--wait` | `bool` | | wait until the operation finishes | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas realtime info` {#arianet-baas-realtime-info} Show the realtime URLs, limits and the tables enabled **Usage** ```text arianet baas realtime info [project-id] [flags] ``` **Aliases:** `get`, `show` **Examples** ```bash arianet baas realtime info 12 ``` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas reports` {#arianet-baas-reports} Show the API, auth, storage and database report over a range **Usage** ```text arianet baas reports [project-id] [flags] ``` **Aliases:** `report` **Examples** ```bash arianet baas reports 12 --range 7d arianet baas reports 12 -o json ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--range` | `string` | | 1h, 24h (default), 7d or 30d | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas sites` {#arianet-baas-sites} Host static and single-page sites: deploy a build directory, roll back, custom domains A project's sites serve static files and single-page apps (a build output such as dist/, build/ or out/) at https://\.\ and at custom domains, next to the project's API. Every deployment is kept unchanged; one is live, and rollback makes an earlier one live again at once. ```text arianet baas sites deploy ./dist --site shop --create arianet baas sites rollback --site shop ``` deploy packs the directory's regular files (symbolic links are skipped with a warning) into a tar.gz, refuses it locally when it passes the plan's files or bytes, uploads it and makes it live. Paths listed in .arianetignore (one glob a line, # comments, dir/ for directories, /path from the directory's root) are left out, as are .git and .DS_Store. **Usage** ```text arianet baas sites ``` **Aliases:** `site` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) **Subcommands** - [`create`](#arianet-baas-sites-create): Create a site (its hostname is \.\) - [`delete`](#arianet-baas-sites-delete): Delete a site, its deployments and its custom domains - [`deploy`](#arianet-baas-sites-deploy): Upload a directory as a new deployment of a site and make it live - [`deployments`](#arianet-baas-sites-deployments): List a site's deployments, newest first (get and delete are subcommands) - [`domains`](#arianet-baas-sites-domains): Serve a site at your own hostname - [`get`](#arianet-baas-sites-get): Show a site with its deployments and domains - [`list`](#arianet-baas-sites-list): List the project's sites with the plan's limits - [`rollback`](#arianet-baas-sites-rollback): Make an earlier deployment live (default: the one before the live one) - [`update`](#arianet-baas-sites-update): Rename a site or change its settings ## `arianet baas sites create` {#arianet-baas-sites-create} Create a site (its hostname is \.\) **Usage** ```text arianet baas sites create [project-id] [flags] ``` **Examples** ```bash arianet baas sites create 12 --name shop --spa-fallback ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--clean-urls` | `bool` | | serve /about from /about.html (and redirect /about.html to /about) | | `--header` | `stringArray` | | a header rule '\ \: \' (path exact or a prefix ending in \*); replaces the site's header rules (repeatable) | | `--name` | `string` | | site name: 3-40 lowercase letters, digits or -, unique in the region (required) | | `--redirect` | `stringArray` | | a redirect rule '\ \ \[301\|302\|307\|308\]'; replaces the site's redirect rules (repeatable) | | `--spa-fallback` | `bool` | | serve /index.html for paths that are not files (single-page apps) | | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--wait` | `bool` | | wait until the operation finishes | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas sites delete` {#arianet-baas-sites-delete} Delete a site, its deployments and its custom domains **Usage** ```text arianet baas sites delete [project-id] [flags] ``` **Aliases:** `rm` **Examples** ```bash arianet baas sites delete 12 shop arianet baas sites delete 12 shop --yes # no question (scripts) ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--wait` | `bool` | | wait until the operation finishes | | `-y`, `--yes` | `bool` | | skip the confirmation prompt | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas sites deploy` {#arianet-baas-sites-deploy} Upload a directory as a new deployment of a site and make it live **Usage** ```text arianet baas sites deploy [project-id] --site [flags] ``` **Examples** ```bash npm run build && arianet baas sites deploy ./dist --site shop arianet baas sites deploy 12 ./out --site docs --create arianet baas sites deploy ./dist --site shop --no-promote # ready, not live ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--create` | `bool` | | create the site first when the project has none of that name | | `--no-promote` | `bool` | | make the deployment ready without making it live | | `--site` | `string` | | the site to deploy to (required) | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas sites deployments` {#arianet-baas-sites-deployments} List a site's deployments, newest first (get and delete are subcommands) **Usage** ```text arianet baas sites deployments [project-id] [--site ] [flags] ``` **Aliases:** `deployment`, `deploys` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--site` | `string` | | the site (default: the project's only site) | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) **Subcommands** - [`delete`](#arianet-baas-sites-deployments-delete): Delete a deployment and its files (not the live one) - [`get`](#arianet-baas-sites-deployments-get): Show one deployment ## `arianet baas sites deployments delete` {#arianet-baas-sites-deployments-delete} Delete a deployment and its files (not the live one) **Usage** ```text arianet baas sites deployments delete [project-id] [flags] ``` **Aliases:** `rm` **Examples** ```bash arianet baas sites deployments delete 12 5 --site shop --yes ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `-y`, `--yes` | `bool` | | skip the confirmation prompt | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)), `--site` (from [`arianet baas sites deployments`](#arianet-baas-sites-deployments)) ## `arianet baas sites deployments get` {#arianet-baas-sites-deployments-get} Show one deployment **Usage** ```text arianet baas sites deployments get [project-id] [flags] ``` **Aliases:** `show` **Examples** ```bash arianet baas sites deployments get 12 7 --site shop ``` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)), `--site` (from [`arianet baas sites deployments`](#arianet-baas-sites-deployments)) ## `arianet baas sites domains` {#arianet-baas-sites-domains} Serve a site at your own hostname **Usage** ```text arianet baas sites domains ``` **Aliases:** `domain` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) **Subcommands** - [`add`](#arianet-baas-sites-domains-add): Serve a site at your own hostname; prints the CNAME and TXT records to create ## `arianet baas sites domains add` {#arianet-baas-sites-domains-add} Serve a site at your own hostname; prints the CNAME and TXT records to create **Usage** ```text arianet baas sites domains add [project-id] --site [flags] ``` **Examples** ```bash arianet baas sites domains add www.example.com --site shop ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--site` | `string` | | the site the hostname serves (required) | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas sites get` {#arianet-baas-sites-get} Show a site with its deployments and domains **Usage** ```text arianet baas sites get [project-id] [flags] ``` **Aliases:** `show` **Examples** ```bash arianet baas sites get 12 shop arianet baas sites get 12 shop -o json ``` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas sites list` {#arianet-baas-sites-list} List the project's sites with the plan's limits **Usage** ```text arianet baas sites list [project-id] [flags] ``` **Aliases:** `ls` **Examples** ```bash arianet baas sites list 12 arianet baas sites list # in a linked directory ``` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas sites rollback` {#arianet-baas-sites-rollback} Make an earlier deployment live (default: the one before the live one) **Usage** ```text arianet baas sites rollback [project-id] [deployment-id] --site [flags] ``` **Aliases:** `promote` **Examples** ```bash arianet baas sites rollback --site shop # the previous ready deployment arianet baas sites rollback 12 41 --site shop # a given one (also: promote) In a linked directory (arianet baas link) a single number is the deployment ID. ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--site` | `string` | | the site (required) | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas sites update` {#arianet-baas-sites-update} Rename a site or change its settings **Usage** ```text arianet baas sites update [project-id] [flags] ``` **Examples** ```bash arianet baas sites update 12 shop --clean-urls --header '/assets/* Cache-Control: public, max-age=600' arianet baas sites update 12 shop --name store ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--clean-urls` | `bool` | | serve /about from /about.html (and redirect /about.html to /about) | | `--clear-headers` | `bool` | | remove every header rule | | `--clear-redirects` | `bool` | | remove every redirect rule | | `--header` | `stringArray` | | a header rule '\ \: \' (path exact or a prefix ending in \*); replaces the site's header rules (repeatable) | | `--name` | `string` | | new name (the hostname moves at once; custom domains keep serving it) | | `--redirect` | `stringArray` | | a redirect rule '\ \ \[301\|302\|307\|308\]'; replaces the site's redirect rules (repeatable) | | `--spa-fallback` | `bool` | | serve /index.html for paths that are not files (single-page apps) | | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--wait` | `bool` | | wait until the operation finishes | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas snippets` {#arianet-baas-snippets} SQL snippets saved with the project (the SQL editor's) **Usage** ```text arianet baas snippets ``` **Aliases:** `snippet` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) **Subcommands** - [`create`](#arianet-baas-snippets-create): Save a SQL snippet - [`delete`](#arianet-baas-snippets-delete): Delete a snippet - [`list`](#arianet-baas-snippets-list): List the saved snippets - [`update`](#arianet-baas-snippets-update): Change a snippet (give both its name and SQL) ## `arianet baas snippets create` {#arianet-baas-snippets-create} Save a SQL snippet **Usage** ```text arianet baas snippets create [project-id] [flags] ``` **Examples** ```bash arianet baas snippets create 12 --name 'open todos' --query 'select * from todos where not done' ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `-f`, `--file` | `string` | | read the SQL from this file (- for standard input) | | `--name` | `string` | | snippet name (required) | | `--query` | `string` | | the SQL (or --file) | | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--wait` | `bool` | | wait until the operation finishes | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas snippets delete` {#arianet-baas-snippets-delete} Delete a snippet **Usage** ```text arianet baas snippets delete [project-id] [flags] ``` **Aliases:** `rm` **Examples** ```bash arianet baas snippets delete 12 5 --yes ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--wait` | `bool` | | wait until the operation finishes | | `-y`, `--yes` | `bool` | | skip the confirmation prompt | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas snippets list` {#arianet-baas-snippets-list} List the saved snippets **Usage** ```text arianet baas snippets list [project-id] [flags] ``` **Aliases:** `ls` **Examples** ```bash arianet baas snippets list 12 ``` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas snippets update` {#arianet-baas-snippets-update} Change a snippet (give both its name and SQL) **Usage** ```text arianet baas snippets update [project-id] [flags] ``` **Examples** ```bash arianet baas snippets update 12 5 --name 'open todos' --file ./open-todos.sql ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `-f`, `--file` | `string` | | read the SQL from this file (- for standard input) | | `--name` | `string` | | snippet name (required) | | `--query` | `string` | | the SQL (or --file) | | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--wait` | `bool` | | wait until the operation finishes | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas sql` {#arianet-baas-sql} Run SQL as the project's owner (one transaction) and print the result Run SQL as the project's owner: every statement in one transaction (no BEGIN or COMMIT inside), a 15 second statement timeout (the plan's when longer). Prints the rows of the last statement that returned rows (at most 1000) and every statement's command tag. Every run is recorded in your activity log. Needs the baas\:sql\:execute scope. **Usage** ```text arianet baas sql [project-id] [query] [flags] ``` **Examples** ```bash arianet baas sql 12 "select id, title from todos limit 5" arianet baas sql 12 -f seed.sql cat report.sql | arianet baas sql 12 -f - --read-only --json ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `-f`, `--file` | `string` | | read the SQL from this file (- for standard input) | | `--json` | `bool` | | print the service's answer as JSON (same as -o json) | | `--read-only` | `bool` | | run in a READ ONLY transaction | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas storage` {#arianet-baas-storage} Manage the project's buckets, files, storage policies and S3 keys **Usage** ```text arianet baas storage ``` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) **Subcommands** - [`buckets`](#arianet-baas-storage-buckets): List buckets (create and delete are subcommands) - [`copy`](#arianet-baas-storage-copy): Copy an object - [`download`](#arianet-baas-storage-download): Download an object (to the object's file name, or - for standard output) - [`ls`](#arianet-baas-storage-ls): List a folder of a bucket - [`move`](#arianet-baas-storage-move): Move or rename an object - [`policies`](#arianet-baas-storage-policies): Row level security policies of storage: who reads and writes which objects - [`rm`](#arianet-baas-storage-rm): Delete objects - [`s3-keys`](#arianet-baas-storage-s3-keys): S3 access keys (service level: they bypass the storage policies) - [`sign`](#arianet-baas-storage-sign): Make a time-limited URL of an object - [`upload`](#arianet-baas-storage-upload): Upload a file (the object path defaults to the file's name) - [`upload-url`](#arianet-baas-storage-upload-url): Make a signed URL a client can PUT one file to - [`uploads`](#arianet-baas-storage-uploads): Resumable uploads of large files (storage upload --resumable) ## `arianet baas storage buckets` {#arianet-baas-storage-buckets} List buckets (create and delete are subcommands) **Usage** ```text arianet baas storage buckets [project-id] [flags] ``` **Aliases:** `bucket` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) **Subcommands** - [`create`](#arianet-baas-storage-buckets-create): Create a bucket - [`delete`](#arianet-baas-storage-buckets-delete): Delete an empty bucket - [`empty`](#arianet-baas-storage-buckets-empty): Delete every object of a bucket - [`get`](#arianet-baas-storage-buckets-get): Show one bucket - [`update`](#arianet-baas-storage-buckets-update): Change a bucket: public, size limit, allowed types ## `arianet baas storage buckets create` {#arianet-baas-storage-buckets-create} Create a bucket **Usage** ```text arianet baas storage buckets create [project-id] [flags] ``` **Examples** ```bash arianet baas storage buckets create 12 --name avatars --public ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--name` | `string` | | bucket name (letters, digits, _ . -) (required) | | `--public` | `bool` | | objects can be read without a key | | `--size-limit` | `int64` | | largest object in bytes | | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--types` | `stringArray` | | allowed content types, e.g. image/png,image/jpeg (repeatable, or comma separated) | | `--wait` | `bool` | | wait until the operation finishes | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas storage buckets delete` {#arianet-baas-storage-buckets-delete} Delete an empty bucket **Usage** ```text arianet baas storage buckets delete [project-id] [flags] ``` **Aliases:** `rm` **Examples** ```bash arianet baas storage buckets delete 12 avatars --yes ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--wait` | `bool` | | wait until the operation finishes | | `-y`, `--yes` | `bool` | | skip the confirmation prompt | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas storage buckets empty` {#arianet-baas-storage-buckets-empty} Delete every object of a bucket **Usage** ```text arianet baas storage buckets empty [project-id] [flags] ``` **Examples** ```bash arianet baas storage buckets empty 12 avatars --yes ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--wait` | `bool` | | wait until the operation finishes | | `-y`, `--yes` | `bool` | | skip the confirmation prompt | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas storage buckets get` {#arianet-baas-storage-buckets-get} Show one bucket **Usage** ```text arianet baas storage buckets get [project-id] [flags] ``` **Aliases:** `show` **Examples** ```bash arianet baas storage buckets get 12 avatars ``` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas storage buckets update` {#arianet-baas-storage-buckets-update} Change a bucket: public, size limit, allowed types **Usage** ```text arianet baas storage buckets update [project-id] [flags] ``` **Examples** ```bash arianet baas storage buckets update 12 avatars --public=false --size-limit 5242880 --types image/png,image/jpeg ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--public` | `bool` | | objects can be read without a key | | `--size-limit` | `int64` | | largest object in bytes | | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--types` | `stringArray` | | allowed content types (repeatable, or comma separated) | | `--wait` | `bool` | | wait until the operation finishes | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas storage copy` {#arianet-baas-storage-copy} Copy an object **Usage** ```text arianet baas storage copy [project-id] [flags] ``` **Examples** ```bash arianet baas storage copy 12 avatars users/1/me.png backup/me.png ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--to-bucket` | `string` | | into this bucket (default: the same; its limits apply) | | `--upsert` | `bool` | | replace an object that exists at the destination | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas storage download` {#arianet-baas-storage-download} Download an object (to the object's file name, or - for standard output) **Usage** ```text arianet baas storage download [project-id] [local-file] [flags] ``` **Aliases:** `get` **Examples** ```bash arianet baas storage download 12 avatars users/42/me.png arianet baas storage download 12 exports report.csv - | head ``` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas storage ls` {#arianet-baas-storage-ls} List a folder of a bucket **Usage** ```text arianet baas storage ls [project-id] [prefix] [flags] ``` **Aliases:** `list` **Examples** ```bash arianet baas storage ls 12 avatars arianet baas storage ls 12 avatars users/42/ --search .png ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--limit` | `int` | | at most this many entries (1-1000) | | `--offset` | `int` | | skip this many entries | | `--search` | `string` | | only names containing this | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas storage move` {#arianet-baas-storage-move} Move or rename an object **Usage** ```text arianet baas storage move [project-id] [flags] ``` **Examples** ```bash arianet baas storage move 12 avatars old.png new.png --to-bucket archive ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--to-bucket` | `string` | | into this bucket (default: the same; its limits apply) | | `--upsert` | `bool` | | replace an object that exists at the destination | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas storage policies` {#arianet-baas-storage-policies} Row level security policies of storage: who reads and writes which objects **Usage** ```text arianet baas storage policies ``` **Aliases:** `policy` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) **Subcommands** - [`create`](#arianet-baas-storage-policies-create): Create storage policies from a template or your own expressions - [`drop`](#arianet-baas-storage-policies-drop): Drop a storage policy (table: objects or buckets) - [`list`](#arianet-baas-storage-policies-list): List the policies of storage.objects and storage.buckets - [`preview`](#arianet-baas-storage-policies-preview): Show the SQL a policy request would run (nothing is run) ## `arianet baas storage policies create` {#arianet-baas-storage-policies-create} Create storage policies from a template or your own expressions **Usage** ```text arianet baas storage policies create [project-id] [flags] ``` **Examples** ```bash arianet baas storage policies create 12 --template public_read --bucket avatars arianet baas storage policies create 12 --template own_folder --bucket uploads --operation SELECT,INSERT ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--bucket` | `string` | | the bucket the policies are for | | `--command` | `string` | | custom: ALL, SELECT, INSERT, UPDATE or DELETE | | `--data` | `string` | | the JSON request body; flags given as well override its fields | | `--file` | `string` | | read the JSON request body from this file | | `--name` | `string` | | policy name prefix | | `--operation` | `stringArray` | | SELECT, INSERT, UPDATE and/or DELETE (default: the template's) (repeatable, or comma separated) | | `--permissive` | `bool` | | custom: permissive (default) or restrictive | | `--policy-name` | `string` | | custom: the policy's name | | `--role` | `stringArray` | | custom: the roles it applies to (repeatable, or comma separated) | | `--table` | `string` | | objects (default) or buckets | | `--template` | `string` | | public_read, authenticated_read, own_folder, owner_only or custom (required) | | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--using` | `string` | | custom: USING expression | | `--wait` | `bool` | | wait until the operation finishes | | `--with-check` | `string` | | custom: WITH CHECK expression | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas storage policies drop` {#arianet-baas-storage-policies-drop} Drop a storage policy (table: objects or buckets) **Usage** ```text arianet baas storage policies drop [project-id]
[flags] ``` **Aliases:** `rm` **Examples** ```bash arianet baas storage policies drop 12 objects 'avatars read' --yes ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--wait` | `bool` | | wait until the operation finishes | | `-y`, `--yes` | `bool` | | skip the confirmation prompt | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas storage policies list` {#arianet-baas-storage-policies-list} List the policies of storage.objects and storage.buckets **Usage** ```text arianet baas storage policies list [project-id] [flags] ``` **Aliases:** `ls` **Examples** ```bash arianet baas storage policies list 12 ``` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas storage policies preview` {#arianet-baas-storage-policies-preview} Show the SQL a policy request would run (nothing is run) **Usage** ```text arianet baas storage policies preview [project-id] [flags] ``` **Examples** ```bash arianet baas storage policies preview 12 --template public_read --bucket avatars ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--bucket` | `string` | | the bucket the policies are for | | `--command` | `string` | | custom: ALL, SELECT, INSERT, UPDATE or DELETE | | `--data` | `string` | | the JSON request body; flags given as well override its fields | | `--file` | `string` | | read the JSON request body from this file | | `--name` | `string` | | policy name prefix | | `--operation` | `stringArray` | | SELECT, INSERT, UPDATE and/or DELETE (default: the template's) (repeatable, or comma separated) | | `--permissive` | `bool` | | custom: permissive (default) or restrictive | | `--policy-name` | `string` | | custom: the policy's name | | `--role` | `stringArray` | | custom: the roles it applies to (repeatable, or comma separated) | | `--table` | `string` | | objects (default) or buckets | | `--template` | `string` | | public_read, authenticated_read, own_folder, owner_only or custom (required) | | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--using` | `string` | | custom: USING expression | | `--wait` | `bool` | | wait until the operation finishes | | `--with-check` | `string` | | custom: WITH CHECK expression | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas storage rm` {#arianet-baas-storage-rm} Delete objects **Usage** ```text arianet baas storage rm [project-id] ... [flags] ``` **Aliases:** `delete` **Examples** ```bash arianet baas storage rm 12 avatars users/42/me.png users/42/old.png --yes ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `-y`, `--yes` | `bool` | | skip the confirmation prompt | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas storage s3-keys` {#arianet-baas-storage-s3-keys} S3 access keys (service level: they bypass the storage policies) **Usage** ```text arianet baas storage s3-keys ``` **Aliases:** `s3`, `s3-key` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) **Subcommands** - [`create`](#arianet-baas-storage-s3-keys-create): Create an S3 access key; its secret is shown once - [`list`](#arianet-baas-storage-s3-keys-list): List the S3 access keys (never their secrets) and the S3 endpoint - [`revoke`](#arianet-baas-storage-s3-keys-revoke): Revoke an S3 access key at once ## `arianet baas storage s3-keys create` {#arianet-baas-storage-s3-keys-create} Create an S3 access key; its secret is shown once **Usage** ```text arianet baas storage s3-keys create [project-id] [flags] ``` **Examples** ```bash arianet baas storage s3-keys create 12 --description 'backup job' ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--description` | `string` | | what the key is for | | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--wait` | `bool` | | wait until the operation finishes | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas storage s3-keys list` {#arianet-baas-storage-s3-keys-list} List the S3 access keys (never their secrets) and the S3 endpoint **Usage** ```text arianet baas storage s3-keys list [project-id] [flags] ``` **Aliases:** `ls` **Examples** ```bash arianet baas storage s3-keys list 12 ``` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas storage s3-keys revoke` {#arianet-baas-storage-s3-keys-revoke} Revoke an S3 access key at once **Usage** ```text arianet baas storage s3-keys revoke [project-id] [flags] ``` **Aliases:** `delete`, `rm` **Examples** ```bash arianet baas storage s3-keys revoke 12 ak_7Q2M9XW4 --yes ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--wait` | `bool` | | wait until the operation finishes | | `-y`, `--yes` | `bool` | | skip the confirmation prompt | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas storage sign` {#arianet-baas-storage-sign} Make a time-limited URL of an object **Usage** ```text arianet baas storage sign [project-id] [flags] ``` **Examples** ```bash arianet baas storage sign 12 invoices 2026/11/42.pdf --expires-in 600 ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--expires-in` | `int` | | seconds the URL works (default: the service's) | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas storage upload` {#arianet-baas-storage-upload} Upload a file (the object path defaults to the file's name) **Usage** ```text arianet baas storage upload [project-id] [object-path] [flags] ``` **Aliases:** `cp`, `put` **Examples** ```bash arianet baas storage upload 12 avatars ./me.png users/42/me.png --upsert ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--chunk-size` | `int64` | `16` | resumable upload chunk in MiB (1-64) | | `--content-type` | `string` | | content type to store (default: from the file extension) | | `--resumable` | `bool` | | send a large file in chunks; an interrupted upload continues with --resume | | `--resume` | `string` | | continue the resumable upload with this ID (printed when it started) | | `--upsert` | `bool` | | replace an object that exists | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas storage upload-url` {#arianet-baas-storage-upload-url} Make a signed URL a client can PUT one file to **Usage** ```text arianet baas storage upload-url [project-id] [flags] ``` **Examples** ```bash arianet baas storage upload-url 12 avatars users/42/me.png ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--upsert` | `bool` | | the upload may replace an object that exists | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas storage uploads` {#arianet-baas-storage-uploads} Resumable uploads of large files (storage upload --resumable) **Usage** ```text arianet baas storage uploads ``` **Aliases:** `upload-session` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) **Subcommands** - [`cancel`](#arianet-baas-storage-uploads-cancel): Cancel a resumable upload - [`status`](#arianet-baas-storage-uploads-status): Show where a resumable upload stands ## `arianet baas storage uploads cancel` {#arianet-baas-storage-uploads-cancel} Cancel a resumable upload **Usage** ```text arianet baas storage uploads cancel [project-id] [flags] ``` **Examples** ```bash arianet baas storage uploads cancel 12 7d3c9a1e --yes ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--wait` | `bool` | | wait until the operation finishes | | `-y`, `--yes` | `bool` | | skip the confirmation prompt | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas storage uploads status` {#arianet-baas-storage-uploads-status} Show where a resumable upload stands **Usage** ```text arianet baas storage uploads status [project-id] [flags] ``` **Examples** ```bash arianet baas storage uploads status 12 7d3c9a1e ``` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas tables` {#arianet-baas-tables} Create, change and drop tables, their columns, indexes, policies and rows **Usage** ```text arianet baas tables ``` **Aliases:** `table` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) **Subcommands** - [`alter`](#arianet-baas-tables-alter): Change a table's comment, row level security or name - [`column-types`](#arianet-baas-tables-column-types): List your enum types, for a column's type - [`columns`](#arianet-baas-tables-columns): Add, change or drop a table's columns - [`constraints`](#arianet-baas-tables-constraints): Add or drop foreign key, unique, check and primary key constraints - [`create`](#arianet-baas-tables-create): Create a table (row level security on unless --rls=false) - [`drop`](#arianet-baas-tables-drop): Drop a table and its data - [`get`](#arianet-baas-tables-get): Show a table: columns, constraints, indexes, policies, triggers - [`indexes`](#arianet-baas-tables-indexes): List, create or drop a table's indexes - [`list`](#arianet-baas-tables-list): List a schema's tables and views - [`policies`](#arianet-baas-tables-policies): Create or drop a table's row level security policies - [`rls`](#arianet-baas-tables-rls): Turn a table's row level security on or off - [`rows`](#arianet-baas-tables-rows): Read and change a table's rows - [`schemas`](#arianet-baas-tables-schemas): List the schemas tables can be in ## `arianet baas tables alter` {#arianet-baas-tables-alter} Change a table's comment, row level security or name **Usage** ```text arianet baas tables alter [project-id]
[flags] ``` **Examples** ```bash arianet baas tables alter 12 todos --name tasks --comment 'what to do' ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--comment` | `string` | | table comment ("" removes it) | | `--name` | `string` | | new name | | `--rls` | `bool` | | row level security on or off | | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--wait` | `bool` | | wait until the operation finishes | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas tables column-types` {#arianet-baas-tables-column-types} List your enum types, for a column's type **Usage** ```text arianet baas tables column-types [project-id] [flags] ``` **Examples** ```bash arianet baas tables column-types 12 ``` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas tables columns` {#arianet-baas-tables-columns} Add, change or drop a table's columns **Usage** ```text arianet baas tables columns ``` **Aliases:** `column` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) **Subcommands** - [`add`](#arianet-baas-tables-columns-add): Add a column - [`alter`](#arianet-baas-tables-columns-alter): Change a column: type, nullability, default, comment, name - [`drop`](#arianet-baas-tables-columns-drop): Drop a column and its data ## `arianet baas tables columns add` {#arianet-baas-tables-columns-add} Add a column **Usage** ```text arianet baas tables columns add [project-id]
[flags] ``` **Examples** ```bash arianet baas tables columns add 12 todos --name owner --type uuid --references auth.users.id --on-delete cascade ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--check` | `string` | | CHECK expression | | `--comment` | `string` | | column comment | | `--data` | `string` | | the JSON request body; flags given as well override its fields | | `--default` | `string` | | default expression, e.g. now() | | `--file` | `string` | | read the JSON request body from this file | | `--identity` | `string` | | identity column: always or by_default | | `--name` | `string` | | column name (required) | | `--nullable` | `bool` | | allow NULL (default true) | | `--on-delete` | `string` | | no_action, restrict, cascade, set_null or set_default | | `--on-update` | `string` | | no_action, restrict, cascade, set_null or set_default | | `--primary-key` | `bool` | | the table's primary key | | `--ref-column` | `string` | | referenced column | | `--ref-schema` | `string` | | schema of the referenced table | | `--ref-table` | `string` | | referenced table (a foreign key) | | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--type` | `string` | | column type, e.g. text, bigint, uuid, timestamptz, jsonb (required) | | `--unique` | `bool` | | unique values | | `--wait` | `bool` | | wait until the operation finishes | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas tables columns alter` {#arianet-baas-tables-columns-alter} Change a column: type, nullability, default, comment, name **Usage** ```text arianet baas tables columns alter [project-id]
[flags] ``` **Examples** ```bash arianet baas tables columns alter 12 todos title --type varchar(200) --nullable=false ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--comment` | `string` | | column comment ("" removes it) | | `--default` | `string` | | new default expression | | `--drop-default` | `bool` | | remove the default | | `--name` | `string` | | new name | | `--nullable` | `bool` | | allow NULL | | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--type` | `string` | | new type | | `--using` | `string` | | USING expression for the type change | | `--wait` | `bool` | | wait until the operation finishes | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas tables columns drop` {#arianet-baas-tables-columns-drop} Drop a column and its data **Usage** ```text arianet baas tables columns drop [project-id]
[flags] ``` **Aliases:** `rm` **Examples** ```bash arianet baas tables columns drop 12 todos notes --yes ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--cascade` | `bool` | | also drop what depends on it | | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--wait` | `bool` | | wait until the operation finishes | | `-y`, `--yes` | `bool` | | skip the confirmation prompt | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas tables constraints` {#arianet-baas-tables-constraints} Add or drop foreign key, unique, check and primary key constraints **Usage** ```text arianet baas tables constraints ``` **Aliases:** `constraint` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) **Subcommands** - [`add`](#arianet-baas-tables-constraints-add): Add a constraint - [`drop`](#arianet-baas-tables-constraints-drop): Drop a constraint ## `arianet baas tables constraints add` {#arianet-baas-tables-constraints-add} Add a constraint **Usage** ```text arianet baas tables constraints add [project-id]
[flags] ``` **Examples** ```bash arianet baas tables constraints add 12 todos --type unique --column owner,title arianet baas tables constraints add 12 todos --type foreign_key --column owner --ref-table profiles --ref-column id ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--check` | `string` | | CHECK expression | | `--column` | `stringArray` | | the constrained columns (repeatable, or comma separated) | | `--data` | `string` | | the JSON request body; flags given as well override its fields | | `--file` | `string` | | read the JSON request body from this file | | `--name` | `string` | | constraint name (default: generated) | | `--not-valid` | `bool` | | do not check the existing rows | | `--on-delete` | `string` | | no_action, restrict, cascade, set_null or set_default | | `--on-update` | `string` | | no_action, restrict, cascade, set_null or set_default | | `--ref-column` | `stringArray` | | referenced columns (repeatable, or comma separated) | | `--ref-schema` | `string` | | schema of the referenced table | | `--ref-table` | `string` | | referenced table | | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--type` | `string` | | foreign_key, unique, check or primary_key (required) | | `--wait` | `bool` | | wait until the operation finishes | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas tables constraints drop` {#arianet-baas-tables-constraints-drop} Drop a constraint **Usage** ```text arianet baas tables constraints drop [project-id]
[flags] ``` **Aliases:** `rm` **Examples** ```bash arianet baas tables constraints drop 12 todos todos_owner_fkey --yes ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--cascade` | `bool` | | also drop what depends on it | | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--wait` | `bool` | | wait until the operation finishes | | `-y`, `--yes` | `bool` | | skip the confirmation prompt | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas tables create` {#arianet-baas-tables-create} Create a table (row level security on unless --rls=false) **Usage** ```text arianet baas tables create [project-id] [flags] ``` **Examples** ```bash arianet baas tables create 12 --name todos --column id:bigint:pk:identity --column title:text:notnull \ --column done:boolean:default=false --column created_at:timestamptz:default=now() arianet baas tables create 12 --file table.json ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--column` | `stringArray` | | a column as name\:type\[\:pk\]\[\:unique\]\[\:notnull\]\[\:identity\]\[\:default=\\] (repeatable) | | `--comment` | `string` | | table comment | | `--data` | `string` | | the JSON request body; flags given as well override its fields | | `--file` | `string` | | read the JSON request body from this file | | `--name` | `string` | | table name (required) | | `--rls` | `bool` | | turn row level security on (default true) | | `--schema` | `string` | | schema (default public) | | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--wait` | `bool` | | wait until the operation finishes | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas tables drop` {#arianet-baas-tables-drop} Drop a table and its data **Usage** ```text arianet baas tables drop [project-id]
[flags] ``` **Aliases:** `delete`, `rm` **Examples** ```bash arianet baas tables drop 12 todos --yes arianet baas tables drop 12 app.orders --cascade --yes ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--cascade` | `bool` | | also drop what depends on it | | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--wait` | `bool` | | wait until the operation finishes | | `-y`, `--yes` | `bool` | | skip the confirmation prompt | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas tables get` {#arianet-baas-tables-get} Show a table: columns, constraints, indexes, policies, triggers **Usage** ```text arianet baas tables get [project-id]
[flags] ``` **Aliases:** `show` **Examples** ```bash arianet baas tables get 12 todos arianet baas tables get 12 app.orders -o json ``` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas tables indexes` {#arianet-baas-tables-indexes} List, create or drop a table's indexes **Usage** ```text arianet baas tables indexes ``` **Aliases:** `index` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) **Subcommands** - [`create`](#arianet-baas-tables-indexes-create): Create an index - [`drop`](#arianet-baas-tables-indexes-drop): Drop an index - [`list`](#arianet-baas-tables-indexes-list): List a table's indexes ## `arianet baas tables indexes create` {#arianet-baas-tables-indexes-create} Create an index **Usage** ```text arianet baas tables indexes create [project-id]
[flags] ``` **Examples** ```bash arianet baas tables indexes create 12 todos --column owner,created_at --concurrently ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--column` | `stringArray` | | indexed columns, in order (required) (repeatable, or comma separated) | | `--concurrently` | `bool` | | build without locking writes | | `--data` | `string` | | the JSON request body; flags given as well override its fields | | `--file` | `string` | | read the JSON request body from this file | | `--method` | `string` | | btree, hash, gin, gist, brin or spgist | | `--name` | `string` | | index name (default: generated) | | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--unique` | `bool` | | a unique index | | `--wait` | `bool` | | wait until the operation finishes | | `--where` | `string` | | partial index predicate | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas tables indexes drop` {#arianet-baas-tables-indexes-drop} Drop an index **Usage** ```text arianet baas tables indexes drop [project-id]
[flags] ``` **Aliases:** `rm` **Examples** ```bash arianet baas tables indexes drop 12 todos todos_owner_created_at_idx --concurrently --yes ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--concurrently` | `bool` | | drop without locking writes | | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--wait` | `bool` | | wait until the operation finishes | | `-y`, `--yes` | `bool` | | skip the confirmation prompt | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas tables indexes list` {#arianet-baas-tables-indexes-list} List a table's indexes **Usage** ```text arianet baas tables indexes list [project-id]
[flags] ``` **Aliases:** `ls` **Examples** ```bash arianet baas tables indexes list 12 todos ``` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas tables list` {#arianet-baas-tables-list} List a schema's tables and views **Usage** ```text arianet baas tables list [project-id] [flags] ``` **Aliases:** `ls` **Examples** ```bash arianet baas tables list 12 arianet baas tables list 12 --schema app ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--schema` | `string` | | schema (default public) | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas tables policies` {#arianet-baas-tables-policies} Create or drop a table's row level security policies **Usage** ```text arianet baas tables policies ``` **Aliases:** `policy` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) **Subcommands** - [`create`](#arianet-baas-tables-policies-create): Create a policy (USING and WITH CHECK are SQL expressions) - [`drop`](#arianet-baas-tables-policies-drop): Drop a policy ## `arianet baas tables policies create` {#arianet-baas-tables-policies-create} Create a policy (USING and WITH CHECK are SQL expressions) **Usage** ```text arianet baas tables policies create [project-id]
[flags] ``` **Examples** ```bash arianet baas tables policies create 12 todos --name "own rows" --command ALL --role authenticated \ --using "owner = auth.uid()" --with-check "owner = auth.uid()" ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--command` | `string` | | ALL, SELECT, INSERT, UPDATE or DELETE (default ALL) | | `--name` | `string` | | policy name (required) | | `--permissive` | `bool` | | permissive (default) or, with --permissive=false, restrictive | | `--role` | `stringArray` | | roles it applies to (default public) (repeatable, or comma separated) | | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--using` | `string` | | USING expression | | `--wait` | `bool` | | wait until the operation finishes | | `--with-check` | `string` | | WITH CHECK expression | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas tables policies drop` {#arianet-baas-tables-policies-drop} Drop a policy **Usage** ```text arianet baas tables policies drop [project-id]
[flags] ``` **Aliases:** `rm` **Examples** ```bash arianet baas tables policies drop 12 todos 'owners read' --yes ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--wait` | `bool` | | wait until the operation finishes | | `-y`, `--yes` | `bool` | | skip the confirmation prompt | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas tables rls` {#arianet-baas-tables-rls} Turn a table's row level security on or off **Usage** ```text arianet baas tables rls ``` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) **Subcommands** - [`disable`](#arianet-baas-tables-rls-disable): Turn row level security off (every role reads everything it is granted) - [`enable`](#arianet-baas-tables-rls-enable): Turn row level security on ## `arianet baas tables rls disable` {#arianet-baas-tables-rls-disable} Turn row level security off (every role reads everything it is granted) **Usage** ```text arianet baas tables rls disable [project-id]
[flags] ``` **Aliases:** `off` **Examples** ```bash arianet baas tables rls disable 12 todos --yes ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--wait` | `bool` | | wait until the operation finishes | | `-y`, `--yes` | `bool` | | skip the confirmation prompt | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas tables rls enable` {#arianet-baas-tables-rls-enable} Turn row level security on **Usage** ```text arianet baas tables rls enable [project-id]
[flags] ``` **Aliases:** `on` **Examples** ```bash arianet baas tables rls enable 12 todos ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--force` | `bool` | | also for the table's owner | | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--wait` | `bool` | | wait until the operation finishes | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas tables rows` {#arianet-baas-tables-rows} Read and change a table's rows **Usage** ```text arianet baas tables rows ``` **Aliases:** `row` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) **Subcommands** - [`delete`](#arianet-baas-tables-rows-delete): Delete rows named by their primary keys (at most 100) - [`insert`](#arianet-baas-tables-rows-insert): Insert rows (at most 100) - [`list`](#arianet-baas-tables-rows-list): Show a page of rows - [`update`](#arianet-baas-tables-rows-update): Change one row, named by its whole primary key ## `arianet baas tables rows delete` {#arianet-baas-tables-rows-delete} Delete rows named by their primary keys (at most 100) **Usage** ```text arianet baas tables rows delete [project-id]
[flags] ``` **Aliases:** `rm` **Examples** ```bash arianet baas tables rows delete 12 todos --key '{"id":1}' --key '{"id":2}' ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--key` | `stringArray` | | a primary key as a JSON object (required) (repeatable JSON) | | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--wait` | `bool` | | wait until the operation finishes | | `-y`, `--yes` | `bool` | | skip the confirmation prompt | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas tables rows insert` {#arianet-baas-tables-rows-insert} Insert rows (at most 100) **Usage** ```text arianet baas tables rows insert [project-id]
[flags] ``` **Examples** ```bash arianet baas tables rows insert 12 todos --row '{"title":"milk"}' --row '{"title":"bread"}' ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--data` | `string` | | the JSON request body; flags given as well override its fields | | `--file` | `string` | | read the JSON request body from this file | | `--row` | `stringArray` | | a row as a JSON object (repeatable JSON) | | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--wait` | `bool` | | wait until the operation finishes | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas tables rows list` {#arianet-baas-tables-rows-list} Show a page of rows **Usage** ```text arianet baas tables rows list [project-id]
[flags] ``` **Aliases:** `ls` **Examples** ```bash arianet baas tables rows list 12 todos --limit 20 --order created_at.desc --filter 'done.eq.false' ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--filter` | `string` | | filter, e.g. done.eq.false | | `--limit` | `string` | | rows per page | | `--offset` | `string` | | skip this many rows | | `--order` | `string` | | order, e.g. created_at.desc | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas tables rows update` {#arianet-baas-tables-rows-update} Change one row, named by its whole primary key **Usage** ```text arianet baas tables rows update [project-id]
[flags] ``` **Examples** ```bash arianet baas tables rows update 12 todos --key '{"id":1}' --set '{"done":true}' ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--key` | `string` | | the primary key as a JSON object (required) | | `--set` | `string` | | the new values as a JSON object (required) | | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--wait` | `bool` | | wait until the operation finishes | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas tables schemas` {#arianet-baas-tables-schemas} List the schemas tables can be in **Usage** ```text arianet baas tables schemas [project-id] [flags] ``` **Examples** ```bash arianet baas tables schemas 12 ``` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas transfer` {#arianet-baas-transfer} Move a project to another Arianet account (it accepts within 7 days) **Usage** ```text arianet baas transfer [project-id] [flags] ``` **Examples** ```bash arianet baas transfer 12 --to 123 --confirm abcdefghij0123456789 arianet baas transfer list --direction incoming ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--confirm` | `string` | | the project's ref, typed to confirm (required) | | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--to` | `int64` | | the account ID to move the project to (required) | | `--wait` | `bool` | | wait until the operation finishes | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) **Subcommands** - [`accept`](#arianet-baas-transfer-accept): Accept a transfer to your account (billed as a new project of its plan) - [`cancel`](#arianet-baas-transfer-cancel): Cancel the project's pending transfer - [`decline`](#arianet-baas-transfer-decline): Decline a transfer to your account - [`list`](#arianet-baas-transfer-list): List pending transfers to or from your account - [`status`](#arianet-baas-transfer-status): Show the project's pending transfer ## `arianet baas transfer accept` {#arianet-baas-transfer-accept} Accept a transfer to your account (billed as a new project of its plan) **Usage** ```text arianet baas transfer accept [flags] ``` **Examples** ```bash arianet baas transfer accept 31 --wait ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--wait` | `bool` | | wait until the operation finishes | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas transfer cancel` {#arianet-baas-transfer-cancel} Cancel the project's pending transfer **Usage** ```text arianet baas transfer cancel [project-id] [flags] ``` **Examples** ```bash arianet baas transfer cancel 12 --yes ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--wait` | `bool` | | wait until the operation finishes | | `-y`, `--yes` | `bool` | | skip the confirmation prompt | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas transfer decline` {#arianet-baas-transfer-decline} Decline a transfer to your account **Usage** ```text arianet baas transfer decline [flags] ``` **Examples** ```bash arianet baas transfer decline 31 ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--wait` | `bool` | | wait until the operation finishes | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas transfer list` {#arianet-baas-transfer-list} List pending transfers to or from your account **Usage** ```text arianet baas transfer list [flags] ``` **Aliases:** `ls` **Examples** ```bash arianet baas transfer list arianet baas transfer list --direction outgoing ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--direction` | `string` | | incoming or outgoing | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas transfer status` {#arianet-baas-transfer-status} Show the project's pending transfer **Usage** ```text arianet baas transfer status [project-id] [flags] ``` **Examples** ```bash arianet baas transfer status 12 ``` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas types` {#arianet-baas-types} Alias of gen types: generate TypeScript types of the database Generate a TypeScript Database type of the project's schemas: per schema, Tables with Row (what a select returns), Insert and Update, their Relationships, Views, Functions (Args, Returns), Enums and CompositeTypes, plus the Tables\<\>, TablesInsert\<\>, TablesUpdate\<\> and Enums\<\> helpers. Pass it to a typed client library as its database type parameter. In a region without the types endpoint the types are generated here from the table introspection (Tables and Views only). **Usage** ```text arianet baas types [project-id] [flags] ``` **Examples** ```bash arianet baas gen types --lang typescript --file src/database.types.ts arianet baas gen types 12 --schema public,app > types.ts ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--file` | `string` | | write to this file instead of standard output | | `--lang` | `string` | `ts` | output language: typescript (or ts) | | `--schema` | `stringSlice` | `[public]` | schemas to include (repeatable or comma separated) | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas unlink` {#arianet-baas-unlink} Remove this directory's project link **Usage** ```text arianet baas unlink [flags] ``` **Examples** ```bash arianet baas unlink ``` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas usage` {#arianet-baas-usage} Show this month's use against the plan **Usage** ```text arianet baas usage [project-id] [flags] ``` **Examples** ```bash arianet baas usage 12 ``` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas vault` {#arianet-baas-vault} Secrets stored encrypted with the project's own key, readable from your SQL **Usage** ```text arianet baas vault ``` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) **Subcommands** - [`create`](#arianet-baas-vault-create): Store a secret, encrypted with the project's own key - [`delete`](#arianet-baas-vault-delete): Delete a secret - [`list`](#arianet-baas-vault-list): List the secrets (never their values) - [`reveal`](#arianet-baas-vault-reveal): Show a secret's value; recorded in your activity log - [`update`](#arianet-baas-vault-update): Change a secret's name, description or value ## `arianet baas vault create` {#arianet-baas-vault-create} Store a secret, encrypted with the project's own key **Usage** ```text arianet baas vault create [project-id] [flags] ``` **Examples** ```bash arianet baas vault create 12 --name stripe_key --value-file ./stripe.key printf %s "$KEY" | arianet baas vault create 12 --name api_key --value-file - ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--description` | `string` | | what it is for | | `--name` | `string` | | secret name | | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--value` | `string` | | the value (it stays in your shell history; prefer --value-file) | | `--value-file` | `string` | | read the value from this file (- for standard input) | | `--wait` | `bool` | | wait until the operation finishes | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas vault delete` {#arianet-baas-vault-delete} Delete a secret **Usage** ```text arianet baas vault delete [project-id] [flags] ``` **Aliases:** `rm` **Examples** ```bash arianet baas vault delete 12 9 --yes ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--wait` | `bool` | | wait until the operation finishes | | `-y`, `--yes` | `bool` | | skip the confirmation prompt | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas vault list` {#arianet-baas-vault-list} List the secrets (never their values) **Usage** ```text arianet baas vault list [project-id] [flags] ``` **Aliases:** `ls` **Examples** ```bash arianet baas vault list 12 ``` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas vault reveal` {#arianet-baas-vault-reveal} Show a secret's value; recorded in your activity log **Usage** ```text arianet baas vault reveal [project-id] [flags] ``` **Examples** ```bash arianet baas vault reveal 12 9 ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--wait` | `bool` | | wait until the operation finishes | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas vault update` {#arianet-baas-vault-update} Change a secret's name, description or value **Usage** ```text arianet baas vault update [project-id] [flags] ``` **Examples** ```bash arianet baas vault update 12 9 --value-file ./payment.key arianet baas vault update 12 9 --description 'live key' ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--description` | `string` | | what it is for | | `--name` | `string` | | secret name | | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--value` | `string` | | the value (it stays in your shell history; prefer --value-file) | | `--value-file` | `string` | | read the value from this file (- for standard input) | | `--wait` | `bool` | | wait until the operation finishes | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas webhooks` {#arianet-baas-webhooks} Database Webhooks: POST a table's inserts, updates and deletes to a URL **Usage** ```text arianet baas webhooks ``` **Aliases:** `webhook` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) **Subcommands** - [`create`](#arianet-baas-webhooks-create): Create a webhook; its signing secret is shown once - [`delete`](#arianet-baas-webhooks-delete): Delete a webhook, its trigger and its queued events - [`deliveries`](#arianet-baas-webhooks-deliveries): Show a webhook's deliveries (7 days) - [`get`](#arianet-baas-webhooks-get): Show one webhook - [`list`](#arianet-baas-webhooks-list): List the webhooks - [`update`](#arianet-baas-webhooks-update): Change a webhook (the flags given; the rest stays) ## `arianet baas webhooks create` {#arianet-baas-webhooks-create} Create a webhook; its signing secret is shown once **Usage** ```text arianet baas webhooks create [project-id] [flags] ``` **Examples** ```bash arianet baas webhooks create 12 --name orders --table orders --event INSERT,UPDATE --url https://example.com/hooks/orders ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--dry-run` | `bool` | | only show the SQL it would run | | `--enabled` | `bool` | | send events (default true) | | `--event` | `stringArray` | | INSERT, UPDATE and/or DELETE (required) (repeatable, or comma separated) | | `--header` | `stringArray` | | a request header (repeatable name=value) | | `--name` | `string` | | webhook name (required) | | `--schema` | `string` | | the table's schema (default public) | | `--table` | `string` | | the table whose changes it sends (required) | | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--timeout-ms` | `int64` | | the request timeout in milliseconds | | `--url` | `string` | | the https URL it POSTs to (required) | | `--wait` | `bool` | | wait until the operation finishes | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas webhooks delete` {#arianet-baas-webhooks-delete} Delete a webhook, its trigger and its queued events **Usage** ```text arianet baas webhooks delete [project-id] [flags] ``` **Aliases:** `rm` **Examples** ```bash arianet baas webhooks delete 12 4 --yes ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--wait` | `bool` | | wait until the operation finishes | | `-y`, `--yes` | `bool` | | skip the confirmation prompt | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas webhooks deliveries` {#arianet-baas-webhooks-deliveries} Show a webhook's deliveries (7 days) **Usage** ```text arianet baas webhooks deliveries [project-id] [flags] ``` **Examples** ```bash arianet baas webhooks deliveries 12 4 --status failed --limit 20 ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--before` | `string` | | the next page: deliveries before this ID | | `--limit` | `string` | | at most this many | | `--status` | `string` | | only retrying, success or failed | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas webhooks get` {#arianet-baas-webhooks-get} Show one webhook **Usage** ```text arianet baas webhooks get [project-id] [flags] ``` **Aliases:** `show` **Examples** ```bash arianet baas webhooks get 12 4 ``` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas webhooks list` {#arianet-baas-webhooks-list} List the webhooks **Usage** ```text arianet baas webhooks list [project-id] [flags] ``` **Aliases:** `ls` **Examples** ```bash arianet baas webhooks list 12 ``` **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas)) ## `arianet baas webhooks update` {#arianet-baas-webhooks-update} Change a webhook (the flags given; the rest stays) **Usage** ```text arianet baas webhooks update [project-id] [flags] ``` **Examples** ```bash arianet baas webhooks update 12 4 --enabled=false ``` **Flags** | Flag | Type | Default | Description | |---|---|---|---| | `--dry-run` | `bool` | | only show the SQL it would run | | `--enabled` | `bool` | | send events (default true) | | `--event` | `stringArray` | | INSERT, UPDATE and/or DELETE (repeatable, or comma separated) | | `--header` | `stringArray` | | a request header (repeatable name=value) | | `--name` | `string` | | webhook name | | `--schema` | `string` | | the table's schema (default public) | | `--table` | `string` | | the table whose changes it sends | | `--timeout` | `duration` | `15m0s` | how long --wait waits | | `--timeout-ms` | `int64` | | the request timeout in milliseconds | | `--url` | `string` | | the https URL it POSTs to | | `--wait` | `bool` | | wait until the operation finishes | **Inherited flags:** `--region` (from [`arianet baas`](#arianet-baas))