(Optional) Set a custom functions directory in netlify.toml (default is <base>/netlify/functions): [functions] then directory = "my_functions"
Scaffold a new function interactively or from a template: netlify functions:create --language typescript --template hello-world
Or hand-write a function file directly at netlify/functions/hello.mts using the modern default-export handler: export default async (req: Request, context: Context) => new Response("Hello, world!"); export const config: Config = { path: "/hello" };
List functions detected locally to verify naming/format: netlify functions:list
Test locally with the full Netlify environment emulated: netlify dev, then trigger it with netlify functions:invoke hello --payload '{"foo":1}'
Create a draft (preview) deploy that uploads static files and functions: netlify deploy
Ship it live to production: netlify deploy --prod
Official docs: https://docs.netlify.com/build/functions/get-started/ ; https://cli.netlify.com/commands/functions/ ; https://docs.netlify.com/build/functions/configuration/ ; https://cli.netlify.com/commands/deploy/
Known gotchas
Function entry files must use .mts (TypeScript) or .mjs (JavaScript) with a default export to use the modern Netlify Functions format; if placed in a subdirectory, the entry file must be named index or match the subdirectory name
Keep the functions directory outside your publish directory — otherwise function source files get deployed as static site content
Additional [functions] options like node_bundler = "esbuild", external_node_modules, and included_files control bundling and which extra files get packaged with a function
netlify.toml settings for functions override whatever is configured in the Netlify UI build settings
netlify deploy defaults to a draft/preview deploy; you must pass --prod to actually deploy to your production URL, and --no-build skips running your build command first
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?