Move your app to Arianet BaaS
If your app runs today on another Postgres-based BaaS, you do not rewrite it. The Arianet BaaS client protocol is compatible with the common Postgres/BaaS client libraries: REST, Auth, Storage, Realtime and Edge Functions keep working with the same code, and only the URL and key change.
This page walks through the whole move in order: the Project, the database schema, Users, data, files, functions and finally the app.
What works unchanged
| Part | In your app |
|---|---|
| REST API | from(...).select/insert/update/upsert/delete, filters, ordering, pagination and rpc, with the same error codes |
| Auth | email and password, Magic Link, OTP, anonymous sign-in, OAuth, MFA, session refresh |
| Storage | public and private buckets, file Policies, signed URLs, resumable uploads and S3 access |
| Realtime | Broadcast, Presence and live database changes, with RLS applied |
| Edge Functions | functions.invoke and Deno.serve handlers |
| Policies | Policies written with auth.uid(), auth.jwt() and the roles anon, authenticated and service_role |
The GraphQL endpoint is not offered yet. If your app depends on it, check before moving.
1. Create a Project
Create a Project in the panel (see the quickstart). The database is ready in about two minutes. Then link the CLI to your app's folder:
arianet baas link <project-id>
2. Move the database schema
If your app has migration files, put them in arianet/migrations/ and apply them:
arianet baas db push
Without migrations, dump the structure of your own tables from the source database. Take only your own schemas (usually public); the previous service's internal schemas (auth, storage and the like) already exist in Arianet BaaS:
pg_dump "<source-connection-string>" --schema-only --schema=public \
--no-owner --no-privileges > schema.sql
Run schema.sql in the SQL Editor, or with psql over the direct connection:
psql "<arianet-connection-string>" -f schema.sql
Your RLS Policies, functions, triggers and views come with that file. Turn on the extensions you need under Database → Extensions first.
3. Move Users with their existing passwords
Users are created through the Admin endpoint. If the previous service stored passwords with bcrypt (hashes starting with $2a$, $2b$ or $2y$), send the hash in password_hash and the User signs in with the same password as before.
List the Users from the source database (adjust the table and column names of the previous service):
select id, email, phone, encrypted_password, email_confirmed_at is not null as email_confirm,
raw_user_meta_data
from auth.users;
Then create each User with the Service Key, only from a server or your own machine:
curl -X POST "https://<ref>.baas.arianet.app/auth/v1/admin/users" \
-H "apikey: <SERVICE_KEY>" -H "Authorization: Bearer <SERVICE_KEY>" \
-H "Content-Type: application/json" \
-d '{"id": "<old-user-id>", "email": "sara@example.com", "password_hash": "$2a$10$...",
"email_confirm": true, "user_metadata": {"name": "Sara"}}'
Keeping each User's previous id keeps every column that points at auth.uid() (such as user_id in your tables) correct. Create the Users before the data, so tables that reference auth.users load without errors. If the password hashes use another format, Users sign in with phone OTP or a Magic Link and set a new password.
4. Move the data
pg_dump "<source-connection-string>" --data-only --schema=public \
--no-owner --no-privileges > data.sql
psql "<arianet-connection-string>" -f data.sql
For a single table a CSV export is enough: arianet baas db import <table> <file.csv>.
5. Move Storage files
Create the buckets in Storage with the same names and the same public or private setting, and run your file Policies in the SQL Editor. Copy the files one of two ways:
-
S3: create an S3 key under S3 access and copy whole buckets with
aws-cliorrclone:aws s3 sync ./avatars s3://avatars --endpoint-url https://<ref>.baas.arianet.app/storage/v1/s3 -
CLI: file by file with
arianet baas storage upload <bucket> <file> <path>; add--resumablefor large files.
Keep the object paths as they were (for example users/<user-id>/avatar.png) so folder-based Policies and paths stored in your database stay correct.
6. Move Edge Functions
Put each function in arianet/functions/<name>/index.ts. Handlers written with Deno.serve run unchanged. Define the secrets in the panel or with the CLI and deploy:
arianet baas functions deploy
Details in Edge Functions.
7. Switch the URL and key in your app
arianet baas env > .env.local
This writes the Project URL and Anon Key under the common framework names (Next.js, Vite, Nuxt, Expo). In your code only the URL and key change:
const client = createClient(
'https://<ref>.baas.arianet.app', // your Arianet BaaS Project URL
'<ANON_KEY>' // the Anon Key from "API Keys & connection"
)
8. Test and cut over
- Run the app against the new Project and try sign-in, reading and writing data, file upload and Realtime.
- Check the Advisors for tables without RLS or missing indexes.
- To cut over, pause writes in the old app briefly, move the latest data again with step 4 and release the new version of your app.
- If you have a front end, publish it on Sites with your own domain and deploy every push automatically with Git & Deploy.