MCPcopy Index your code
hub / github.com/fnproject/fn

github.com/fnproject/fn @v0.3.770

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.3.770 ↗ · + Follow
2,362 symbols 7,508 edges 221 files 684 documented · 29% updated 28d ago0.3.25 · 2017-07-26★ 5,941144 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Fn Project

Quickstart  |  Tutorials  |  Docs  |  API  |  Operating  |  Flow  |  UI

CircleCI GoDoc Go Report Card

Welcome

Fn is an event-driven, open source, Functions-as-a-Service (FaaS) compute platform that you can run anywhere. Some of its key features:

  • Open Source
  • Native Docker: use any Docker container as your Function
  • Supports all languages
  • Run anywhere
  • Public, private and hybrid cloud
  • Import Lambda functions and run them anywhere
  • Easy to use for developers
  • Easy to manage for operators
  • Written in Go
  • Simple yet powerful extensibility

The fastest way to experience Fn is to follow the quickstart below, or you can jump right to our full documentation, API Docs, or hit us up in our Slack Community or Community Page!

Quickstart

Pre-requisites

  • Docker 17.10.0-ce or later, Podman 5.7.0 or later installed and running
  • Docker Hub account (or other Docker-compliant registry) (Not required for local development)
  • Logged into Registry: ie docker login (Not required for local development)

Install CLI tool

The command line tool isn't required, but it makes things a lot easier. There are a few options to install it:

Option 1. Homebrew - macOS

If you're on a Mac and use Homebrew:

brew update && brew install fn

Option 2. Shell script - Linux and macOS

This one works on Linux and macOS (partially on Windows).

If you are running behind a proxy first set your http_proxy and https_proxy environment vars:

curl -LSs https://raw.githubusercontent.com/fnproject/cli/master/install | sh

This will download a shell script and execute it. If the script asks for a password, that is because it invokes sudo.

Option 3. Install the Windows CLI

Install and run the Fn Client for Windows.

Option 4. Download the bin - Linux, macOS and Windows

Head over to our releases and download it.

Before you start

If you are using Podman or Rancher desktop, it is recommended use a volume. The volume will be used by FnServer to create unix socket file to communicate to other Fn containers.

The volume will be created automatically when you use "--iofs-dir" option in "fn start" and specify the volume name (e.g. fniofsvol).

If you want to create volume manually, you could do: docker volume create --opt device=tmpfs --opt type=tmpfs --opt o=size=2M,dev,noexec <volume name>

The docker command is provided by podman or rancher desktop in this case.

Run Fn Server

First, start up a Fn server locally:

fn start

or if you are on podman/rancher which you need to use a volume

fn start --iofs-dir <volume name, or it could be a directory in the host VM for Docker Desktop>

iofs-dir allows you to specify a volume (which is required for Podman or Rancher case), or any directory in the host-vm (for Docker Desktop) if you want to use a specific directory to host the unix socket file. It is usually not a concern for Docker users.

This will start Fn in single server mode, using an embedded database and message queue. You can find all the configuration options here. If you are on Windows, check here.

SELinux

Most Linux systems have SELinux enabled and FnServer supports running on SELinux.

Your First Function

Functions are small but powerful blocks of code that generally do one simple thing. Forget about monoliths when using functions, just focus on the task that you want the function to perform. Our CLI tool will help you get started quickly.

Let's create your function. You can use any runtime (ie go, node, java, python, etc.) hello will be the name of your function as well as create a directory called hello. You can name your function anything.

fn init --runtime go hello
cd hello

We need to create an "app" which acts as a top-level collection of functions and other elements:

fn create app myapp

Deploy your function:

fn deploy --app myapp --local

Note: --local flag will skip the push to remote container registry making local development faster

Now let's actually run your function using the invoke command:

fn invoke myapp hello

That's it! You just deployed and ran your first function! Try updating the function code in func.go (or .js, .java, etc.) then deploy it again to see the change.

Learn More

Get Help

Get Involved

Stay Informed

Extension points exported contracts — how you extend this code

ResponseBuffer (Interface)
ResponseBuffer implements http.ResponseWriter [11 implementers]
api/server/runner_fninvoke.go
ReadDataAccess (Interface)
XXX(reed): this is only used by the front end now, this should be in the server/ package ReadDataAccess represents read [7 …
api/agent/data_access.go
RunnerCall (Interface)
RunnerCall provides access to the necessary details of request in order for it to be processed by a RunnerPool [4 implementers]
api/runnerpool/runner_pool.go
CallListener (Interface)
CallListener enables callbacks around Call events. [4 implementers]
fnext/listeners.go
APIError (Interface)
APIError any error that implements this interface will return an API response with the provided status code and error me [3 …
api/models/error.go
APIHandler (Interface)
APIHandler may be used to add an http endpoint on the versioned route of the Fn API. [2 implementers]
fnext/api.go
Middleware (Interface)
Middleware just takes a http.Handler and returns one. So the next middle ware must be called within the returned handler [2 …
fnext/middleware.go
ResourceProvider (Interface)
ResourceProvider provides an abstraction for supplying data store tests with appropriate initial testing objects for run [1 …
api/datastore/datastoretest/test.go

Core symbols most depended-on inside this repo

New
called by 168
api/datastore/datastore.go
Error
called by 149
api/agent/resource.go
Run
called by 73
api/agent/drivers/driver.go
String
called by 70
api/server/server.go
Err
called by 69
api/common/ctx.go
Now
called by 69
api/common/clock.go
Done
called by 68
api/common/ctx.go
String
called by 66
api/id/id.go

Shape

Method 1,283
Function 770
Struct 199
Interface 61
TypeAlias 36
FuncType 11
Class 2

Languages

Go100%
Java1%

Modules by API surface

api/agent/grpc/runner.pb.go349 symbols
api/agent/agent.go81 symbols
api/agent/drivers/driver.go57 symbols
api/agent/drivers/docker/docker_test.go52 symbols
api/agent/pure_runner.go51 symbols
api/server/server.go47 symbols
api/agent/drivers/docker/docker_client.go47 symbols
api/agent/drivers/docker/docker_pool.go41 symbols
api/agent/agent_test.go40 symbols
api/datastore/datastoretest/test.go38 symbols
api/datastore/sql/sql.go36 symbols
api/datastore/mock.go34 symbols

Dependencies from manifests, versioned

filippo.io/edwards25519v1.1.0 · 1×
github.com/Azure/go-ansitermv0.0.0-2025010203350 · 1×
github.com/Microsoft/go-winiov0.6.2 · 1×
github.com/beorn7/perksv1.0.1 · 1×
github.com/bytedance/gopkgv0.1.3 · 1×
github.com/cespare/xxhash/v2v2.3.0 · 1×
github.com/cloudwego/base64xv0.1.6 · 1×

Datastores touched

(mysql)Database · 1 repos
funcsDatabase · 1 repos
funcsDatabase · 1 repos

For agents

$ claude mcp add fn \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact