# Python, Node.js, Go and Rust

> APIs deploy with no configuration, the way Vercel finds them: forkrail detects the framework, the entry file and the language version from your project.

- Category: Deploy
- URL: https://www.forkrail.com/docs/languages

## Python

FastAPI, Flask, Django, FastHTML, or any ASGI or WSGI app.

- **Entry:** the first of `app.py`, `index.py`, `server.py`, `main.py`, `wsgi.py`, `asgi.py` (at the top, then in `src/`, `app/` and `api/`) that defines `app`, `application` or `handler`. Or set `[tool.vercel] entrypoint = "module:app"` in `pyproject.toml`. Django’s comes from `manage.py`.
- **Dependencies:** `pyproject.toml` (pinned by `uv.lock`), `Pipfile.lock`, `Pipfile` or `requirements.txt`.
- **Version:** `.python-version`, else `requires-python`, else `Pipfile.lock`. Lambda runs 3.12, 3.13 and 3.14; a project that names none runs 3.13.
- WSGI apps (Flask, Django) run in 10 threads; ASGI apps run `async` routes on their event loop.
- Django: `collectstatic` runs at build time when `STATIC_ROOT` is set, and the router serves the files. Add your hosts to `ALLOWED_HOSTS`.

**api/main.py**

```ts
from fastapi import FastAPI

app = FastAPI()

@app.get("/api/hello")
def hello():
    return {"hello": "world"}
```

## Node.js

Express, Hono, Fastify, Koa, NestJS, Elysia, H3, or any `server.*` file.

- **Entry:** the first of `app`, `index`, `server`, `src/app`, `src/index`, `src/server` (NestJS: `src/main`) with a `.js`, `.mjs`, `.cjs`, `.ts`, `.mts` or `.cts` extension that imports the framework, else `package.json`’s `main`.
- The app may listen on `PORT` or export itself (`export default app`); both work, as on Vercel.
- **Version:** `engines.node`. Lambda runs Node 24 (the default) and 22.
- Dependencies install with the project’s package manager, and its `vercel-build` or `build` script runs. TypeScript is bundled with esbuild.

**server.ts**

```ts
import { Hono } from 'hono'

const app = new Hono()
app.get('/', (c) => c.json({ ok: true }))

export default app
```

## Functions in api/

Vercel’s zero-config functions work the same way: every file in `api/` is a function, served at its path without the extension.

- `api/hello.ts` answers `/api/hello`; `api/index.ts` answers `/api`; `api/users/[id].ts` answers `/api/users/<id>` with `id` in the query.
- Node handlers take both of Vercel’s shapes: `export default function handler(req, res)` with `req.query`, `req.body`, `res.json()` and friends, or Web handlers like `export function GET(request)` returning a `Response`.
- Python files that define `app` (ASGI or WSGI) or a `handler` class are functions; other `.py` files are modules.
- Files and folders starting with `_` or `.` aren’t functions.
- Every function in a project runs on one language’s runtime. Node and Python functions in the same project, or functions beside a server, are refused for now.

**api/hello.ts**

```ts
export function GET(request: Request) {
  return Response.json({ hello: new URL(request.url).searchParams.get('name') ?? 'world' })
}
```

## Go and Rust

- **Vercel’s layout:** each file in `api/` is a function. Go files export one `func(http.ResponseWriter, *http.Request)`. Rust files are `[[bin]]` targets written with the `vercel_runtime` crate, unchanged.
- **A web server:** a Go `main` package (`main.go`, `cmd/api/main.go`, `cmd/server/main.go`) or a Rust binary (axum, actix) that listens on `PORT`.
- Go builds with `CGO_ENABLED=0`; the `go` line of `go.mod` picks the toolchain. Rust builds with `cargo zigbuild --release` for Amazon Linux 2023.
- Both run on Lambda’s `provided.al2023` runtime on arm64, and their module and target caches are kept between builds.

## Choosing the preset yourself

Detection is automatic. To override it, set the preset under Settings → Build, with `forkrail project NAME --framework SLUG` (Vercel’s names: `flask`, `django`, `express`, `hono`, `go`, `rust`, `vite` and so on), or with `framework` in `vercel.json`, which wins.
