https://github.com/misaelzapata/fastfn
FastFN: build file-based APIs and SPAs with Python, Node.js, PHP, Lua, Rust, and Go, using one simple local-first runtime.
https://github.com/misaelzapata/fastfn
aws-lamba-python aws-lambda aws-lambda-golang aws-lambda-node cloudflare-worker cloudflare-workers faas faas-cli faas-platform lua next nextjs node node-js nodejs openresty php python spa vite
Last synced: about 20 hours ago
JSON representation
FastFN: build file-based APIs and SPAs with Python, Node.js, PHP, Lua, Rust, and Go, using one simple local-first runtime.
- Host: GitHub
- URL: https://github.com/misaelzapata/fastfn
- Owner: misaelzapata
- License: mit
- Created: 2026-02-16T02:07:49.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2026-03-29T03:53:44.000Z (3 months ago)
- Last Synced: 2026-03-29T05:26:33.319Z (3 months ago)
- Topics: aws-lamba-python, aws-lambda, aws-lambda-golang, aws-lambda-node, cloudflare-worker, cloudflare-workers, faas, faas-cli, faas-platform, lua, next, nextjs, node, node-js, nodejs, openresty, php, python, spa, vite
- Language: Lua
- Homepage: https://fastfn.dev
- Size: 17.3 MB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Agents: AGENTS.md
Awesome Lists containing this project
README
FastFN
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.
## Why People Pick FastFN
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.py` becomes `GET /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/` or `dist/`
- 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 |
## Start in 60 seconds
This is the shortest path from zero to a running route with docs.
### 1) Install
Homebrew:
```bash
brew tap misaelzapata/homebrew-fastfn
brew install fastfn
```
From source:
```bash
cd cli && go build -o ../bin/fastfn
./bin/fastfn --help
```
### 2) Write one function
`functions/get.hello.py`
```python
def main(req):
name = (req.get("query") or {}).get("name", "World")
return {"message": f"Hello, {name}!"}
```
### 3) Run
```bash
fastfn dev functions
```
Try it:
```bash
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.
## A CLI You Can Stay In
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:
```bash
fastfn init hello -t python
fastfn dev .
fastfn docs
fastfn doctor domains --domain api.example.com
fastfn run --native .
fastfn --help
```
That 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](https://fastfn.dev/en/tutorial/spa-and-api-together/) walks through that setup directly.
## Repository Layout
- `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.
## Documentation
- Start: [Docs Home](https://fastfn.dev/en/)
- First steps: [Quick Start](https://fastfn.dev/en/tutorial/first-steps/)
- SPA + API: [Serve a SPA and API Together](https://fastfn.dev/en/tutorial/spa-and-api-together/)
- Linux service: [Run FastFN as a Linux Service](https://fastfn.dev/en/how-to/run-as-a-linux-service/)
- Routing: [`docs/en/tutorial/routing.md`](./docs/en/tutorial/routing.md)
- CLI reference: [`docs/en/reference/cli.md`](./docs/en/reference/cli.md)
- HTTP/OpenAPI: [`docs/en/reference/http-api.md`](./docs/en/reference/http-api.md)
- Function spec: [`docs/en/reference/function-spec.md`](./docs/en/reference/function-spec.md)
- Architecture: [`docs/en/explanation/architecture.md`](./docs/en/explanation/architecture.md)
- Public assets: [`docs/en/articles/cloudflare-style-public-assets.md`](./docs/en/articles/cloudflare-style-public-assets.md)
## Configuration (`fastfn.json`)
FastFN reads `fastfn.json` in the current directory by default.
```json
{
"functions-dir": "functions",
"public-base-url": "https://api.example.com",
"openapi-include-internal": false
}
```
Key behavior:
- `openapi-include-internal` defaults to `false`.
- Env override for internal visibility: `FN_OPENAPI_INCLUDE_INTERNAL`.
- `public-base-url` controls `servers[0].url` in generated OpenAPI.
- `domains` helps CLI doctor checks; host enforcement at runtime lives in per-function `invoke.allow_hosts`.
Reference:
- [`docs/en/reference/fastfn-config.md`](./docs/en/reference/fastfn-config.md)
- [`docs/en/reference/function-spec.md`](./docs/en/reference/function-spec.md)
## License
MIT. See [`LICENSE`](./LICENSE).