Quickstart
Deploy your first Amba function in under a minute. Amba runtime modules, no wrappers.
A function in 15 lines of code.
1. Write the function
functions/hello.ts:
The default export is the Amba runtime module shape ({ async fetch(req, env, ctx) }). The runtime injects env bindings at deploy time — see Runtime for the full list. There is no @layers/amba-* import; the bundle stays self-contained.
2. Deploy
Output (silent-until-done):
amba functions deploy bundles with esbuild (--bundle --format=esm --platform=browser --target=es2022), checks the size against the 8 MB cap, POSTs to the admin API, and waits for the runtime to acknowledge.
3. Call it
Authenticated calls go through the edge router which signs X-Amba-User-Id for you when the request carries a valid X-Api-Key + session token. Anything calling *.fn.amba.host directly without those headers gets anonymous.
4. Call back into Amba
To read a collection, send a push, grant currency, etc., fetch the project-scoped admin API using env.AMBA_INTERNAL_TOKEN. This token is scoped to this project only — it authenticates /v1/admin/projects/${env.AMBA_PROJECT_ID}/* and nothing else. Global admin operations (creating projects, listing developer-owned projects) require a developer PAT instead. See Token reference for the full breakdown.
Full endpoint catalog: /api-reference/admin.
Next
- Runtime contract — every binding, every header, every error code → fix.
- Local dev — iterate on a function without deploying.
- Deploy — the deploy lifecycle, rollback, scheduled invocations.