Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Supabase 6 min read How-to mediumAdept

Migrating from Fauna to Supabase

With Fauna sunsetting by the end of May 2025, a two-phase migration to Supabase keeps applications online. Phase one exports Fauna collections to S3 as JSON via the Fauna CLI, loads each document into a Postgres JSONB column with a supabase-js script, and rewrites FQL calls as PostgREST queries using JSON operators. Phase two normalizes the JSONB into relational tables with SQL (including LATERAL jsonb_array_elements for nested arrays) and switches API calls to the normalized columns. Tradeoffs include upfront schema planning, normalization scripts for nested documents, translating FQL/GraphQL to SQL, and adding indexes afterward.

Related posts

  • Migrating from the MongoDB Data API to Supabase

    Supabase mediumAdept

    With MongoDB's Data API and HTTPS Endpoints reaching end-of-life on September 30, 2025, Supabase's auto-generated PostgREST API is offered as a near drop-in REST replacement. The migration path is to export collections with mongoexport, load documents into a Postgres table with a JSONB column via a supabase-js script, then normalize them into relational tables using Postgres JSON functions and LATERAL jsonb_array_elements. Client code then queries the generated REST endpoints, including embedded related rows. Tradeoffs include less schema flexibility than MongoDB, the need for document transformation scripts, and rethinking query patterns and indexes for relational joins.

  • Supabase Local Dev: migrations, branching, and observability

    Supabase easyNovice

    Supabase's CLI gains a batch of Postgres local-development features: `supabase inspect db` with 19 diagnostic commands adapted from Heroku's pg-extras, `db dump` backups built on pg_dump, migration squashing and diffing via migra, pgTAP testing with `supabase test`, plpgsql_check linting, seeding, and TypeScript type generation that now detects foreign-key relationships. Local logs are viewable in the dashboard, and the CLI moves to a fortnightly stable-release cycle with a beta channel. Branching enters alpha: each GitHub pull request gets an isolated Firecracker-based preview environment that runs the repo's migrations and seed.sql, with migrations applied to production on merge. Production data cloning is deliberately deferred until copy-on-write with anonymization is judged safe.

  • Supabase CLI v1 and Management API Beta

    Supabase mediumAdept

    Supabase CLI v1 leaves beta with commands to manage organizations, projects and Edge Functions, plus database migration tooling, CI/CD workflows and TypeScript type generation. Schema diffing adds an experimental migra backend (`db diff --use-migra`), which runs faster and emits more concise DDL than the previous PgAdmin-based approach, which mishandled default privileges in role grants. Local database branching lets developers test manual migrations without data loss, and `db push` plus a GitHub Actions example cover releasing to staging and production. A beta REST Management API, already used by the CLI, exposes project and organization management for automation and future Terraform/Pulumi integrations.

  • NoSQL Postgres: Add MongoDB compatibility to your Supabase projects with FerretDB

    Supabase mediumAdept

    FerretDB, an open source MongoDB-compatible proxy, can run on top of a Supabase Postgres database, storing each collection as a table in a `ferretdb` schema with documents as JSONB rows. The walkthrough runs the FerretDB Docker image locally with `FERRETDB_POSTGRESQL_URL` pointed at a session-mode pooler connection string. It then connects with `mongosh` using PLAIN auth, performs inserts and updates, and inspects the resulting JSONB in the Supabase dashboard. For production it deploys FerretDB to Fly.io with a sample `fly.toml`, a secret for the database URL and a dedicated IPv4 address, which is a paid feature.

  • A Simple 3-Step Process to Migrate from Supabase Auth to Neon Auth

    Neon mediumAdept

    Supabase Auth users can be moved to Neon Auth (built on Stack Auth) without forcing password resets by exporting bcrypt hashes in Modular Crypt Format and importing them through the Stack Auth REST API. A PL/pgSQL function joins auth.users and auth.identities to export emails and encrypted passwords to CSV. A Node.js script then posts each user to the create-users endpoint with the hash in password_hash, handling UTF-8 BOMs and throttling requests to avoid rate limits. Imported users appear in a read-only neon_auth.users_sync Postgres table that can be joined in application queries.

The quest for software engineering knowledge.

Look:
Layout: