Functions Framework for Dart

DISCLAIMER: this is not ready for production.

Functions FrameworkUnit TestsLint TestConformance Tests
Dart

An open source FaaS (Function as a Service) framework for writing portable Dart functions, brought to you by the Google Dart and Cloud Functions teams.

The Functions Framework lets you write lightweight functions that run in many different environments, including:

The framework allows you to go from:

import 'package:functions_framework/functions_framework.dart';
import 'package:shelf/shelf.dart';

@CloudFunction()
Response handleGet(Request request) => Response.ok('Hello, World!');

To:

curl http://my-url
# Output: Hello, World!

All without needing to worry about writing an HTTP server or request handling logic.

Features

  • Build your Function in the same container environment used by Cloud Functions using buildpacks.
  • Invoke a function in response to a request
  • Automatically unmarshal events conforming to the CloudEvents spec
  • Portable between serverless platforms

Quickstart: Hello, World on your local machine

$ docker build -t app .
...

$ docker run -it -p 8080:8080 --name demo app
App listening on :8080

In another terminal...

$ curl localhost:8080
Hello, World!

Contributing changes

See CONTRIBUTING.md for details on how to contribute to this project, including how to build and test your changes as well as how to properly format your code.

Licensing

BSD 3-Clause License. See LICENSE for details.

Libraries

functions_framework
serve