Structured Vibe Coding

Build applications and publish them online without knowing how to code.

Use a coding agent, such as Codex or Claude Code, to understand your idea, build the application securely, and help you publish it.

What you need

  • A paid ChatGPT or Claude account The coding agent is included with a paid plan: Codex comes with ChatGPT, and Claude Code comes with Claude.
  • A free Cloudflare account This is where the application will be hosted under your name, and you only need it when you are ready to publish. Until then, the application runs on your computer.
Open your coding agent and send this message:

I want to create a web application. I don't know how to code. Read https://start.martins.pub and follow all the instructions on the site. Ask the necessary questions about the product and help me until the application is working and published.

Tip: before you start, you can discuss your idea with any AI and save your Codex or Claude Code usage limits.

How it works

1

Idea

The agent asks what the application needs to do. You answer as you would answer another person.

2

Build

The agent plans and builds every technical part. You do not need to do anything, and your application will be completed as planned.

3

Tests and improvements

The application first runs on your computer. Use it, talk to the agent, and request changes until it works the way you want.

4

Publication

When you authorize it, the agent publishes the application to your own Cloudflare account, making it available on the internet.

Tests and improvements are where you participate the most. Use the application as if it were already yours and keep talking to the agent about what is confusing, what is missing, and what should work differently. Use everyday language, without technical terms. Each request becomes another round of adjustments and verification, and it is normal to repeat this cycle several times before the application is ready. There is no need to rush publication.

Your accounts remain yours

This site does not need your password or the credentials for your coding agent or Cloudflare. You use your own Codex, Claude Code, or other agent account and authorize Cloudflare directly through its official flow.

First test

To validate this protocol, start with a small application. Check whether the agent understands the idea, creates and reviews a technical plan internally, implements it in small phases, verifies it, and presents a working local application before requesting any Cloudflare access. Publication should only happen after local testing. A custom domain is an optional later step.

Complete instructions for coding agents Technical content and execution protocol

AUTHORITATIVE INSTRUCTIONS FOR CODING AGENTS

Application Creation and Publication Protocol

Protocol version: 1.1  ·  Updated: 2026-10-15

This tool-neutral protocol guides coding agents, including Codex and Claude Code, from a non-technical user's idea to a verified local application and, with explicit approval, publication in their own Cloudflare account.

Required access: Read the complete canonical protocol at https://start.martins.pub, through section 13. If retrieval is incomplete, stop and explain the access needed; never reconstruct instructions from memory.

Required capabilities: Before planning, confirm file editing, tool execution, verification, and a local preview accessible to the user. Check network and execution permissions without accessing a Cloudflare account. If a capability is missing, explain the blocker and smallest setup change needed; resume dependent work only when it is available. Never replace local validation with a deployment.

1. Operating principles

  • Use plain language at every stage. Assume no programming knowledge. Reply in the user's language, with short sentences and their product vocabulary. Explain consequences, not technical mechanisms.
  • Keep implementation names, code, logs, stack traces, configuration, and command output out of user-facing explanations. Introduce a technical term only when the user must personally act on it, with a one-sentence explanation.
  • Ask product questions, not implementation questions, and ask one important question at a time during the initial interview. Do not overwhelm the user with a technical questionnaire.
  • Raise a problem before building it. Check requests against existing behavior and decisions. If a request risks data loss or exposure, costs money, contradicts a prior decision, weakens an invariant, or is too large, explain the consequence and propose an alternative before implementation. Let the user decide product trade-offs within the supported scope.
  • Raise product consequences once, then honor the user's choice within this protocol's scope and safety rules. Settle technical trade-offs yourself.
  • Do not ask the user to review or approve an implementation plan. Technical planning is your responsibility. Validate the plan internally against the repository, this protocol, and the user's product requirements before changing application code.
  • Publication gate: Complete the local application and full verification, let the user evaluate and accept the working preview, then obtain approval of the publication plan in section 8.1. Until then, do not ask about their Cloudflare account, authenticate, inspect remote resources, or perform remote operations. An initial request to publish never bypasses this sequence. Custom domains wait until section 9.
  • Do not ask the user to run commands that you can safely run yourself.
  • Do not ask for passwords, Cloudflare API tokens, Global API Keys, OAuth access tokens, session secrets, or other credentials.
  • Never print, persist, commit, or paste a production secret into chat. Generate secrets locally and pipe them directly to the official tool that stores them.
  • Never weaken a security control, test, type check, build guard, migration rule, or repository invariant to make a feature pass.
  • Do not delete remote resources, overwrite existing DNS records, recreate an existing database, or perform another destructive operation without a separate, explicit confirmation that names the destructive action.
  • Keep hosting and required integrations entirely within the free-only boundary in section 3. User approval does not authorize a paid exception.

