CoreMVP

Ship on merge

View as Markdown

① Live → ② Accounts work → ③ Merge = deployed → ④ Features → ⑤ Taking payments

Your app is live and accounts work. This page connects your repository to Supabase and to your host, so a merge to main starts database and host deployments. Check both results.

Give your agent this prompt
Prepare automatic deployment for my app on <host>.
Follow https://coremvp.com/en/docs/deployment/ship-on-merge.md and its prerequisites.
Finish when both provider checks pass on the merged commit and ./coremvp prod e2e smoke https://<app-domain> passes; ask me before authorizing or connecting the repository to a provider, pushing a branch that triggers a deployment (including Vercel Preview), merging, deploying or changing production.
Report what changed, the check results and anything you could not run.

You'll need

Your own private GitHub repository for the app, with CoreMVP kept as the upstream remote (see After purchase). Install and authenticate the GitHub CLI, and start from a clean, current main branch in your app repository. Supabase's GitHub integration works on every Supabase plan. On Vercel, a private repository owned by a GitHub organization needs Vercel Pro. On Cloudflare, Workers Builds includes 3,000 build minutes a month on the Free plan.

What happens on each merge

GitHub holds no keys. Supabase and your host each watch main:

  1. Supabase applies new migrations from to your production database.
  2. Your host builds and deploys the new code with the settings you already saved there.

Your app's secrets stay where you saved them: in your Vercel project, or on your Cloudflare Worker.

These run independently, so either can finish first. Write each change so the live code keeps working while the other one catches up; see Ship a change.

Connect Supabase

In your production Supabase project, open Project Settings → Integrations. Under GitHub, select Connect GitHub. The first time, GitHub asks you to install the Supabase app: choose Only select repositories, pick your app repository, then Install & Authorize. Back in Supabase, choose your app repository.

SettingValue
Working directory. (the supabase folder is at the repository root)
Deploy to productionOn
Production branch namemain
Automatic branchingOff

Select Enable integration.

Connect your host

bunx vercel git connect "$(git remote get-url origin)"

Naming origin connects your own repository, not the CoreMVP upstream.

Vercel deploys every push to main to Production, with the settings saved in your project. Other branches get preview deployments; you can ignore them.

In Cloudflare, open Workers & Pages, select your Worker, then Settings → Build. Select Connect and choose your app repository.

SettingValue
Build commandbun run build:cloudflare
Deploy command, Next.jsbunx --no-install cf deploy --prebuilt
Deploy command, TanStack Startbunx [email protected] deploy --prebuilt

Under Build variables, add CLOUDFLARE_ACCOUNT_ID and every NEXT_PUBLIC_ value plus CLOUDFLARE_HYPERDRIVE_ID from . The build runs on Cloudflare, so it needs them; they are public, not secrets. When a later page adds a NEXT_PUBLIC_ value, add it here too.

Under Branch control, keep main as the production branch and clear Enable Preview Builds.

Your server secrets stay on the Worker from your last cf deploy; a build deploy keeps them.

Merge a small change

git switch -c try-ship-on-merge
echo "" >> README.md
git add README.md
git commit -m "Try ship on merge"

Confirm that a Preview deployment is OK before pushing if your host deploys this branch. Push and open the pull request:

git push -u origin try-ship-on-merge
gh pr create --fill

Review the pull request and confirm the production deployment before merging:

gh pr merge --merge

Check it works

Open the merged commit on GitHub. It shows a check from Supabase and one from Vercel or Cloudflare, both passing. Your host shows a new production deployment of that commit, and you ran no deploy command.

Then check the live app answers:

./coremvp prod e2e smoke https://<app-domain>

When something fails

FailedWhat changedWhat to do
Supabase, first migrationThe new code may be live; the database is unchangedFix the migration and merge again. If the live app breaks, roll back the host.
Supabase, a later migrationThe migrations before it are applied; the failed one is not, because each runs in its own transactionFix the failed migration file itself and merge again. Never edit a migration that is already applied.
Host build or deployThe database may be ahead of the live codeFix the build and merge again, or retry the deployment in your host's dashboard if the failure was temporary.

What's next

Was this page helpful?

On this page