Skip to content
Back to Deployment

Deploying with Netlify

Git-based deploys with serverless functions, edge functions, and built-in forms/identity.

PlatformsBeginner

Why

Netlify provides git-push deploys with atomic atomic deploys, instant rollback, and built-in add-ons (forms, identity, analytics). Edge Functions run on Deno with global distribution.

Platform-as-a-Service adoption grew 24% in 2024 as teams shift from VM management to git-push deploys. the cloud infrastructure market reached $330B in 2024, growing 22% year-over-year (Synergy Research), and PaaS layers capture the majority of new workloads.

When

Choose Netlify for static + serverless sites, form handling, and teams wanting built-in auth without third-party services. Avoid PaaS for workloads needing custom kernel modules, GPU passthrough, or strict compliance (FedRAMP, HIPAA) — use IaaS or dedicated hosts instead.

How

1. Connect repo — app.netlify.com → Add new site → Git 2. Build — set build command + publish dir (auto-detected for known frameworks) 3. Functions — netlify/functions/*.ts become serverless endpoints 4. Edge — netlify/edge-functions/*.ts run on Deno globally 5. Deploy — git push, or npx netlify deploy --prod 6. Redirects — netlify.toml or _redirects file 7. Headers — netlify.toml or _headers file

Example

# netlify.toml [build] command = "npm run build" publish = "dist" [[redirects]] from = "/*" to = "/index.html" status = 200 [[headers]] for = "/*" [headers.values] X-Frame-Options = "DENY" # netlify/functions/api.ts — serverless export default async (req: Request) => Response.json({ ok: true });

Common Problems

  • ⚠Build command not found — wrong publish dir or missing build script
  • ⚠Functions 404 — wrong folder, must be netlify/functions/ not functions/
  • ⚠Configuration drift between environments — use infrastructure-as-code (Terraform/Pulumi) to keep dev/staging/prod identical

Best Practices

  • ✓Use netlify.toml over _redirects/_headers — version controlled and more powerful
  • ✓Deploy to preview first — npx netlify deploy, then --prod after verification
  • ✓Set up health checks and graceful shutdown — handle SIGTERM to drain in-flight requests before exit

FAQ