Start with one file, a friendly CLI, and a route tree that can grow into a real API or SPA without a rewrite later.
FastFN keeps the terminal as the main control surface: scaffold routes, run locally, inspect docs, and ship a small API or SPA + API stack without a lot of glue.
Quick Start • SPA + API • Linux Service • Examples
Watch MP4 • Read Quick Start • Serve SPA + API
Warning
FastFN is alpha-quality software. The API surface is evolving and breaking changes may occur between minor versions. Do not use in production without understanding the risks.
FastFN is for teams that want a simple start, a clear mental model, and a CLI they can stay in while the project grows.
If you like the clarity of FastAPI or the file-routing feel of frameworks like Next.js, FastFN aims for that same low-friction start while letting one API tree mix Python, Node.js, PHP, Lua, Rust, and Go.
- File routes feel local:
get.hello.pybecomesGET /hello - One API tree can mix Python, Node.js, PHP, Lua, Rust, and Go
- OpenAPI and Swagger stay generated from the real route graph
- Public assets can be mounted Cloudflare-style from
public/ordist/ - The CLI scaffolds, runs, documents, and validates the project in one loop
| What You Want | With FastFN |
|---|---|
| Start fast | One file, one command |
| Scale language choice | Mix runtimes in one API |
| Keep docs current | OpenAPI generated from real routes |
| Keep ops predictable | Gateway + contracts + tests in repo |
This is the shortest path from zero to a running route with docs.
Homebrew:
brew tap misaelzapata/homebrew-fastfn
brew install fastfnFrom source:
cd cli && go build -o ../bin/fastfn
./bin/fastfn --helpfunctions/get.hello.py
def main(req):
name = (req.get("query") or {}).get("name", "World")
return {"message": f"Hello, {name}!"}fastfn dev functionsTry it:
curl -sS "http://127.0.0.1:8080/hello?name=Developer"Docs:
- Swagger UI:
http://127.0.0.1:8080/docs - OpenAPI JSON:
http://127.0.0.1:8080/_fn/openapi.json
That is the core loop: create a file, run fastfn dev, and call the route.
When a handler needs external packages, the fastest and most predictable path is still an explicit requirements.txt or package.json.
FastFN can also infer dependencies for Python and Node, and it now supports optional backends like pipreqs, detective, and require-analyzer, but that path is slower and is best treated as a bootstrap tool for quick demos or first drafts.
FastFN is meant to feel simple from the terminal: scaffold a route, run it, inspect docs, and validate the project without switching mental models.
Common commands you will actually use:
fastfn init hello -t python
fastfn dev .
fastfn docs
fastfn doctor domains --domain api.example.com
fastfn run --native .
fastfn --helpThat gives you the main loop:
- scaffold with
init - run locally with
dev - open live docs with
docs - check domains or config with
doctor - switch to native mode with
run --native
For the simplest SPA + API setup, keep your frontend build in dist/ or public/, keep your API under api/, and let FastFN serve both under one base URL with almost no glue.
The SPA + API tutorial walks through that setup directly.
cli/: Go CLI source and local test runners.cli/tools/: local helper scripts.openresty/: gateway/runtime Lua and console assets.examples/: runnable examples and demos.tests/unit/: runtime and SDK unit checks.tests/integration/: API/OpenAPI/native/hot-reload checks.tests/e2e/: browser/UI tests.tests/stress/: benchmark scenarios.tests/results/: generated artifacts from test runs.docs/: MkDocs source (docs/en,docs/es) and theme overrides.
- Start: Docs Home
- First steps: Quick Start
- SPA + API: Serve a SPA and API Together
- Linux service: Run FastFN as a Linux Service
- Routing:
docs/en/tutorial/routing.md - CLI reference:
docs/en/reference/cli.md - HTTP/OpenAPI:
docs/en/reference/http-api.md - Function spec:
docs/en/reference/function-spec.md - Architecture:
docs/en/explanation/architecture.md - Public assets:
docs/en/articles/cloudflare-style-public-assets.md
FastFN reads fastfn.json in the current directory by default.
{
"functions-dir": "functions",
"public-base-url": "https://api.example.com",
"openapi-include-internal": false
}Key behavior:
openapi-include-internaldefaults tofalse.- Env override for internal visibility:
FN_OPENAPI_INCLUDE_INTERNAL. public-base-urlcontrolsservers[0].urlin generated OpenAPI.domainshelps CLI doctor checks; host enforcement at runtime lives in per-functioninvoke.allow_hosts.
Reference:
MIT. See LICENSE.