100% Free Forever
AI-Powered Learning
Industry Expert Content
Certificates & Badges
Learn At Your Own Pace

Netlify Deployment Cheat Sheet

Netlify Deployment Cheat Sheet

Deploy static sites and JAMstack apps on Netlify using the CLI, netlify.toml configuration, functions, and build settings.

2 PagesBeginnerFeb 2, 2026

Netlify CLI Basics

Install and use the Netlify CLI to deploy and manage sites.

bash
npm i -g netlify-cli            # Install CLInetlify login                   # Authenticatenetlify init                    # Link/create a sitenetlify deploy                  # Deploy a draft (preview) buildnetlify deploy --prod           # Deploy to productionnetlify dev                     # Run local dev server with redirects/functionsnetlify status                  # Show current site/account infonetlify open                    # Open site dashboard in browsernetlify env:set API_KEY value   # Set an environment variable

netlify.toml Config

Define build settings, redirects, and headers as code.

yaml
[build]  command = "npm run build"  publish = "dist"  functions = "netlify/functions"[[redirects]]  from = "/old-path"  to = "/new-path"  status = 301[[redirects]]  from = "/*"  to = "/index.html"  status = 200[[headers]]  for = "/*"  [headers.values]    X-Frame-Options = "DENY"

Netlify Function

Write a serverless function using the standard handler signature.

javascript
// netlify/functions/hello.jsexports.handler = async (event, context) => {  const name = event.queryStringParameters?.name || 'world';  return {    statusCode: 200,    body: JSON.stringify({ message: `Hello, ${name}!` }),  };};

Core Concepts

Key Netlify features for deploying and scaling sites.

  • Deploy previews- automatic preview URL generated for every pull request on a linked Git repo
  • Split testing- built-in A/B testing across branch deploys via `netlify.toml` branch config
  • Netlify Identity- built-in user authentication service for JAMstack sites
  • Forms- add `data-netlify="true"` to an HTML `<form>` to get serverless form handling with no backend code
  • Edge Functions- Deno-based functions that run at the CDN edge, defined in `netlify/edge-functions`
  • Build plugins- reusable build-step hooks configured under `[[plugins]]` in netlify.toml
  • Context-based env vars- `[context.production.environment]` and similar blocks scope variables per deploy context
Pro Tip

Use the SPA fallback redirect rule (`/* -> /index.html` with status 200, not 301) so client-side routers handle deep links correctly without breaking the browser back button or causing redirect loops.

Was this cheat sheet helpful?

Explore Topics

#NetlifyDeployment#NetlifyDeploymentCheatSheet#CloudComputing#Beginner#NetlifyCLIBasics#NetlifyTomlConfig#NetlifyFunction#CoreConcepts#Functions#DevOps#CommandLine#CheatSheet#SkillVeris