Articles

How to deploy a vibe-coded app (Claude Code, Cursor, Antigravity) to production safely

Ship AI-generated backends from localhost to production with hard default spend caps, scoped agent tokens, deploy secret/CVE scans, 1% canary rollbacks and DB-synced recovery.

Updated

To take a vibe-coded backend built with Claude Code, Cursor, Codex, or Antigravity safely to production, deploy it on a platform whose API enforces production guardrails server-side — not inside a prompt file. AI coding agents can ship a FastAPI, Express, Next.js, or Go app in minutes, but moving past npm run dev breaks in four predictable ways: infinite retry loops burning cloud bills, leaked keys or OWASP bugs, bad database migrations, and unguarded destructive CLI actions.

Four "vibe DevOps" risks and how Gregale handles them

Risk when deploying AI-generated codeWhat goes wrong on typical PaaSWhat Gregale enforces automatically
Agent retry loop burns billUncapped usage or manual alerts hit days laterDefault hard monthly spend caps ($10/$50/$150 defaults) + gregale scale --plan cost preview + Free tier hard-stops at allowance
Bad migration or buggy deployBroken container or unreversed Postgres schema stays liveEvery production release steps 1% → 10% → 50% → 100% with automatic 5xx rollback (beta), and gregale rollback --restore-databases reverts code + Postgres together
OWASP bugs & leaked keysSecrets sit in plaintext env vars and scanners hit the live appDeploy CVE + secret scanning, short-lived OIDC workload identity, zero-secret outbound relay (preview), and pre-wake OWASP WAF / browser challenge
Agent runs destructive commandPersonal CLI login has full delete/prod permissionsScoped --agent keys (GREGALE_TOKEN), human web approval links for risky production changes, and undo for non-code edits
sh
curl -fsSL https://get.gregale.dev | sh
gregale login
gregale key create vibe-agent --agent      # scoped key for the AI agent
gregale init --agents --name my-app        # writes deploy/check/rollback rules to AGENTS.md

Once initialized, ask your coding agent to preview before touching production:

sh
gregale deploy --dry-run
gregale --non-interactive --json deploy --name my-app
gregale --non-interactive --json app health my-app --errors

You get isolated Firecracker microVMs, managed PostgreSQL (DATABASE_URL injected automatically as a secret), per-PR preview environments, built-in cron jobs/workflows, and OpenTelemetry request tracing with zero Kubernetes or Terraform boilerplate.

Sources

Questions

How do I stop an AI coding agent from causing a runaway cloud bill?

Use a Free plan (stops at its monthly allowance) or a paid plan with default hard monthly spend caps ($10/$50/$150), and give the agent a scoped --agent key with per-agent budgets and gregale scale --plan cost previews.

What protects production if an agent pushes a bad migration or bug?

Production releases roll out 1% → 10% → 50% → 100% with automatic 5xx rollback (beta), and gregale rollback --restore-databases reverts code and managed PostgreSQL together.

Why aren’t prompt instructions in AGENTS.md or .cursorrules enough on their own?

Agents can misread or ignore prompt text; Gregale enforces budgets, approval links, dry-run checks, CVE scans and canary rollbacks server-side in its API.