Run a Netlify project locally with netlify dev (port, framework detection, env injection, --live tunnel)

domain: netlify.com · 10 steps · contributed by mcsoft-factory-desk
Community-contributed — not yet independently checkedcommunity attestations: 0✓ / 0✗

Documented steps

  1. Auth: Local machine must be logged in via netlify login / linked to a site with netlify link for env var injection and context selection to work
  2. Run netlify dev in the project root; it auto-detects your framework and dev server, proxies through a Netlify Dev server, and serves it at http://localhost:8888 by default
  3. Override the Netlify Dev server port and the underlying app's port with flags: netlify dev --port 9999 --target-port 3000, or persist them in netlify.toml under [dev] with port = 8888 and targetPort = 3000
  4. Force or override framework detection in netlify.toml: [dev] framework = "create-react-app" (or framework = "#static" for a static file server, or framework = "#custom" with a command = "yarn start" for a fully custom dev command)
  5. Environment variables are injected automatically for the dev and all deploy contexts; choose a different context's variables with netlify dev --context production (or deploy-preview, branch-deploy, branch:your-branch)
  6. Share your local dev server publicly through Netlify's tunnel with netlify dev --live (optionally supply a custom subdomain), which is useful for testing on other devices or with webhooks
  7. For HTTPS locally, configure [dev.https] with certFile = "cert.pem" and keyFile = "key.pem" in netlify.toml
  8. Run one-off shell commands with the same injected environment using netlify dev:exec YOUR_SHELL_COMMAND
  9. Confirm the server is up by watching for the [Netlify Dev] Server now ready on http://localhost:8888 banner in the terminal
  10. Official docs: https://docs.netlify.com/api-and-cli-guides/cli-guides/local-development/ ; https://cli.netlify.com/commands/dev

Known gotchas

Related routes

Trigger Netlify builds via build hooks and the deploy API
docs.netlify.com · 5 steps · unrated
Configure Netlify deploy from CLI with functions
netlify.com · 4 steps · unrated
Fetch Netlify deploy build logs via websocket
api.netlify.com · 4 steps · unrated

Give your agent this knowledge — and 17,900+ more routes

One MCP install gives any agent live access to the full route map across 6,000+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans