Migrate from Appwrite
Move an Appwrite project to Aurabase without resetting user passwords: map collections to dedicated PostgreSQL 18 tables (or a dedicated MongoDB-engine NoSQL project), import Argon2id/bcrypt hashes via aura.authAdmin.importUsers(), and replace document permissions with PostgreSQL RLS.
Quick answer#
To migrate from Appwrite to Aurabase, export your Appwrite collections via the Appwrite Server SDK (node-appwrite), load them into a dedicated PostgreSQL 18 project (or into a dedicated --engine mongodb project if you want schema-less JSON collections via aura.nosql), batch-import Appwrite users with aura.authAdmin.importUsers() (Appwrite's default Argon2id and bcrypt hashes work without password resets), and translate Permission.read(Role.user()) rules into PostgreSQL Row-Level Security policies.
Component mapping#
| Appwrite | Aurabase equivalent | Migration notes |
|---|---|---|
| Appwrite Databases & Collections | Dedicated PostgreSQL 18 or --engine mongodb NoSQL project | Pick Postgres 18 for relational SQL, joins, RLS & pgvector; pick --engine mongodb for flexible JSON documents |
Document Permissions (Role.user(), Role.team()) | Native PostgreSQL RLS (auth.uid(), JWT claims) | Evaluated inside Postgres across REST, Realtime CDC, and MCP |
Appwrite Auth (argon2 / bcrypt) | Aurabase Auth (OAuth 2.1, Passkeys, TOTP MFA) | Argon2id and bcrypt hashes import directly (up to 1,000 users/batch) |
| Appwrite Storage | Sovereign S3 Storage (SeaweedFS) | S3-compatible buckets with signed URLs, image transforms & per-path RLS |
| Appwrite Functions | Edge Functions (Deno/TypeScript or WASM) | Port to standard Deno.serve() and deploy with aura functions deploy |
| Appwrite Realtime | Aurabase Realtime (WebSockets/SSE + NATS CDC) | Column-filtered Postgres CDC, Presence, and Broadcast |
1. Choose PostgreSQL 18 vs. NoSQL engine#
Aurabase /v1/nosql routes only exist on a project created with --engine mongodb (aura projects create my-app --engine mongodb). A standard PostgreSQL 18 project uses SQL tables + jsonb columns + PostgREST. Choose PostgreSQL 18 if you want joins, strict foreign keys, pgvector, and full SQL RLS; choose MongoDB engine only if your app relies heavily on schemaless BSON/JSON collections and aggregation pipelines.
2. Export and load Appwrite collections#
Use node-appwrite to paginate through every collection (Query.limit(100) + Query.cursorAfter) and load rows in batches into Aurabase:
import { Client, Databases, Query } from 'node-appwrite'
import { createClient } from '@aurabase/aurabase-js'
const appwrite = new Client()
.setEndpoint(process.env.APPWRITE_ENDPOINT!)
.setProject(process.env.APPWRITE_PROJECT_ID!)
.setKey(process.env.APPWRITE_API_KEY!)
const databases = new Databases(appwrite)
const aura = createClient(
process.env.NEXT_PUBLIC_AURABASE_URL!,
process.env.AURABASE_SERVICE_ROLE_KEY!,
)
async function migrateCollection(databaseId: string, collectionId: string, targetTable: string) {
let cursor: string | undefined
while (true) {
const queries = [Query.limit(100), ...(cursor ? [Query.cursorAfter(cursor)] : [])]
const page = await databases.listDocuments(databaseId, collectionId, queries)
if (page.documents.length === 0) break
const rows = page.documents.map(({ $id, $createdAt, $updatedAt, $permissions, $databaseId, $collectionId, ...fields }) => ({
legacy_id: $id,
created_at: $createdAt,
updated_at: $updatedAt,
...fields,
}))
const { error } = await aura.from(targetTable).insert(rows)
if (error) throw new Error(`Insert failed on ${targetTable}: ${error.message}`)
cursor = page.documents[page.documents.length - 1].$id
if (page.documents.length < 100) break
}
}3. Import Appwrite users without password resets#
Modern Appwrite instances hash passwords with Argon2id ($argon2id$v=19$...) or bcrypt ($2a$/$2b$/$2y$). Both are accepted natively by aura.authAdmin.importUsers() (up to 1,000 users per batch; bcrypt hashes auto-upgrade to Argon2id on first login):
import { Client, Users, Query } from 'node-appwrite'
import { createClient } from '@aurabase/aurabase-js'
const appwrite = new Client()
.setEndpoint(process.env.APPWRITE_ENDPOINT!)
.setProject(process.env.APPWRITE_PROJECT_ID!)
.setKey(process.env.APPWRITE_API_KEY!)
const usersApi = new Users(appwrite)
const aura = createClient(
process.env.NEXT_PUBLIC_AURABASE_URL!,
process.env.AURABASE_SERVICE_ROLE_KEY!,
)
let cursor: string | undefined
while (true) {
const queries = [Query.limit(100), ...(cursor ? [Query.cursorAfter(cursor)] : [])]
const page = await usersApi.list(queries)
if (page.users.length === 0) break
const batch = page.users
.filter((u) => Boolean(u.email))
.map((u) => ({
email: u.email,
emailVerified: u.emailVerification,
...(u.password && /^\$(argon2id|2[aby])\$/.test(u.password) ? { passwordHash: u.password } : {}),
...(u.name ? { name: u.name } : {}),
userMetadata: { legacy_appwrite_id: u.$id, prefs: u.prefs },
}))
const { data, error } = await aura.authAdmin.importUsers(batch)
if (error) throw new Error(`User import failed: ${error.message}`)
console.log(`Imported batch: created=${data.created} skipped=${data.skipped} errors=${data.errors}`)
cursor = page.users[page.users.length - 1].$id
if (page.users.length < 100) break
}If older Appwrite accounts used sha256, md5, or scrypt, omit passwordHash when calling importUsers() so the account is still created cleanly, then let those users sign in with a Magic Link or password reset flow.
4. Convert Appwrite Permissions to PostgreSQL RLS#
| Appwrite Permission | Equivalent Aurabase PostgreSQL RLS |
|---|---|
Permission.read(Role.any()) | FOR SELECT TO aura_anon, aura_authenticated USING (true) |
Permission.read(Role.users()) | FOR SELECT TO aura_authenticated USING (true) |
Permission.read(Role.user(userId)) | FOR SELECT TO aura_authenticated USING (user_id = auth.uid()) |
Permission.write(Role.user(userId)) | FOR ALL TO aura_authenticated USING (user_id = auth.uid()) WITH CHECK (user_id = auth.uid()) |
Permission.read(Role.team(teamId)) | USING (EXISTS (SELECT 1 FROM team_members tm WHERE tm.team_id = rows.team_id AND tm.user_id = auth.uid())) |
ALTER TABLE documents ENABLE ROW LEVEL SECURITY;
CREATE POLICY documents_owner_all ON documents
FOR ALL TO aura_authenticated
USING (user_id = auth.uid())
WITH CHECK (user_id = auth.uid());5. Migrate Storage, Functions & SDK calls#
- Storage: download files with
storage.getFileDownload(bucketId, fileId)from Appwrite and upload to Aurabase withaura.storage.from(bucket).upload(path, buffer, { contentType }). - Functions: convert Appwrite's
({ req, res }) => res.json(...)entrypoint to standard WebDeno.serve(async (req) => Response.json(...))and deploy viaaura functions deploy. - Client SDK:
// BEFORE (Appwrite)
// const res = await databases.listDocuments(DB_ID, 'tasks', [Query.equal('status', 'open')])
// AFTER (Aurabase)
const { data: tasks, error } = await aura
.from('tasks')
.select('*')
.eq('status', 'open')IDs, Teams & common pitfalls#
- Appwrite
$idvs. Postgres UUID: Appwrite IDs are 20-character alphanumeric strings (ID.unique()), not RFC 4122 UUIDs. Store the old$idin alegacy_id text UNIQUEcolumn when migrating foreign references, or keepid text PRIMARY KEYon migrated tables. - Appwrite Teams: model teams explicitly with
teams+team_members(team_id, user_id, role)tables and enforce access with a single indexed RLSEXISTScheck (see Multi-tenant RBAC). - Document-level permissions arrays: instead of duplicating permission arrays on every row, normalize ownership (
user_id,team_id,is_public) into indexed columns so PostgreSQL can use B-tree indexes inside RLS policies.