# 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. ## BaaS documentation - [Arianet BaaS](https://docs.ariaservice.net/en/baas.md): 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). - [Arianet BaaS quickstart](https://docs.ariaservice.net/en/baas/quickstart.md): 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. - [Start with no tech background: what GitHub and GitLab are and how to connect your project](https://docs.ariaservice.net/en/baas/github-for-beginners.md): 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. - [Build with AI (vibe coding) on Arianet](https://docs.ariaservice.net/en/baas/build-with-ai.md): 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. - [Projects and creating a Project](https://docs.ariaservice.net/en/baas/projects.md): The Arianet BaaS Project list, the steps of creating a Project (name, Region, Plan, review), Project states and the Overview page. - [Table Editor](https://docs.ariaservice.net/en/baas/table-editor.md): 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. - [Database](https://docs.ariaservice.net/en/baas/database.md): 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. - [SQL Editor](https://docs.ariaservice.net/en/baas/sql-editor.md): 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. - [Auth: your app's users](https://docs.ariaservice.net/en/baas/auth.md): 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. - [Storage: files](https://docs.ariaservice.net/en/baas/storage.md): 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. - [Edge Functions](https://docs.ariaservice.net/en/baas/functions.md): 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. - [Realtime](https://docs.ariaservice.net/en/baas/realtime.md): 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. - [Sites: frontend hosting](https://docs.ariaservice.net/en/baas/sites.md): 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. - [Git and Deploy](https://docs.ariaservice.net/en/baas/git.md): 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. - [Backup and restore](https://docs.ariaservice.net/en/baas/backups.md): 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. - [Direct connections and Database Settings](https://docs.ariaservice.net/en/baas/database-settings.md): 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. - [Integrations](https://docs.ariaservice.net/en/baas/integrations.md): 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. - [API Keys and Connect](https://docs.ariaservice.net/en/baas/api-keys.md): 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. - [Usage and limits](https://docs.ariaservice.net/en/baas/usage.md): 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. - [Account quota and increases](https://docs.ariaservice.net/en/baas/quotas.md): 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. - [Logs](https://docs.ariaservice.net/en/baas/logs.md): 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. - [Advisors, Reports, Custom Domains and Members](https://docs.ariaservice.net/en/baas/platform.md): 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. - [Project settings](https://docs.ariaservice.net/en/baas/settings.md): 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. - [REST API reference](https://docs.ariaservice.net/en/baas/rest-api.md): 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. - [Auth API reference](https://docs.ariaservice.net/en/baas/auth-api.md): 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. - [Storage API reference](https://docs.ariaservice.net/en/baas/storage-api.md): 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. - [CLI: the arianet baas commands](https://docs.ariaservice.net/en/baas/cli.md): 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. - [Security and best practices](https://docs.ariaservice.net/en/baas/security.md): 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. - [Arianet BaaS FAQ](https://docs.ariaservice.net/en/baas/faq.md): Arianet BaaS FAQ - automatic pause of Projects, limits, upgrading the Plan, Backups and moving an existing app by changing the URL and key. - [Connect AI assistants](https://docs.ariaservice.net/en/ai-assistants.md): 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. - [arianet baas](https://docs.ariaservice.net/en/cli-reference/baas.md): arianet baas command reference: Manage BaaS projects: database, SQL, migrations, keys, storage, auth, edge functions, sites, realtime, cron, backups ## Optional - [baas/llms-full.txt](https://docs.ariaservice.net/en/baas/llms-full.txt): Every BaaS page in one file - [llms.txt](https://docs.ariaservice.net/en/llms.txt): The whole Arianet documentation (cloud, VPS, hosting, CLI, …) - [baas/llms.txt](https://docs.ariaservice.net/baas/llms.txt): Persian version of these docs (the default language of the site)