Skip to content

Serverless and edge hosting (Vercel, Netlify, Cloudflare)

Scope: deploying web apps and APIs to Vercel, Netlify and Cloudflare Workers (including Cloudflare Pages). The rules are platform-neutral where the three platforms agree, and cite each platform's documentation. Framework rules are in Next.js and Web front end, which also covers caching static assets and HTML (WEB-7). Config in the environment and stateless processes (OPS-9) are in general/operations-reliability.md, keeping secrets out of code (SEC-2) is in general/security.md, and database rules are in PostgreSQL.

Entries are sorted by score from 1 to 10 (criteria): 9โ€“10 start here or strongly recommended, 6โ€“8 recommended, 1โ€“5 further reading or conditional.

Adopted references

  • 8 Workers Best Practices (Cloudflare Docs): configuration, secrets, background work, database connections, observability and code patterns for Workers.
  • 7 Production checklist for launch (Vercel Docs): operational excellence, security, reliability, performance and cost checks to go through before launching on Vercel.
  • 7 Caching overview (Netlify Docs): cache control headers, cache key variations, the durable cache, stale-while-revalidate and purging by site or cache tag on Netlify.
  • 7 Functions overview (Netlify Docs): how Netlify Functions run, with links to their configuration, background and scheduled functions, environment variables and logs.

Key rules

Runtimes, regions and limits

State and data

Caching

Configuration and secrets

Deployments

Observability

How to enforce

Tools that check the key rules above automatically, in CI, the IDE or a commit hook. "Partly" means the tool covers only some of what the rule asks.

  • 7 Vercel Separate Production Secret Values: an optional team policy. When an owner turns on Require Separate Values, every Secret must have a different value in Production than in Preview, Development and custom environments. Partly checks HOST-9.
  • 6 Netlify secret scanning: built into Netlify builds. It fails the build, before the deploy is published, when the value of a variable marked as secret appears in the repository code or the build output. Partly checks HOST-8.

Tutorials and further reading