Migrating from the MongoDB Data API to Supabase
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.
Related posts
- Migrating from Fauna to Supabase
Supabase mediumAdeptWith 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.
- Supabase CLI v1 and Management API Beta
Supabase mediumAdeptSupabase 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 mediumAdeptFerretDB, 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.
- Supabase CLI
Supabase mediumAdeptSupabase's new CLI runs the full Supabase stack locally via Docker Compose, using the same tooling as production, and walks through wiring it to a React app. For migrations, Supabase prefers schema diffing over hand-written migration scripts. After evaluating migra, dbdiff, pgdiff, apgdiff, pgquarrel and pgAdmin Schema Diff, it picked pgAdmin's because it tracks VIEW owner changes, which Row Level Security on views depends on, and it also handles domains. Since pgAdmin's diff was GUI-only, Supabase built a CLI mode for it and shipped it as a Docker image. A `supabase eject` command emits docker-compose, Kong and Postgres configs for self-hosting.
- Supabase Local Dev: migrations, branching, and observability
Supabase easyNoviceSupabase'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.