What Is Netlify? Free Hosting That Actually Works for AI-Built Apps
You built something with AI. It works on your machine. Now you need a URL you can share with the world. Netlify takes your code from GitHub and turns it into a live website — for free. Here's what it does, when to use it, and what breaks.
🚀 If you just need to deploy right now: push your code to GitHub, go to app.netlify.com, click "Add new site → Import an existing project," pick your repo, and hit Deploy. That's literally it. Come back here when something breaks.
TL;DR
Netlify is a cloud hosting platform that deploys your website straight from GitHub with zero server setup. You push code, Netlify builds it, and your site goes live on a global CDN in under two minutes. It's especially great for static sites, React apps, Astro projects, and anything JAMstack. You get automatic deploys on every push, deploy previews on pull requests, free environment variable management, built-in form handling, and serverless functions. The free tier includes 100GB bandwidth and 300 build minutes per month — enough for most side projects and portfolio sites. When your deploy breaks, it's almost always the wrong publish directory, a missing environment variable, or a build command that doesn't match your framework.
Why AI Coders Need to Know This
You just spent a few hours in Cursor or Claude Code building something — maybe a portfolio site, maybe a landing page for a side project, maybe a React app that actually does something useful. It runs great on localhost:3000. Your AI says it's done. But nobody else on earth can see it.
So you ask your AI: "How do I put this on the internet?" And there's a solid chance it says "Deploy to Netlify."
Netlify is one of the three platforms vibe coders encounter the most — alongside Vercel and Railway. Each one is good at different things, but Netlify has carved out its space as the go-to for static sites, JAMstack projects, and anything that doesn't need a persistent backend server. If your AI built you a React app with Vite, an Astro blog, a Hugo documentation site, or even a plain HTML/CSS portfolio — Netlify is often the fastest path from "works on my machine" to "live on the internet."
Here's why you should understand it:
- AI tools recommend it constantly. When you ask how to deploy a static site or frontend app, Netlify is one of the top suggestions. Over 4 million developers have deployed to Netlify as of 2026.
- It has features your AI will silently configure. Forms, redirects, serverless functions — your AI might set these up without explaining what they do. You need to know so you can debug when they break.
- The free tier is genuinely usable. Unlike platforms that give you a "free trial" with a credit card, Netlify's free tier handles real projects with 100GB bandwidth and 300 build minutes. No card required.
- Things work differently after deployment. Your site behaves differently on Netlify than on your laptop — especially with routing, environment variables, and serverless functions. Understanding the differences saves you hours of debugging.
If you're building with AI tools and want to share what you've made with the world, Netlify is one of the easiest on-ramps to the live internet. Let's break down exactly how it works.
What Netlify Actually Does
At its core, Netlify does five things. Understanding each one saves you from the confused Googling that happens when something doesn't work:
1. Hosting on a Global CDN
When you deploy to Netlify, your site's files (HTML, CSS, JavaScript, images) don't sit on one server in one location. They get distributed across a global content delivery network — servers spread around the world. When someone in London visits your site, they get the files from a server in Europe. Someone in Tokyo gets them from Asia. This is why Netlify sites load fast without you doing anything special.
2. Automatic Deploys from GitHub
You connect your GitHub repo to Netlify once. After that, every time you push code to your main branch, Netlify automatically detects the change, pulls your code, runs the build command (like npm run build), and deploys the result. Push from Cursor, and 60-90 seconds later your changes are live. No SSH, no FTP, no manual uploading.
3. Serverless Functions
Need a little bit of backend code? Netlify Functions let you write small server-side functions (Node.js or Go) that run on demand without managing a server. Put a JavaScript file in your netlify/functions/ directory and it becomes an API endpoint automatically. Your AI might use these for form processing, API proxying, or database queries.
4. Built-in Forms
This is a Netlify-specific feature that Vercel and Railway don't have. Add netlify as an attribute to any HTML <form> tag, and Netlify automatically captures form submissions — no backend code, no database, no third-party service. You see submissions in your Netlify dashboard. It's dead simple for contact forms, signup forms, and feedback widgets. The free tier gives you 100 submissions per month.
5. Deploy Previews
Every pull request on GitHub automatically gets its own preview URL on Netlify. It looks something like deploy-preview-42--your-site.netlify.app. You can see exactly what your changes look like before merging to production. Share the preview link with someone for feedback. This is a feature most vibe coders don't know they have — and it's incredibly useful.
Real Scenario: You Built a Portfolio Site with AI, Now You Need It Live
Let's walk through the most common path. You asked Claude or Cursor to build you a portfolio site. It generated a React app with Vite — three pages, a contact form, some project showcases, and nice animations. It looks great on localhost:5173.
You ask your AI:
"How do I deploy this React Vite portfolio site so anyone can see it? I want it to be free and I've never deployed anything before."
Your AI will probably suggest Netlify. Here's the step-by-step it gives you:
- Push your code to GitHub. If you haven't already, your AI walks you through
git init, creating a repo, and pushing. - Go to app.netlify.com and sign up with your GitHub account.
- Click "Add new site → Import an existing project."
- Select your GitHub repo. Netlify asks for a build command and publish directory.
- Set the build command to
npm run build(orvite build— both work). - Set the publish directory to
dist(that's where Vite outputs built files). - Click Deploy. In about 60 seconds, your site is live at
your-site-name.netlify.app.
That's the happy path. Your portfolio is now on the internet. You can share the URL. You can add a custom domain later. Every time you push changes to GitHub, Netlify redeploys automatically.
But your AI probably also generated some configuration files. Let's look at what those do.
What AI Generates When It Adds Netlify Config
When you ask AI to set up Netlify deployment, it often creates configuration files. Here's the most common one and what every line does:
netlify.toml — The Main Config File
# netlify.toml — Netlify deployment configuration
# This file tells Netlify how to build and deploy your site
# Place it in your project root (next to package.json)
[build]
# The command Netlify runs to build your project
# Must match a script in your package.json
command = "npm run build"
# Where your built files end up after the build command runs
# Vite → "dist", Create React App → "build", Next.js → ".next"
publish = "dist"
# Where your serverless functions live (if you have any)
functions = "netlify/functions"
# Environment variables for the build step
# Better to set sensitive ones in the Netlify dashboard instead
[build.environment]
NODE_VERSION = "20"
NEXT_PUBLIC_SITE_URL = "https://myportfolio.com"
# Redirects — critically important for single-page apps (React, Vue)
# Without this, refreshing any page other than / gives a 404
[[redirects]]
from = "/*"
to = "/index.html"
status = 200
# Custom headers for security
[[headers]]
for = "/*"
[headers.values]
X-Frame-Options = "DENY"
X-Content-Type-Options = "nosniff"
# Settings for deploy previews
[context.deploy-preview]
command = "npm run build"
# Settings specific to production deploys
[context.production]
command = "npm run build"
[context.production.environment]
NODE_ENV = "production"
💡 The one line that matters most: For single-page apps (React, Vue, Svelte), the [[redirects]] rule that sends /* to /index.html with status 200 is essential. Without it, every page except your homepage returns a 404 when users refresh or navigate directly to a URL. This is the single most common Netlify deployment issue for vibe coders.
_redirects — The Simpler Alternative
Instead of putting redirect rules in netlify.toml, your AI might generate a _redirects file in your public directory:
# _redirects — Place this in your public/ or static/ folder
# Netlify reads this file for URL routing rules
# For single-page apps: send all routes to index.html
/* /index.html 200
# Redirect old URLs to new ones
/old-blog /blog 301
# Proxy API calls to avoid CORS issues
/api/* https://my-backend.railway.app/api/:splat 200
📋 netlify.toml vs _redirects: Both work. netlify.toml is more powerful (handles headers, build settings, environment variables, and redirects in one file). _redirects is simpler if you only need routing rules. If both exist, netlify.toml takes priority. Pick one — don't use both for redirects or you'll confuse yourself debugging.
Common Netlify Problems AI Creates
AI is great at generating code. It's frequently wrong about deployment details. Here are the problems you'll hit:
1. Wrong Build Directory (The #1 Issue)
# AI sets the publish directory wrong in netlify.toml
[build]
command = "npm run build"
publish = "build" # ← WRONG for Vite projects!
# Different frameworks output to different directories:
# Vite (React/Vue/Svelte) → "dist"
# Create React App → "build"
# Next.js → ".next"
# Astro → "dist"
# Hugo → "public"
# Gatsby → "public"
# If Netlify deploys but you see "Page not found":
# Your publish directory doesn't match where your built files actually are.
# Check by running "npm run build" locally and seeing what folder appears.
2. Missing Environment Variables
// AI generates code that references env vars without mentioning
// you need to add them on Netlify
const supabaseUrl = import.meta.env.VITE_SUPABASE_URL
const supabaseKey = import.meta.env.VITE_SUPABASE_ANON_KEY
// Locally: works fine (reads from .env file)
// On Netlify: both are undefined → your app silently breaks
// Fix: Site Settings → Environment Variables → add each one
// For Vite: variables MUST start with VITE_ to be exposed to the browser
// For Next.js on Netlify: variables MUST start with NEXT_PUBLIC_
// Without the prefix, the variable exists during build but not in the browser
3. Missing SPA Redirect (404 on Page Refresh)
# You built a React single-page app with React Router
# Every page works when you click links within the app
# But if you refresh /about or navigate directly to /projects → 404
# Why: Netlify tries to find a file at /about/index.html
# It doesn't exist — your entire app lives in index.html
# React Router handles routing client-side, but Netlify doesn't know that
# Fix: Add this to netlify.toml:
[[redirects]]
from = "/*"
to = "/index.html"
status = 200
# Or create a _redirects file in your public/ folder with:
# /* /index.html 200
# This tells Netlify: "For any URL, serve index.html and let
# React Router figure out what to display"
4. Redirect Loops
# AI generates conflicting redirect rules that loop forever
# netlify.toml
[[redirects]]
from = "/blog"
to = "/articles"
status = 301
[[redirects]]
from = "/articles"
to = "/blog"
status = 301
# Browser: /blog → /articles → /blog → /articles → ERR_TOO_MANY_REDIRECTS
# Fix: Remove the circular redirect. Decide on ONE canonical URL.
# Another common loop: forcing HTTPS + www at the same time
# Netlify handles HTTPS automatically — don't add your own HTTPS redirect
# It conflicts with Netlify's built-in SSL redirect
5. Build Command Doesn't Match package.json
# AI puts the wrong build command in netlify.toml
[build]
command = "npm run build"
# But your package.json has:
# "scripts": {
# "dev": "vite",
# "generate": "vite build" ← named "generate" not "build"!
# }
# Netlify runs "npm run build" → script not found → build fails
# Fix: Either rename your script to "build" or change netlify.toml:
[build]
command = "npm run generate"
📋 Pattern to watch for: If your AI generates Netlify config and doesn't mention the publish directory, SPA redirects, or environment variables — it's giving you an incomplete setup. Always ask: "What should my publish directory be for this framework?" and "Do I need a redirect rule for client-side routing?"
How to Debug Netlify Deploys
When your deploy fails or your site looks wrong after deploying, here's exactly how to figure out what went wrong:
Step 1: Read the Deploy Log
Every deploy on Netlify has a detailed log. Go to your site in the Netlify dashboard → Deploys → click the failed deploy. The log shows every step: installing dependencies, running the build command, and publishing files. The error is almost always in the last few lines before it says "Build failed."
"My Netlify deploy is failing. Here's the error from the deploy log: [paste the last 20 lines of the log]. My build command is 'npm run build' and my publish directory is 'dist'. What's wrong?"
Step 2: Test the Build Locally
Before blaming Netlify, run the exact build command on your own machine:
# Run the same command Netlify runs
npm run build
# If it fails locally, it'll definitely fail on Netlify
# Fix the local build first, then push
# If it works locally but fails on Netlify, the difference is usually:
# - Missing environment variables on Netlify
# - Different Node.js version (set NODE_VERSION in netlify.toml)
# - Case-sensitive file imports (your Mac doesn't care, Netlify's Linux does)
Step 3: Check Environment Variables
Go to Site Settings → Environment Variables. Compare every variable against your local .env file. Missing one? That's probably your problem. Typo in the name? That'll do it too.
"My site deploys to Netlify but the [feature] doesn't work. Locally it works fine. Here are the environment variable names in my .env file: [list names only, NOT values]. Which ones do I need to add to Netlify, and do any need a special prefix like VITE_ or NEXT_PUBLIC_?"
Step 4: The "Deployed But Broken" Checklist
Run through this every time your Netlify deploy succeeds but the site doesn't work right:
- ✅ Publish directory: Does it match your framework's output folder? (
distfor Vite,buildfor CRA,publicfor Hugo) - ✅ SPA redirects: If you're using client-side routing (React Router, Vue Router), do you have the
/*→/index.htmlredirect? - ✅ Environment variables: Are ALL of them set in Netlify's dashboard? With the correct prefix (
VITE_,NEXT_PUBLIC_)? - ✅ Build command: Does it exactly match a script in your
package.json? - ✅ Node version: Set
NODE_VERSION = "20"innetlify.tomlto match your local version. - ✅ Case sensitivity: Do all your file imports match the exact filename capitalization? (Mac is forgiving, Linux is not.)
- ✅ Mixed content: Are you loading HTTP resources on an HTTPS site? The browser blocks those silently.
⚠️ Never paste your actual API keys or secrets into an AI chat. Share variable names only (like SUPABASE_URL), not the values. Your AI doesn't need your database password to help you debug — it just needs to know which variables you're using.
Netlify vs Vercel vs Railway — When to Use Which
All three are good platforms. They solve different problems. Here's the honest breakdown:
Netlify
Best for: Static sites, React/Vue/Svelte SPAs, Astro, Hugo, Gatsby, JAMstack
- ✅ Dead simple deployment from GitHub
- ✅ Built-in form handling (no backend needed)
- ✅ Great for sites without heavy server-side rendering
- ✅ Generous free tier (100GB bandwidth, 300 build min)
- ✅ Deploy previews on every PR
- ⚠️ Next.js support works but isn't as deep as Vercel's
- ⚠️ Serverless function cold starts can be slow
- ⚠️ No persistent server (can't run Express, Django, etc.)
Vercel
Best for: Next.js apps, anything needing server-side rendering
- ✅ Created Next.js — best-in-class integration
- ✅ Server-side rendering works perfectly
- ✅ Preview deployments on every PR
- ✅ Edge functions for ultra-fast responses
- ⚠️ No built-in form handling
- ⚠️ Serverless function timeout (10s free, 60s pro)
- ⚠️ No persistent server for WebSockets
Railway
Best for: Full-stack apps with persistent backends, databases, background jobs
- ✅ Runs real servers (Express, FastAPI, Django)
- ✅ Built-in PostgreSQL, Redis, MongoDB hosting
- ✅ WebSocket support, no timeout limits
- ✅ Long-running background processes
- ⚠️ No global CDN (single region)
- ⚠️ Usage-based pricing can surprise you
- ⚠️ More complex setup than Netlify/Vercel
Quick Decision Guide
Choose based on what you built:
- 🟢 Portfolio site / landing page → Netlify (simplest path)
- 🟢 Astro / Hugo / Gatsby blog → Netlify (static site champion)
- 🟢 React SPA with Vite → Netlify or Vercel (both great)
- 🔵 Next.js with SSR → Vercel (created Next.js)
- 🟠 Express or Python backend → Railway (needs a real server)
- 🟠 App with database + WebSockets → Railway
- 🟢 Site with a contact form → Netlify (built-in forms are magic)
Netlify Free Tier: What You Actually Get
Netlify's free tier is called "Starter" and it's genuinely usable for real projects. Here's what's included and what will trip you up:
- 100GB bandwidth per month. That's a lot. A typical portfolio site uses 1-5GB/month. You'd need thousands of daily visitors to exceed this.
- 300 build minutes per month. Each deploy takes 1-3 minutes to build. At 2 minutes per build, you can deploy 150 times per month — roughly 5 times per day. Heavy pushers might hit this limit.
- 1 concurrent build. If you push twice quickly, the second build waits until the first finishes. Not a big deal for solo projects.
- 125,000 serverless function invocations per month. If you're using Netlify Functions for API calls, each request counts as one invocation. Most side projects use a fraction of this.
- 100 form submissions per month. The built-in form handling is limited but enough for a contact page. If you need more, use a service like Formspree or build your own with a serverless function.
- Free .netlify.app subdomain. Your site is live at
your-site.netlify.appimmediately. Custom domains are free to add. - Free SSL certificates. HTTPS is automatic on both the
.netlify.appsubdomain and custom domains. Powered by Let's Encrypt. - Deploy previews. Every pull request gets a preview URL, even on the free tier.
💡 When to upgrade: You need Netlify Pro ($19/month per member) when you hit bandwidth limits, need more build minutes, want analytics, or need role-based access for a team. Most individual vibe coders never need to upgrade. The free tier handles portfolio sites, blogs, documentation sites, and side projects comfortably.
What to Learn Next
Now that you understand what Netlify is and how deployment works, here are the concepts that connect directly:
Frequently Asked Questions
Is Netlify really free?
Yes. Netlify's Starter tier is free with no credit card required. You get 100GB bandwidth per month, 300 build minutes, 125,000 serverless function invocations, 100 form submissions, deploy previews, and a free .netlify.app subdomain with automatic SSL. Most portfolio sites, blogs, and side projects never exceed these limits. You only need Pro ($19/month) for higher bandwidth, more build minutes, analytics, or team collaboration features.
Should I use Netlify or Vercel?
If you're deploying a Next.js app with server-side rendering, use Vercel — it created Next.js and has the deepest integration. If you're deploying a static site, Astro project, Hugo blog, or a React SPA without server-side rendering, Netlify is excellent and often simpler. Netlify's built-in form handling is also a win if your site has contact forms. For most vibe-coded projects, either platform works great. Pick whichever your AI suggests first and switch later if you need to — migration is straightforward.
Can Netlify run a backend or database?
Netlify can run serverless functions — small pieces of backend code that execute on demand — but it cannot run a persistent server or host a database. Your serverless functions can connect to external databases like Supabase, PlanetScale, or Neon. If your project needs a full backend server running continuously (like Express.js, FastAPI, or Django), use Railway instead. Netlify is designed for frontends and JAMstack architectures where the backend lives behind APIs.
Why did my Netlify deploy fail?
The three most common causes: (1) Wrong publish directory — Netlify is looking for built files in the wrong folder; check that it matches your framework (dist for Vite, build for Create React App, public for Hugo/Gatsby). (2) Missing environment variables — your .env file doesn't get uploaded to Netlify; add every variable in Site Settings → Environment Variables. (3) Build command error — the command doesn't match a script in your package.json. Check the deploy log in your Netlify dashboard for the exact error.
What is netlify.toml and do I need it?
netlify.toml is a configuration file that tells Netlify how to build and deploy your project — build command, publish directory, redirects, headers, and environment variables. You don't always need it because Netlify can auto-detect many frameworks from your package.json. But it's useful because it version-controls your deploy settings (they travel with your code instead of living only in the dashboard). It's especially important for single-page app redirects and custom headers. If your AI generates one, keep it — it makes your deploys more predictable.