list_environments
List the environments in supaforge.config.json, and which are the default source and target. Says whether each has the Supabase project details the API-based checks need; never returns credentials.
configPath
io.github.akalsoftwarePublished by GitHub account akalsoftwarev0.0.41Updated Nov 7, 2026
Find and fix drift between Supabase environments: schema, RLS, roles, auth, storage and more.
SupaForge compares two Supabase environments, reports drift across schema, RLS, auth, storage and more, and can sync the target to match the source.
Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.
Follow the launch instructions in the repository.
Diff and sync your Supabase environments.
SupaForge compares two Supabase projects (dev and prod, say) across everything that makes up a project, not just the schema. It reports every difference and makes the target match the source. Fixes run in dependency order, in one transaction, and can be proved on a throwaway copy before anything changes. With a single project, it snapshots, restores and clones it.
--apply, and anything that loses
data or opens up access also needs --allow-destructive. A failed apply
leaves the target exactly as it was.--prove rehearses the migration and refuses to apply one
that wouldn't reproduce the source or would lose rows.Built by Akal.
Everything that writes previews first. Add --apply to make it happen.
It needs Node.js 20 or newer. DBDiff, its diff engine, comes with it as a
native binary for your platform, so there is nothing else to install. The
Docker image needs nothing at all, and carries the PostgreSQL client tools
--prove uses; pass connection strings with -e, and mount the project at
/work.
The schema check covers tables, columns, keys, indexes, partitions, views,
materialized views, functions, aggregates, triggers, event triggers, rules,
sequences, enums, composite and range types, domains, casts, extended
statistics, text search configurations and dictionaries, foreign servers,
user mappings and foreign tables, policies, default privileges, replica
identity, statistics targets, extensions and comments. A renamed column,
table or sequence is renamed, keeping its rows, rather than dropped and
created again. It runs in every schema except Supabase's own (auth,
storage, and so on) and those in ignoreSchemas. Objects owned by an
extension belong to it and aren't compared. Objects of a kind it doesn't
compare, such as operator classes, are named under the check so you can look
at them by hand; they aren't counted as drift.
A check that can't run, for example without API credentials, says so and why. It's never reported as a clean pass.
Useful diff flags:
diff, snapshot, restore, clone and migrate run
write nothing without --apply.--allow-destructive. migrate run uses the same
gate.--prove. The fixes are replayed on a copy of the target's structure,
made on the target's own server, the way the apply will run them, with a
sample of each table's rows. Nothing is applied unless the result matches
the source and the rows survive, and nothing is applied if the proof can't
run. It also names the tables the fixes rewrite. Changes a copy can't hold,
such as cron jobs (pg_cron lives in one database per server), are listed as
not proved.RLS coverage and migration history look at the target alone, so they report
the same findings whichever pair you diff. They're scored separately
(Posture score), don't set the exit code unless you pass
--fail-on-posture, and their fixes apply only with --apply-posture, or
when you name the check, as in --check=rls-coverage --apply. Applying them
blindly would move the target away from the source.
A snapshot records a project's structure and configuration: schema, RLS
policies, cron, webhooks, extensions, storage, auth, Edge Functions,
reference data, Realtime, Vault names and grants. It is not a
backup. It holds no rows beyond checks.data.tables, and no stored files.
Its schema is written as SQL by pg_dump, which has to be at least as new as
the server; without one the snapshot can still be diffed but not restored, and
snapshot exits 1 unless --allow-schema-json-only says that is enough.
restore --from-snapshot puts back:
It can't put back auth config, Edge Functions (deploy them with
supabase functions deploy), or Vault secret values. Each of these is named in
the output.
--force clears the snapshot's own schemas first (never Supabase's) and
puts back the triggers and policies outside them that depended on what it
cleared. A restore or apply that looks likely to need more locks than the
target allows in one transaction says so before it starts;
--no-transaction commits as it goes instead.auth.users, a webhook,
an extension the server doesn't ship, and everything that needs it.--json prints only JSON, for a preview too.clone copies a remote database into a local server with pg_dump and
pg_restore (--schema-only to leave the rows behind). Extensions the local
server has are installed first. Objects it couldn't restore are listed by
cause. Afterwards the config's target points at the clone, so a bare
diff --apply writes there rather than to the remote.
supabase/migrations (set
checks.migrations.dir to change it). Applied versions are recorded in
supabase_migrations.schema_migrations, the Supabase CLI's table.migrate create lists any it wrote, and
migrate run needs --allow-destructive to run them.GRANT is needed instead
of failing with a bare permission error.checks.migrations.mode decides
how the migration-history check reports them: auto (one note when nothing
is tracked), warn or ignore.checks.exclude and checks.schema.timeout can also
be set on an environment, and apply when it's the target..env files. .env files are loaded the Next.js way:
.env.{NODE_ENV}.local, .env.local, .env.{NODE_ENV}, .env. Values
already in the environment win.source/target is fine. Use snapshot, clone and restore.Set apiUrl to the gateway and accessToken to the service-role key. All
checks run.
studioUrl (Studio's port, not the gateway's) or
functionsPath (the mounted functions directory). The two can be mixed
across environments. Studio's functions API is unauthenticated, so don't
expose it publicly.A local clone is plain PostgreSQL. Storage, auth, Edge Functions, Vault, Realtime and Supabase's roles have nothing to compare there, so skip those checks:
When the source is a clone and the target isn't, diff warns that --apply
would push the clone's shape, absences included, onto the target.
The GitHub Action runs
diff --ci and adds a summary of the drift to the job page:
Anywhere else, run the CLI:
--ci fails on critical drift by default. Set the threshold with
--fail-on=warning or --fail-on=any.
SupaForge runs as an MCP server, so an AI agent in your editor can scan for drift and fix it, asking you before anything is written.
[Add to Cursor] [Install in VS Code]
Claude Desktop: download the extension for your platform
(supaforge-<version>-<platform>.mcpb) from the
latest release
and open it. It asks for your project directory.
Claude Code: install the plugin, which adds the MCP server and a skill for applying fixes safely:
or add just the server: claude mcp add supaforge -- npx -y @akal/supaforge mcp
Any other client:
It is listed in the MCP Registry
as io.github.akalsoftware/supaforge.
The server exposes these tools:
diff and sync take the same arguments, so the plan an agent shows you is
the plan that runs. Fixes that drop tables or columns are held back unless
allowDestructive is set.
It reads supaforge.config.json in the directory given by --project (or the
one it starts in), and refuses a configPath from a client unless started
with --allow-config-path.
The release-candidates script builds DBDiff's binary and the npm packages from local checkouts the way a release does, installs SupaForge against them as a user would, and runs every suite above against that install. It tests changes that span the three projects together, before any of them is released.
The scenario suite migrates every case in the
@akal/pg-conformance corpus in both
directions. It checks the result against the corpus's own state oracle and
against --prove.
MIT
Source: packages/cli/README.md at commit 8dce28e
List the environments in supaforge.config.json, and which are the default source and target. Says whether each has the Supabase project details the API-based checks need; never returns credentials.
configPathCompare two Supabase environments and report every difference: schema, RLS, roles and grants, auth, storage, Edge Functions, cron and more. Returns the findings with their SQL, a drift score, and the plan: the statements sync would run, in order, and what it would hold back and why. Writes nothing. Show the plan to the user before calling sync.
onlyskipcheckssourcetargetconfigPathallowDestructiveMake the target environment match the source by running the plan diff shows. WRITES TO THE TARGET DATABASE: call diff first, show the user the plan, and call this only once they agree, with the same arguments. SQL fixes run in one transaction and roll back together if any fails. prove=true first rehearses the plan on a throwaway copy of the target and refuses to write if the result would not match the source.
onlyskipprovecheckssourcetargetconfigPathallowDestructiveCapture a point-in-time snapshot of a Supabase environment. Snapshots are stored under .supaforge/snapshots/ and can be used to restore state.
configPathenvironmentWrite the schema difference between source and target as a migration file, as `supaforge migrate create` does: the SQL that brings the target to the source, the grants on what it creates (so it works where new tables are not granted by default), and a DOWN to revert it. Written to the configured migrations directory (supabase/migrations by default). Changes no database.
namerequiredsourcetargetconfigPathRetrieve the result for one check from the most recent diff or sync call. Returns issues, status, and duration for the named check.
checkrequired90% of the applicable checks met
How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.
Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.
npm install -g @akal/supaforge
supaforge init # create supaforge.config.jsonsupaforge diff # what has drifted?supaforge diff --detail # with the SQLsupaforge diff --apply # fix the targetsupaforge init Create a config interactivelysupaforge diff Report drift (alias: hukam)supaforge sync Alias for diff --apply
supaforge snapshot --apply Capture an environment's structure and configurationsupaforge restore --apply Rebuild a database from a snapshot or migrationssupaforge clone --apply Copy a remote database to a local one
supaforge migrate create Write a migration file from the current driftsupaforge migrate list Local migrations, applied and pendingsupaforge migrate run --apply Run pending migrationssupaforge migrate baseline --apply Mark migrations applied without running them
supaforge report Recent runs, from a local logsupaforge mcp MCP server for AI agentssupaforge help <command> Every flag, e.g. help diffsupaforge diff --dry-run # the plan, in ordersupaforge diff --apply --prove # rehearse, then applysupaforge diff --apply --only='schema-create-*'supaforge snapshot --env=prod --apply # capturesupaforge snapshot --env=prod --migration --apply # and write what changed since the last onesupaforge restore --env=local --from-snapshot=latest --applysupaforge clone --env=prod --apply # local copy, data includedsupaforge migrate create --name=add_orders # from the drift between source and targetsupaforge migrate run --env=prod # previewsupaforge migrate run --env=prod --apply{ "environments": { "dev": { "dbUrl": "$DEV_DATABASE_URL", "projectRef": "abc123", "accessToken": "$SUPABASE_ACCESS_TOKEN" }, "prod": { "dbUrl": "$PROD_DATABASE_URL", "projectRef": "xyz789", "accessToken": "$SUPABASE_ACCESS_TOKEN" } }, "source": "dev", "target": "prod", "checks": { "data": { "tables": ["plans", "feature_flags"] }, "exclude": ["edge-functions"] }}{ "checks": { "exclude": ["storage", "auth", "edge-functions", "vault", "realtime", "roles"] } }- uses: akalsoftware/supaforge-action@v1 env: DEV_DATABASE_URL: ${{ secrets.DEV_DATABASE_URL }} PROD_DATABASE_URL: ${{ secrets.PROD_DATABASE_URL }}npx @akal/supaforge diff --ci/plugin marketplace add akalsoftware/claude-plugins/plugin install supaforge@akalsoftware{ "mcpServers": { "supaforge": { "command": "npx", "args": ["-y", "@akal/supaforge", "mcp", "--project", "/path/to/project"] } } }import { HookBus, scan, createDefaultRegistry, loadConfig } from '@akal/supaforge'
const bus = new HookBus()bus.on('supaforge.check.after', ({ check, result }) => { if (result.status === 'drifted') console.log(`Drift in ${check}`)})await scan(createDefaultRegistry(), { config: await loadConfig() }, bus)cd packages/clinpm installnpm test # unit testsnpm run lint # type-check./bin/dev.js diff # run from source