2. Repository and source of truth

Use this repository as the application base:

https://github.com/marcelomartins/hvbc-hono-vue-bun-cloudflare
  1. Create the new application in a new directory. Never overwrite unrelated files.
  2. Read the repository's AGENTS.md, README.md, package.json, wrangler.jsonc, and, while present, AI-GUIDED-SETUP.md before changing code. Use the setup guide for initializer and cleanup details; do not use AI-GUIDED-SETUP.md or SETUP.md as the workflow authority.
  3. AGENTS.md is authoritative for architecture, security, migrations, secrets, and verification invariants. Read it explicitly even when your tool expects a different filename for repository instructions, such as CLAUDE.md, and do not create a duplicate instruction file for your own tool unless the user asks for one.
  4. This web protocol is authoritative for project creation, the user journey, interface language, cleanup, and the Cloudflare authentication/publication workflow. It supersedes conflicting workflow instructions in setup guides, including early domain/account questions and remote resource creation during setup. Keep AGENTS.md authoritative for repository-specific architecture, security, migrations, secrets, and verification invariants. Apply the interface-language rule in section 3 even when the inherited instructions require English visible text, and align that instruction in the new application's AGENTS.md.
  5. Prefer repository scripts over reimplementing their behavior. Inspect package.json because script names may evolve.

3. Interview: understand the product first

Start with: “O que você quer que a aplicação faça?” or the equivalent in the user's language. From the conversation, determine only what is needed to build the first useful version:

  • product name and a safe lowercase project identifier;
  • who will use it and whether different people need different permissions;
  • the main workflow the user wants to complete;
  • the essential information that must be stored;
  • interface language, inferred from the user's request unless they explicitly ask for another language;
  • external services that are truly required for the first version.

Use that language throughout the interface, including validation/error messages and document lang attributes. Do not ask the user to choose a language already established by their request. Keep technical names, code, tests, logs, and project documentation in English.

Assess feasibility during the interview, before planning. The application must run as one Cloudflare Worker with one D1 database. The framework also supports running locally on Bun, but publication under this protocol targets Cloudflare; do not introduce self-hosting, Docker deployment, or another hosting provider. R2, Durable Objects, Workers KV, and Queues are optional only when their configuration satisfies the free-only boundary. A second Worker, second D1 database, or server outside Cloudflare is out of scope.

Basic registration limitation: The base provides registration and login without configured email delivery, email verification, or password recovery. Treat the absence of password recovery as an accepted limitation of the default scope. Explain it during the interview when accounts matter to the product, and include it in the handover when relevant. Do not add email delivery, password recovery, or multi-factor authentication unless the user explicitly requests them; assess any such request against this protocol's feasibility and free-only boundaries.

Free-only boundary: Hosting must use Cloudflare's Free plan; required integrations must also be free. Check current official quotas, eligibility, and exhaustion behavior against expected usage before planning. Exclude paid activation, automatic overage charges, expiring trials, and paid integrations. Never upgrade a plan, enable billing, or purchase a domain. If the product cannot fit, explain the limit and offer a smaller free version; do not implement the paid requirement. Free quotas may interrupt service, so explain that consequence. Name every additional remote resource in the publication plan.

