Netlify
Preset: netlify
Normally, deploying to Netlify does not require any configuration. Nitro auto-detects that you are in a Netlify build environment and builds the correct version of your server.
For new sites, Netlify detects that you are using Nitro and sets the publish directory to dist and the build command to npm run build. If you are upgrading an existing site, check these settings and update them if needed.
To add custom redirects, use routeRules or add a _redirects file to your public directory.
To deploy, just push to your git repository as you would normally do for Netlify.
dist when creating a new project.Netlify edge functions
Preset: netlify_edge
Netlify Edge Functions use Deno and the powerful V8 JavaScript runtime to let you run globally distributed functions for the fastest possible response times.
With this preset, Nitro runs the server directly at the edge, closer to your users.
dist when creating a new project.Netlify static
Preset: netlify_static
Use the netlify_static preset to pre-render your app and deploy it to Netlify as a fully static site (no functions).
Custom deploy configuration
You can provide additional deploy configuration using the netlify.config key inside nitro.config. It follows the Netlify Frameworks API config.json format and will be merged with the built-in auto-generated configuration.
import { defineConfig } from "nitro";
export default defineConfig({
netlify: {
config: {
// Netlify Image CDN remote images
images: {
remote_images: ["https://example.com/.*"],
},
// Custom headers
headers: [{ for: "/static/*", values: { "cache-control": "public, max-age=31536000" } }],
// Custom redirects
redirects: [{ from: "/old", to: "/new", status: 301 }],
},
},
});
Supported keys:
edge_functions: Additional edge function declarations.functions: Functions configuration, either global or by function pattern (e.g.,included_files).headers: Custom header rules.images: Netlify Image CDN configuration (e.g.,remote_images).redirects: Custom redirect rules.
netlify.images option is deprecated. Use netlify.config.images instead.