Join us Sept 21st to learn how Netlify unleashes the power of Jamstack for Enterprise teams. Register now!

Netlify Functions

Build scalable,
dynamic applications

Deploy server-side code that works as API endpoints, runs automatically in response to events, or processes more complex jobs in the background.

How it works

Example use cases

Explore on the Netlify Functions Playground

Shorten build times for large Jamstack projects with On-demand Builders, now in early access.

Learn more

All part of one amazing workflow

Manage everything in one project

Netlify Functions are files you write in JavaScript, TypeScript, or Go and then place inside your project under the path netlify/functions. (Easy, right? You can even configure that.)

Normally, functions are synchronous with a maximum execution time of 10 seconds. But, adding -background to the end of the filename transforms any function into an asynchronous function that can run in the background with up to 15 minutes of runtime.

async functionreturn200JSON handlerstringify exports. = (event, context) { { statusCode: , body: . ({message: "Hello World"}) }; } my-base-directory/ package.json ├ node_modules ⌊ my-serverless-functions/ hello.js send-pdf-background.js

Build & test locally

You can use Netlify CLI to run a local development server that you can share with others, run a local build and plugins, and deploy your site.

The 2.0 version of our Node-based CLI was rebuilt from the ground up to help improve the site building experience.

Authorize Application Netlify CLI is asking for permission to access Netlify on your behalf. Authorize Deny ◈ Netlify Dev ◈ ◈ Functions server is listening on 56302 ---------------------------------- Local: http://localhost:8080 External: http://192.168.7.47:8080 ----------------------------------

Deploy backend functions & frontend code together

Atomically deploy your sites and apps, pushing frontend code and backend functions together, as a unit, without even requiring a maintenance window.

production Running in . Endpoint: https://site-name.netlify.app/.netlify/functions/name Function [name] Preview deploy Logs retention: Your logs are retained for an hour [] = = = = FunctionscommandpublishNODE_ENV build “functions-build” “yarn run build” “dist” “8.11.3”

Stage, preview, and rollback

Netlify Functions share all of Netlify’s beloved workflow features. Preview every commit with Deploy Preview links. Rollback when needed by simply clicking a prior deployment.

Netlify bot commented 1 day ago Deploy preview for ready! project-name Built with commit https://deploy-preview-3766--www.project-name.app ebc850e https://dpc.project-name.app/deploy-preview-3766... Leave feedback: Merge pull request

Run A/B testing and phased rollouts

Deploy and test multiple branches, and even control which users see which version. Plan full experiments and rolling upgrades that include both front and backend code changes. A/B test not just a button color, but an entire user workflow.

Test #1 Running the beach Branch 75% Split master Branch 25% Split
async functionreturn200JSON handlerstringify exports. = (event, context) { { statusCode: , body: . ({message: "Hello World"}) }; } my-base-directory/ package.json ├ node_modules ⌊ my-serverless-functions/ hello.js send-pdf-background.js Authorize Application Netlify CLI is asking for permission to access Netlify on your behalf. Authorize Deny ◈ Netlify Dev ◈ ◈ Functions server is listening on 56302 ---------------------------------- Local: http://localhost:8080 External: http://192.168.7.47:8080 ---------------------------------- production Running in . Endpoint: https://site-name.netlify.app/.netlify/functions/name Function [name] Preview deploy Logs retention: Your logs are retained for an hour [] = = = = FunctionscommandpublishNODE_ENV build “functions-build” “yarn run build” “dist” “8.11.3” Netlify bot commented 1 day ago Deploy preview for ready! project-name Built with commit https://deploy-preview-3766--www.project-name.app ebc850e https://dpc.project-name.app/deploy-preview-3766... Leave feedback: Merge pull request Test #1 Running the beach Branch 75% Split master Branch 25% Split

Just Launched

Datadog integration

Send traffic and functions logs to Datadog for search, analysis, and alerting. Available with Netlify Enterprise to help your team deliver a fast, error-free web experience and identify key visitor trends.

Learn more

The different flavors of compute on Netlify

Netlify provides developers several powerful tools to make websites and web applications both extremely performant and highly dynamic.

A comparison table for the different flavors of compute on Netlify

Memory

Execution limit

Where it runs

Language

Serverless Functions for Real-time compute
Memory
1024MB of memory
Execution limit
10 seconds
Where it runs
AWS Lambda
Language
JavaScript, TypeScript, or Go
Background Functions for long-running tasks
Memory
1024MB of memory
Execution limit
15 minutes
Where it runs
AWS Lambda
Language
JavaScript, TypeScript, or Go
Edge Handlers for Fast personalization
Memory
245MB of memory
Execution limit
50ms
Where it runs
Directly on our edge nodes
Language
JavaScript
Build-time compute for prerendering pages in advance
Memory
6 - 36GB of memory Up to 10 vCPUs
Execution limit
15 minutes
Where it runs
In our build environment
Language
Almost any language
New! On-demand rendering of pages & assets for large sites
Memory
1024MB of memory
Execution limit
10 seconds
Where it runs
AWS Lambda
Language
JavaScript or TypeScript
Maciej Malesa

Moving all LiveChat websites to Netlify has empowered our Web Dev Team to iterate fast and independently.

Maciej Malesa, CTO, LiveChat

Pricing for Netlify Functions

Netlify Functions are free to try and available as soon as you activate your account. Pricing scales as your usage grows—from small projects to fully customized enterprise plans.

Functions pricing table
Level 0 $0 Level 1 $25 per site /month Level 2 included with Business or Enterprise plan
Requests /month
125,000
2 million
Unlimited
Run time /month
100 hours
1,000 hours
Unlimited
Background Functions Available on Pro plans and above Yes Yes Yes
Deploy to custom AWS account No No Yes
Extras No
Add packs of 500k requests and 500 runtime hours $19/each
Contact sales

Functions pricing table
Level 0 $0
Requests /month
125,000
Run time /month
100 hours
Background Functions Yes
Level 1 $25 per site /month
Requests /month
2 million
Run time /month
1,000 hours
Background Functions Yes
Extras
Add packs of 500k requests and 500 runtime hours $19/each
Level 2 included with Business or Enterprise plan
Requests /month
Unlimited
Run time /month
Unlimited
Background Functions Yes
Deploy to custom AWS account Yes
Extras Contact sales

Keep exploring the Netlify Platform

  • Netlify Workflow

    Netlify Workflow

    Work as a team, right in Git. Netlify neatly deploys every resource to the right place, from global static assets to serverless functions.

  • Netlify Build

    Netlify Build

    The Git workflow for web development. Build, deploy, and manage modern web projects.

  • Netlify Edge

    Netlify Edge

    A fast, resilient network for web apps. Connected to your development workflow and designed to handle the most complex tasks - or even to run your own custom logic.

  • Addons & Integrations

    Addons & Integrations

    Add powerful capabilities to every build and integrate easily with other SaaS services. Find the plugins you need from the community or even create your own.