Complexity boundary: Before planning, assess whether the product can be reliably built, verified, and maintained by a non-technical person with a coding agent. Projects requiring a dedicated technical team, specialist oversight, or complex ongoing operations are outside this protocol. Explain the specific limitation in plain language before implementation. Offer a smaller, independently useful alternative only if it removes that complexity. Splitting an unsuitable system into phases does not make it suitable, and accepting a smaller version is not a commitment to deliver the full system.

Sort what they asked for into three groups:

  • Out of reach here. Requests outside these boundaries, native mobile or desktop applications, regulated money or health flows, integrations requiring unavailable business accounts, contracts, or approvals, and capabilities the base stack cannot run. Explain why and offer a suitable alternative when possible. Never start a project whose central requirement is infeasible.
  • Useful reduced scope. State what the smaller version includes and excludes, confirm that it is useful by itself, and build only that.
  • Small enough to build now. Proceed.

When an accepted scope needs multiple phases, explain that work may span conversations. Each completed phase must leave a working checkpoint.

Do not ask the user to choose frameworks, databases, API styles, authentication libraries, rendering strategies, package managers, or Cloudflare products when the framework already makes that decision.

If the user volunteers a domain, acknowledge it and defer configuration and follow-up questions to section 9.

4. Local setup and repository inspection

  1. Check that Git, Bun, and the Node.js version required by the repository are available. If a required system tool is missing, explain what is missing before installing or asking the user to install it.
  2. Clone the application base into the chosen project directory and read the files listed in section 2 before initialization.
  3. Confirm the product name and proposed lowercase project identifier with the user. Preview bun run init --name <name> --title "<Title>" --host <name>.invalid --dry-run, inspect its summary, then apply the same command without --dry-run. Do not use --create-d1 or access Cloudflare during local setup. If scripts/init.ts is absent, inspect the existing project and checkpoint instead of repeating initialization.
  4. Install dependencies with Bun. Do not switch package managers or generate another lockfile.
  5. Use the repository's local environment template and its local secret-generation helper, which creates .dev.vars when needed and preserves an existing file. Never commit local secret files.

After cloning and initialization, read the local copies of AGENTS.md, README.md, package.json, and wrangler.jsonc before creating the implementation plan. When the project initially has no real public hostname, keep the repository's deliberate invalid placeholder for production host/origin during local work. Local development uses the local values from the project's local environment file.

4.1 Adapt and clean the new project

Make the inherited files describe the user's application. Remove framework-only examples, unused code/assets/dependencies, and files that serve no purpose in the requested application. Update imports, routes, scripts, configuration, tests, and documentation references together; preserve licensing, working features, security controls, and the full verification pipeline.

  • Adapt README.md to the application, keeping the architecture, development, verification, and Cloudflare publication instructions that remain useful. Remove framework attribution/contact text and contribution templates that do not apply; retain license notices and any documentation required by a remaining invariant, such as dependency-override justifications.
  • Translate the visible application strings and error-message map into the language established in section 3, set matching document lang attributes, and align the inherited visible-text instruction in AGENTS.md. Preserve its other architecture and security invariants.
  • After initialization, remove the root bootstrap scripts/ directory when it contains only bootstrap tooling, including scripts/init.ts and scripts/tsconfig.json. Remove the init package script, the bootstrap typecheck prefix, and bootstrap-only references in README.md and AGENTS.md. Preserve the separate application tooling in server/scripts/ and web-vue/scripts/.
  • Remove AI-GUIDED-SETUP.md after its applicable setup and cleanup details have been incorporated. Remove unused contribution, issue, and pull-request templates; keep or adapt files still required by the application.

Run bun run verify after setup and cleanup. If it fails, repair the cause without removing or weakening checks. Repeat this cleanup review before local acceptance so the finished application contains no unused framework leftovers.

5. Internal implementation plan and self-review

Before implementing features, create and internally validate IMPLEMENTATION_PLAN.md at the project root, unless the repository defines a planning location. Keep decisions, current state, and next steps concise; do not copy this protocol or command logs into it. The user does not approve the technical plan.

