GuidesUpdated

Is my local AI-built app using the production database?

Trace the browser, API, worker and database targets of your locally running app before an agent tests writes or migrations against it.

On this page

A page at localhost can still call a hosted production API or database. The code runs on your computer; the app's configuration decides where data goes. Before an agent tests a save, delete, import, payment or migration, find the target of every component that can write. If you can't tell, stay read-only.

Canopy local services view showing project run commands and process output
Canopy local services view showing project run commands and process output

Separate the page URL from the data destination

The frontend may load from localhost while its JavaScript calls a hosted Supabase project or your production API. A Git branch, worktree, local dev server or Vercel Preview URL doesn't create a separate database.

In Canopy, note the checkout behind each saved server command, then list the website, API, worker and external services the task touches.

Map the write path before testing a billing or profile change.
ComponentQuestionEvidence to inspect
Browser pageWhich API or Supabase project receives its request?Network request host, app config, project identifier
Local APIWhich database and service credentials does it use?Variable names, selected environment, sanitized host or project ID
Worker or webhookWhere will a background effect run?Queue project, environment, destination service
DatabaseIs this local, staging or live?Owner-confirmed project and safe test-data plan

Check configuration without exposing credentials

Find the variable names each component uses. Compare non-secret identifiers, such as project reference or endpoint host, with the owner-approved development target. Never paste a full `.env`, a database URL with password or a secret key into an agent prompt or issue.

Supabase separates publishable browser keys from secret server keys; a publishable key being safe to expose doesn't make its project safe to test against. Vercel scopes variables to Development, Preview and Production, but each scope's values must still point at the right backend.

  • Check frontend, API and worker separately; they may load different settings.
  • If the app calls your own API, trace that API's database too.

Run a read-only check before the first write

Inspect the Network request for the relevant action without submitting anything destructive, and match its host or project reference to the test project. For server code, have the process owner confirm the database identity through the provider's settings.

Never use a data-changing query to find out which database is connected. Supabase's CLI docs warn that local and linked defaults differ by command, so pass an explicit target before any reset, push or migration. If you can't prove the target, don't run the write test.

Switch to a safe target and check again

Use a local or separate development environment with test accounts and disposable records. Update config through the normal secret-management process, restart the app and worker processes, and read their fresh output.

Vercel applies changed variables only to new deployments, and running processes keep old values. Repeat the endpoint check, make one reversible write, and confirm it appears only in the development target.

  • Never copy production credentials into a local or Preview environment to make a demo work.
  • Don't copy customer data into a test project without the owner's data-handling plan.

Give the agent a bounded test, then review

Tell the agent which environment is approved, what it may do and what it must not run. Ask it to report the endpoint identity without credentials, commands run and the result. Canopy keeps server output, Preview and the diff beside the task.

Review changes to `.env` examples, deployment settings, migrations and service URLs. A working local UI doesn't prove the data stayed local. A human owner approves any production migration separately.

Copyable resources

Before my agent writes test data

Fill in identifiers without sharing credentials or customer records.

Local page URL and branch/worktree: [ ]
Website run command and working directory: [ ]
Browser API host or project reference (redacted): [ ]
API service and database target confirmed by owner: [ ]
Worker, queue, webhook, payment or email target: [ ]
Environment approved for writes: [ ]
Test account and disposable record type: [ ]
Read-only checks done; no reset/push/migration run: [ ]
Allowed agent action and acceptance check: [ ]
After test: destination record, process log, final diff and reviewer: [ ]

Frequently asked questions

Does localhost mean my database is local?

No. Localhost is where the page or process is served. Its browser requests and server config can still reach a hosted production API, database, queue or payment service.

Can I tell from a Supabase publishable key that testing is safe?

No. A publishable key names a project and is meant for browsers, but that project can hold live data. Confirm the project reference and access rules before a write test, and never expose a secret or service-role key.

Can I let the agent run a migration after it sees a development label?

First confirm the real database project and whether the command targets local or linked state. Review the migration and recovery path separately before any production operation.

More questions and answers →

Sources and further reading