Cloudflare Migration & Recovery Kit
Move the app with a tested data and recovery plan. The full ZIP includes a tracked-source preflight, local SQLite rehearsal tool, staging runbook and acceptance template. Python 3.10+ and Git run the helpers; the actual build needs the app's Node/package manager, selected adapter and Wrangler. Cloudflare access and service usage are separate.
Inspect before selecting an adapter
Read repository rules and installed framework documentation. Inventory Next.js features, native dependencies, auth, databases, persistent files, background work, cache semantics and deployment ownership. Keep the existing adapter if it meets the task. Compare current vendor support before selecting a new one; do not force a framework rewrite as a migration shortcut.
python3 scripts/preflight.py /path/to/git-checkout --output /path/to/new-preflight.json
Exit 2 means findings need review; exit 1 means the helper failed. Exit 0 means no heuristic findings, not proven compatibility. Only tracked JavaScript/TypeScript is scanned. The tool ignores generated/vendor/seed directories and never opens secret files. Review dynamic imports, transitive dependencies, monorepo boundaries and untracked app files separately.
Adapt and rehearse
Use the staging and recovery runbook. Match bindings to the app's actual data model. Keep request-scoped environment/DB handles and separate build-time from runtime configuration. Test native dependencies and filesystem assumptions in workerd, not just Node development.
Generate forward-only migrations through the repository's normal tooling. Never rewrite committed migrations. Prepare a local SQLite snapshot using the project's authorized export procedure, then rehearse on a disposable clone:
python3 scripts/rehearse-sqlite.py /path/to/local-snapshot.sqlite /path/to/checks.json /path/to/new-migration.sql
The helper opens the input read-only, applies migrations to a temporary clone, checks integrity and independent SQL assertions, and restores the clone from the source to compare baseline state. It does not touch remote D1. SQLite rehearsal does not prove D1's runtime, batching or binding behavior; repeat on an isolated staging D1 using the pinned Wrangler version.
Release and verify
Complete the acceptance record with real evidence for login, data writes, files, cache refresh and payment paths that exist in this app. Use CI for production when repository rules require it. Preserve deploy serialization, migration drift checks, recovery bookmarks and post-deploy smoke tests. Deploy authorization does not by itself authorize destroying or restoring live data.