5.1 What the plan must contain

  • the first useful product outcome, in one short paragraph;
  • the user requirements and product decisions already established;
  • explicit assumptions, with unresolved product questions separated from technical decisions;
  • the expected screens/routes, data entities, permissions, APIs, migrations, and external integrations that are actually needed;
  • repository invariants from AGENTS.md that materially affect the implementation;
  • the verification strategy: targeted checks during each phase plus the full repository verification before local acceptance;
  • an ordered list of implementation phases, with a clear completion condition and checkpoint for every phase.

5.2 Size phases for available capacity

Size each phase by work, verification effort, remaining usage allowance, and context capacity, with margin to finish and checkpoint. A usage window, such as Codex's five-hour window, is a consumption limit, not guaranteed execution time. When remaining capacity is unknown, use smaller phases. Split work before checks or checkpointing become unlikely to fit.

Finish each phase with a runnable repository and passing phase checks. Do not plan checkpoints with half-applied migrations, broken types, incomplete authentication, or unresolved imports.

For every phase record:

  • Goal: the user-visible or architectural outcome;
  • Scope: the principal files/components/data changes expected;
  • Checks: targeted verification that must pass before the phase is complete;
  • Checkpoint: what is now true and what the next phase should do.

Update the plan after each phase and before an expected interruption. Record unfinished work honestly if interrupted mid-phase. On resume, read the checkpoint and inspect actual files and check results before continuing; conversation memory alone is insufficient.

5.3 Internal plan validation gate

Before changing application feature code, review the plan yourself. Implementation may start only when all of the following are true:

  • the first useful version meets section 3's architecture, free-only, and complexity boundaries, with expected usage and relevant quotas recorded;
  • every requirement for the first useful version maps to at least one phase;
  • the plan does not add features the user did not request;
  • the design follows AGENTS.md and does not weaken security or architecture invariants;
  • schema changes use additive migrations and are ordered before code that depends on them;
  • authentication/authorization and data ownership rules are explicit where relevant;
  • each phase fits available capacity with room for its checks and checkpoint;
  • the environment supports local implementation, verification, and a user-accessible preview without Cloudflare authentication;
  • there are no unresolved product decisions that would make implementation speculative.

If this internal review fails, revise the plan. Ask the user only about unresolved product behavior they are qualified to decide; never ask them to validate framework choices, schema design, implementation sequence, or other technical details.

6. Implement the plan phase by phase

Implement only after the internal plan has passed its validation gate. Work on one planned phase at a time; do not start later phases merely because context is available.

  • Implement only features the user asked for.
  • Reuse the repository's route registry, validation, authentication, D1 access patterns, error contract, and security middleware.
  • Use additive migrations for schema changes. Treat existing migrations as already applied.
  • Keep optional integrations disabled unless the user needs them.
  • Do not add analytics, tracking, telemetry, advertising, or any third-party embed to the user's application, and do not send their data or their users' data to a service they did not ask for. If a feature they requested genuinely requires an external service, name the service and what it will receive, and get approval before wiring it.
  • Prefer a working end-to-end workflow over many unfinished screens.
  • At the end of every phase, run its planned checks, update IMPLEMENTATION_PLAN.md, and leave a clear next-step checkpoint before starting another phase.
  • If new information materially changes the design, revise and internally revalidate the remaining plan before continuing.

While iterating, run targeted tests. Before presenting the application as ready, run the repository's full verification command, currently documented as:

bun run verify

If verification fails, diagnose and fix the cause. Never skip the command, disable a check, weaken a test, or change an invariant merely to obtain a passing result.

7. Local preview and product validation

Once the planned first useful version is implemented and full verification is passing, start the repository's integrated development server and give the user the local preview URL. Test the important user journey yourself when the environment allows it. Do not claim the application is ready merely because the build succeeds.

Ask for feedback in product language: whether the application behaves as expected, what should change, what is confusing, and what is missing. Iterate as needed, updating and internally revalidating the plan when the requested change is material, and run full verification again.

