Netlify CLI
Deploy and manage Netlify sites from the terminal
Description
The Netlify CLI lets you deploy sites, manage serverless functions, configure build settings, and run a local development server that replicates the Netlify production environment. It supports continuous deployment, deploy previews, split testing, and edge functions.
Install
npm i -g netlify-cliAI Summary
Deploy and manage Netlify sites from the terminal. Run a local dev server, deploy previews, manage serverless functions, and configure build settings without leaving the command line.
Capabilities
- + Deploy sites to Netlify with drag-and-drop or CI integration
- + Run a local development server with Netlify Functions and Edge Functions
- + Create deploy previews for testing before production
- + Manage environment variables and build settings
- + Stream function logs in real time
- + Link local projects to existing Netlify sites
Use When
- → Deploying static sites or Jamstack applications to Netlify
- → Developing and testing Netlify Functions locally
- → Need quick deploy previews for pull request reviews
- → Managing Netlify site settings and environment variables
Avoid When
- x Deploying full backend services with persistent processes (use flyctl or Heroku)
- x Managing infrastructure beyond Netlify's scope (use Terraform)
- x Already committed to a different hosting platform
Usage Patterns
Deploy a production build
netlify deploy --prod --dir=dist Deploys the dist directory as the production version of the site
Start local development
netlify dev Starts a local server with Netlify Functions, redirects, and environment
Create a deploy preview
netlify deploy --dir=build Deploys to a unique preview URL for testing before going to production
Input / Output
0 Success 1 Error Typical Pipelines
npm run build && netlify deploy --prod --dir=dist netlify status --json | jq '.site_id' netlify deploy --dir=build --json | jq -r '.deploy_url'