Functions Features

Functions are blocks of code that run on demand without the need to manage any infrastructure. Develop on your local machine, test your code from the command line (using doctl), then deploy to a production namespace or App Platform — no servers required. Learn more about functions.


What are Serverless Functions?

Serverless architecture is a way to design web applications and services that doesn’t rely on managing backend infrastructure. In a serverless architecture, cloud providers like DigitalOcean provision, manage, and scale the backend servers and components required to host applications.

DigitalOcean Functions is a function as a service (FaaS) platform. Functions lets you deploy code that can perform the same tasks as a traditional API without the requirement of setting up a server to manage the requests. Each function you deploy is assigned a unique URL which you can use to anonymously test the function. You can invoke your functions and inspect their logs and results directly from your terminal.

Use Cases

Functions is a good fit for small or repetitive functions with variable workloads. Functions only run in response to events or requests, and you’re only charged for what you use, so they’re most cost-effective for components with fluctuating amounts of requests.

DigitalOcean Functions and other FaaS products are designed for ease of deployment without any need to consider the underlying infrastructure. If you want more control over your production environment, consider using App Platform, our PaaS offering or Droplets, our Linux-based VMs.

Functions Options

Functions Platform

You can develop and deploy DigitalOcean Functions using our doctl command line tool or through the control panel.

The control panel has a basic editor with the ability to invoke your functions, change its input parameters, and view its output and logs. You can also create, edit, and destroy functions and namespaces through the control panel.

Most developers will use the command line to deploy their functions. Our doctl command line tool allows you to scaffold new projects, connect them to a new Functions namespace in the cloud, and quickly deploy, test, and iterate your functions.

App Platform Functions Component

You can also deploy Functions as a component of an App Platform app. The actual runtime environment and infrastructure is the same as the Functions platform, with the addition of App Platform handling versioning, rollback, environment variables, and other processes specific to the App Platform environment.

Functions components in App Platform integrate with the rest of App Platform’s offerings, which lets you use functions to build an API that powers the rest of your app’s backend alongside its static site or containerized web application.

Supported Runtimes

Functions currently has eight different runtimes, representing four different programming languages:

  • Go 1.17
  • Go 1.20
  • Node.js 14
  • Node.js 18
  • PHP 8.0
  • PHP 8.2
  • Python 3.9
  • Python 3.11

You can also view the list of supported runtimes with doctl serverless status --languages.

Insights & Logs

DigitalOcean Functions have built-in insights, including activation rate, average duration, average wait time, and error rate over the last 14 days. Functions also has 3 days of log retention.