All Guides

Deploy to Netlify

Deploy your static site or JAMstack project to Netlify.

Beginner10 min

Setup Steps

1. Install Netlify CLI:

npm install -g netlify-cli

2. Login:

netlify login

3. Create a new site:

netlify init

4. Manual deploy:

netlify deploy --dir=dist

5. Production deploy:

netlify deploy --prod --dir=dist

6. Git integration:

- Connect your GitHub repo at https://app.netlify.com

- Set build command and publish directory

7. netlify.toml configuration:

[build]
  command = "npm run build"
  publish = "dist"

[[redirects]]
  from = "/*"
  to = "/index.html"
  status = 200

8. Environment variables: Site Settings > Build & Deploy > Environment

9. Custom domain: Domain Settings > Add custom domain

10. Netlify Functions (serverless):

mkdir netlify/functions
# netlify/functions/hello.js
export default async (req, context) => {
  return new Response("Hello!")
}