After the user accepts the working local version, present the publication plan in section 8.1 and ask once whether to proceed.

8. Cloudflare publication protocol

Follow the publication gate in section 1. Perform the technical steps yourself; explain only user decisions and required browser approvals. For interrupted publication, apply section 10 before repeating a step.

8.1 Ask once for publication approval

After local acceptance and before any Cloudflare account access, explain the free publication plan and request approval. For a new application:

“A aplicação passou nas verificações. Para colocá-la na internet, vou conectar a sua conta Cloudflare, criar um banco novo para esta aplicação, configurar uma chave de segurança que não será mostrada nem salva no código, criar as tabelas e publicar. Posso continuar?”

One approval covers authentication, account selection, the named resources, missing secrets, migrations, deployment, and health checks. Include any optional resources and adapt the plan for a resumed publication. Keep that approval across interruptions; do not ask again for covered steps. Separate approval is required for destructive, unrelated, or materially different actions; paid actions remain out of scope. Pause for user-only browser authorization or an ambiguous account/resource choice.

8.2 Check Cloudflare authentication

Use one authentication configuration throughout publication. Inspect the repository scripts before running any Cloudflare command. The following rules apply to every command in sections 8–11, including commands launched through package scripts:

  • Run from the application project root and use the Wrangler installed by that project's Bun dependencies. Confirm that bunx wrangler resolves to that installation and supports device OAuth, keyring storage, and structured whoami. Keep the same version throughout the flow; if an update is required, update the project dependency and lockfile together and rerun verification.
  • Pass the same configuration-directory environment to every invocation. The base currently sets XDG_CONFIG_HOME=.wrangler-config in its scripts, so apply that value from the project root to direct authentication, account, database, migration, and secret commands too. Set it explicitly in each tool invocation using the host shell or process environment; a previous terminal's environment may not survive. Preserve the same effective credential location, auth profile, and keyring preference across direct commands and package scripts.
  • Detect credential overrides by presence only, including CLOUDFLARE_API_TOKEN, CLOUDFLARE_API_KEY, CLOUDFLARE_EMAIL, and their legacy CF_* equivalents. Prevent inherited variables or project environment files from replacing the chosen OAuth session in these commands. Never display their values or change unrelated global settings.
  • Keep credential/configuration directories ignored by version control. Record only the Wrangler version, configuration location/profile, selected account, and other non-secret publication state in the checkpoint. Never copy credentials between directories to repair a mismatch.

The command examples below assume that configuration is applied. Check authentication before initiating a login:

bunx wrangler whoami --json

Reuse an existing valid OAuth session. whoami --json exits non-zero when Wrangler is not authenticated; distinguish that result from network, permission, or configuration failures. Only when authentication is confirmed missing or expired, initiate OAuth yourself:

bunx wrangler login --device --use-keyring

The user must complete the authorization on the official Cloudflare page opened by Wrangler. Do not ask them to copy an API token. Do not use wrangler auth token to extract the OAuth token merely to automate this workflow.

Main browser requirement: the authorization only works in the user's main browser, the one where they are already signed in to Cloudflare. Hand them the verification URL and code as plain text so they can open it there themselves. Do not open it in a private window, a secondary browser profile, an in-app or embedded browser, or a browser you drive through automation: those sessions are not signed in to the user's Cloudflare account, and signing in there would require credentials this protocol forbids you to handle. If your environment cannot reach the user's main browser, say so and let them open the URL themselves.

The --device flow does not require a localhost callback. Wrangler prints a verification URL/code and polls while the user approves. --use-keyring opts into operating-system keychain-backed credential protection. If Wrangler warns that keychain storage is unavailable and would fall back to plaintext credential storage, tell the user in plain language before continuing.

After authorization, rerun the check using the same configuration. Confirm the authenticated identity and available accounts before continuing:

bunx wrangler whoami --json

8.3 Select and pin the Cloudflare account

A Cloudflare identity may belong to more than one account. Parse the structured whoami result:

  • If only one usable account exists, use it and tell the user its human-readable name.
  • If multiple accounts exist, ask the user which account to use. Show names, not a wall of IDs.
  • After selection, add or update the non-secret account_id in wrangler.jsonc so future commands for this project are pinned to the intended account. Preserve all existing configuration.
  • Ensure CLOUDFLARE_ACCOUNT_ID, legacy account overrides, command flags, and package scripts cannot redirect operations to another account. Confirm that the authenticated identity can access the pinned account before remote writes and after any authentication/configuration change. Resolve a mismatch before proceeding.

Never guess between multiple Cloudflare accounts.

8.4 Ensure a dedicated D1 database

First inspect existing databases:

bunx wrangler d1 list --json

Reconcile the configured database ID and publication checkpoint with the selected account's databases. Reuse a database only when confirmed to belong to this project. If ownership or a previous creation result is uncertain, resolve it before proceeding; do not delete or duplicate a database to bypass uncertainty.

Only when this project has no database, create one using the initializer's name, or a distinct name if that name belongs to another project:

bunx wrangler d1 create <database-name>

Immediately record the confirmed UUID in the checkpoint and intended D1 binding in wrangler.jsonc (currently DB). Preserve migrations_dir and other settings.

8.5 Settle the account address before deploying

A Cloudflare account has exactly one account-wide workers.dev address, and every Worker in the account is published beneath it as <worker-name>.<account-subdomain>.workers.dev. The first label is this application. The second label is the person's account: it is chosen once, it is shared by every application they ever publish, and it appears in every URL they hand out.

If the account already has an address, it is settled: use it and choose nothing. It cannot be changed without breaking every existing URL beneath it.

If the account has none, Wrangler stops the first deploy, asks whether to register one now, and then prompts in the terminal for the name. Never answer that prompt with a name you invented. Agree the name with the user before you start the deploy, so the decision is never taken under a prompt that is blocking your own progress.

Rules for the candidates you propose:

  • The address names the person or their account, never this application. rotinae.rotinae-br.workers.dev is the outcome this rule exists to prevent.
  • The label must satisfy ^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$: lowercase letters, digits, and internal hyphens.
  • The namespace is global across all Cloudflare customers, so an obvious name may already be taken. Cloudflare answers Subdomain is unavailable in that case.
  • The address is public in every URL the person publishes. Do not propose anything sensitive, and tell the user it will be visible.

You already have the account identity from the authentication step:

bunx wrangler whoami --json

The result carries the signed-in email and the accounts list with human-readable names. Build two or three candidates from the person's name, the local part of their email, or their account name, reduced to the allowed characters, and ask one plain-language question that shows the resulting URL:

“Sua conta na Cloudflare precisa de um endereço próprio, que vai aparecer em todos os aplicativos que você publicar nela. Sugiro mariasilva: este aplicativo ficaria em rotinae.mariasilva.workers.dev. Esse é o endereço inicial — depois, se você quiser, dá para configurar um domínio próprio. Pode ser esse, ou você prefere outro?”

Tell the user that this is the starting address and that a domain of their own can be configured later, so the choice does not feel permanent to them. Keep that reassurance accurate: what can be added later is a custom domain in front of the same Worker. The account address itself stays as chosen and cannot be replaced without breaking every URL already published beneath it.

Proposing a candidate from the account identity is correct here precisely because the user approves it. Guessing the address of an account that already has one is a different act and remains forbidden: that value comes only from Wrangler.

If the approved name turns out to be unavailable, go back to the user with new candidates. Do not append a suffix, a number, a country code, or the application name on your own to get past the rejection: that is how an address ends up repeating the application name.

8.6 Bootstrap the initial workers.dev URL deterministically

The application validates its configured production host/origin at runtime, while a new user may not yet know their Cloudflare account's workers.dev subdomain. Do not guess the subdomain and do not ask for an API token merely to discover it.

Cloudflare documents that a Worker deployed without a custom route is assigned a URL in the form <worker-name>.<account-subdomain>.workers.dev. Use Wrangler itself as the source of truth for that URL.

If a previous deployment already established this project's URL, verify it against the remote state and skip bootstrap. Otherwise, confirm a real D1 ID, enabled workers_dev, and a passing build. Use the repository's deploy command; raw Wrangler is acceptable only without a wrapper or after confirming equivalent build steps.

This first deploy is a bootstrap deployment, not completion. The Worker may intentionally reject requests because APP_HOST, APP_ORIGIN, or the final production secret are not yet configured. Never tell the user that the application is published at this stage.

The account address must already be settled before this deploy. If Wrangler still prompts for a subdomain name here, stop and settle it with the user instead of answering the prompt.

Capture the canonical Worker URL directly from successful Wrangler deployment output, normally:

https://<worker-name>.<account-subdomain>.workers.dev

Do not infer the deployed URL from an email address, account name, username, repository name, or previous project. Proposing a name for an account that has none is the previous step's job; here the URL comes only from Wrangler. If Wrangler does not provide a trustworthy URL, stop this publication step and report what is missing rather than inventing one.

Extract the hostname from the Wrangler-provided URL and update the project's production configuration:

ENVIRONMENT=production
APP_HOST=<worker-name>.<account-subdomain>.workers.dev
APP_ORIGIN=https://<worker-name>.<account-subdomain>.workers.dev

Keep these values in the project's existing non-secret Wrangler configuration structure. Continue with migrations, production secrets, full verification, and the final deploy before running health checks.

8.7 Apply remote D1 migrations

Inspect pending migrations on the confirmed database, including after interruption. Apply only pending migrations; skip application if none remain:

bunx wrangler d1 migrations list DB --remote

Prefer the repository's remote migration script, currently bun run db:migrate:remote, after confirming that it targets the intended binding/database and uses the authentication configuration from section 8.2. Otherwise use:

bunx wrangler d1 migrations apply DB --remote

Cloudflare's migration command records migrations and captures a backup before applying. A failing migration is rolled back while earlier successful migrations remain applied. If a migration fails, fix the migration/application mismatch; do not delete and recreate the production database unless the user explicitly approves losing it.

After applying, list remote migrations again and verify that no expected migration remains pending.

8.8 Ensure the production session secret without revealing it

Inspect secret names on the confirmed Worker without reading values. Preserve an existing production SESSION_SECRET; resuming is not a reason to rotate it. Only if absent, generate a value independent of the local secret and pipe it directly into Wrangler:

bun --print "require('node:crypto').randomBytes(48).toString('base64url')" | bunx wrangler secret put SESSION_SECRET

Important: wrangler secret put creates a new Worker version and deploys it immediately. That remote side effect is why this command must only run after the user approved publication. The final deployment step below must still be run after all local production configuration is correct.

Apply the same presence check to secrets for approved optional features. Record names and confirmed presence only. Never store secret values in the plan, wrangler.jsonc, or committed files.

8.9 Final verification and deploy

Run the full local verification again after all configuration changes:

bun run verify

If it passes, run the repository's production deploy command, currently documented as:

bun run deploy

If the repository has changed, inspect package.json and use the current equivalent. Do not bypass project build steps with a raw Wrangler deploy unless there is no project wrapper or you have verified they are equivalent.

8.10 Post-deploy health check

Do not declare success based only on a successful deploy command. Request the production health endpoint:

curl --fail --silent --show-error https://<production-host>/health

Also test the public home page and the application's core user flow when the available environment permits it. If a brand-new workers.dev hostname briefly returns Cloudflare error 523, retry a bounded number of times; Cloudflare documents that first-time workers.dev propagation can briefly produce 523 responses.

If the health endpoint or core flow fails, diagnose and fix the deployment. Do not tell the user the application is ready until the final URL works.

8.11 Finish in user language

When the production checks pass, tell the user only what is useful:

  • the final URL;
  • what the first useful workflow can do;
  • that the application is running in their Cloudflare account;
  • any important limitation that remains.

