Skip to content

Quick Start

Verified status as of March 28, 2026. Runtime note: FastFN auto-installs function-local dependencies from requirements.txt / package.json; host runtimes are required in fastfn dev --native, while fastfn dev depends on a running Docker daemon.

Quick View

  • Complexity: Beginner
  • Typical time: 10-15 minutes
  • Scope: create one function, run locally, call it, and confirm OpenAPI visibility
  • Expected outcome: a working GET /hello endpoint and docs at /docs

Prerequisites

  • FastFN CLI installed and available in PATH
  • One execution mode ready:
  • Portable mode: Docker daemon running
  • Native mode: openresty and runtime binaries available

1. Create your first function (neutral path)

mkdir -p functions/hello

Choose one runtime implementation inside functions/hello/:

File: functions/hello/handler.js

exports.handler = async (event) => ({
  status: 200,
  body: { hello: event.query?.name || "World", runtime: "node" }
});

File: functions/hello/handler.py

def handler(event):
    name = (event.get("query") or {}).get("name", "World")
    return {"status": 200, "body": {"hello": name, "runtime": "python"}}

File: functions/hello/handler.rs

use serde_json::{json, Value};

pub fn handler(event: Value) -> Value {
    let name = event
        .get("query")
        .and_then(|q| q.get("name"))
        .and_then(|n| n.as_str())
        .unwrap_or("World");

    json!({
        "status": 200,
        "body": {
            "hello": name,
            "runtime": "rust"
        }
    })
}

File: functions/hello/handler.php

<?php

function handler(array $event): array {
    $query = $event['query'] ?? [];
    $name = $query['name'] ?? 'World';

    return [
        'status' => 200,
        'body' => [
            'hello' => $name,
            'runtime' => 'php',
        ],
    ];
}

2. Start the local server

fastfn dev functions

3. Validate with curl (per runtime)

curl -sS 'http://127.0.0.1:8080/hello?name=World'
curl -sS 'http://127.0.0.1:8080/hello?name=World'
curl -sS 'http://127.0.0.1:8080/hello?name=World'
curl -sS 'http://127.0.0.1:8080/hello?name=World'

Expected response shape:

{
  "hello": "World",
  "runtime": "<selected-runtime>"
}

4. Verify generated API docs

curl -sS 'http://127.0.0.1:8080/openapi.json' | jq '.paths | has("/hello")'

Expected output:

true

Swagger UI showing FastFN routes

Validation checklist

  • GET /hello returns HTTP 200
  • /openapi.json contains /hello
  • /docs loads and shows the route

Troubleshooting

  • Runtime down or 503: check /_fn/health and missing host dependencies
  • Route missing: confirm folder layout and rerun discovery (/_fn/reload)
  • /docs empty: verify docs/OpenAPI toggles were not disabled
Last reviewed: March 28, 2026 · Docs on fastfn.dev