Do not dump deployment logs, D1 UUIDs, account IDs, or implementation jargon unless the user asks.

9. Optional custom domain, only after workers.dev is healthy

Do not ask the user for a domain name before the final workers.dev deployment has succeeded and its health/core-flow checks have passed. The working workers.dev URL is the publication milestone.

After showing the healthy workers.dev URL, you may ask one optional plain-language question: “Você quer usar um domínio próprio agora, ou prefere manter este endereço?” Only if the user chooses a custom domain should you ask which domain/subdomain they want and continue with the steps below.

  • Confirm that the desired domain/zone is in the selected Cloudflare account.
  • For this framework, where the Worker is the application's origin, prefer a Cloudflare Worker Custom Domain rather than a Worker Route in front of another origin.
  • Cloudflare can create the DNS record and certificate for a Custom Domain when Wrangler deploys a route entry with custom_domain: true.
  • A Custom Domain cannot be created over a conflicting existing CNAME. Never delete or replace an existing DNS record without explicitly telling the user what will be removed and receiving confirmation.

The Wrangler configuration shape is:

"routes": [
  {
    "pattern": "app.example.com",
    "custom_domain": true
  }
]

Before deploying the custom domain, update APP_HOST and APP_ORIGIN to the custom hostname and HTTPS origin, run full verification, and deploy using the authentication configuration and pinned account from section 8. Then check the custom URL's health endpoint, public home page, and core user flow. Do not declare the domain transition complete until the new address works.

The application accepts only its configured production hostname. Explain that switching to the custom domain can make the earlier workers.dev address stop serving the application, even if Cloudflare still enables that address. Both addresses do not need to work simultaneously; preserve host/origin validation and show the verified custom URL as the application's current address.

Cloudflare recommends a Worker Route or Custom Domain rather than workers.dev for business-critical production applications. workers.dev remains the preferred simple first deployment for this protocol.

10. Checkpoints and recovery

After each remote step, update the existing implementation plan with the approved scope, Wrangler version and authentication configuration location/profile, account ID, Worker name, resource IDs, migration status, secret presence, deployment version/URL, check results, and next step. Keep only non-secret state. Record uncertain command outcomes as uncertain, not failed or complete.

  • On resume, read the checkpoint, restore the authentication configuration from section 8.2, rerun whoami --json, and confirm access to the pinned account before reconciling authorized remote state or writing. Reuse the valid session and the existing publication approval. Continue only missing steps; never repeat a creation or secret update just because output was lost.
  • If a local check fails: fix the cause and rerun it.
  • If a remote migration fails: do not destroy the database. Read the error, correct the migration/application, and retry safely.
  • If deployment succeeds but health fails: inspect configuration first — production host/origin, secret presence, D1 binding, applied migrations — then application logs as needed.
  • If the selected Cloudflare account looks wrong: stop before writing anything and ask the user.
  • If an existing remote resource conflicts by name: preserve it by default.
  • If a proposed fix requires deleting data, DNS, a Worker, a D1 database, or another remote resource: explain the consequence and obtain explicit resource-specific confirmation.

11. Maintain the application after launch

For later changes, inspect the project and checkpoint, update and internally validate the existing plan, and follow sections 5–6 for phase sizing and verification. Preserve the architecture, free-only boundary, and repository invariants.

A request to change the application is not automatically permission to deploy it. Ask before changing the live application unless the user clearly asked for the change to be published.

12. Current official references

When Cloudflare behavior or Wrangler flags appear to have changed, verify against the current official documentation before improvising. Useful references:

13. Completion contract

You may say the application is ready locally only when the internally validated plan for the requested first version has been completed, every phase is checkpointed, full verification passes, the local server is running, and the core user flow has been tested. No Cloudflare account or domain is required to reach this state.

You may say the application is published only when the user approved publication after evaluating the local version, the correct Cloudflare account is selected, remote resources are configured, migrations are applied, production secrets are stored outside source control, the final workers.dev deployment succeeds, and the production health/core-flow checks pass. A custom domain is optional and must be discussed only after this milestone.