Code that runs on request.
Write a fetch handler and deploy it. It runs on every request, sleeps when idle, and is billed per request and active CPU time.
Web standards, not a private API
A function is a module with a fetch handler, the standard WinterTC shape. Request, Response, fetch, crypto and streams are the ones you know from the browser, and Node built-ins are available too.
export default {
async fetch(request: Request, env: Env) {
const url = new URL(request.url)
return Response.json({ hello: url.searchParams.get("name") ?? "salam" })
},
}What you get
Runs on request
No server to keep on, no capacity to set. It runs when a request comes in and sleeps when idle.
Cron schedules
Up to 5 cron expressions per function, in any time zone; Tehran by default. Each tick runs at most once.
Secrets
Secrets are stored encrypted and never shown again. They are opened only in the function's memory.
Live logs
console.log, requests and cron runs, live in the terminal or the dashboard.
Observability and alerts
Requests, 4xx and 5xx errors and p50/p95/p99 per route over an hour, a day or a week. Alerts by email, SMS or webhook.
Versions and rollback
Every deploy is an immutable version; going back is one command.
Bound to your data
env.DB for the database, env.CACHE for the cache, env.BUCKET for a bucket. No connection strings or keys in your code.
Outbound fetch
A function can call any public API. Internal network addresses are blocked.
A preview per branch
Pushing a branch gives it a test address of its own, with its own database branch.
Queue consumers
A queue(batch, env) handler takes a queue's messages in batches, with retries and a dead-letter queue for what failed.
Function to function
Call another function or app of the same project with env.AUTH.fetch(). The request never leaves the edge, and a preview reaches only the same branch's preview.
Run new code at runtime
A function runs code it holds as text, such as code an agent just wrote, in child functions of its own. Each child sees only what the function hands it.
Sealed variables
Store an API key as sealed. Your code never sees the value, and the real value is filled in only on requests to the hosts you name, so it cannot be sent anywhere else.
Any language
JavaScript and TypeScript run per request. A function in Python, Go, PHP, Java or another language is built from source and runs on instances.
Builds and security checks
Every push is built on our servers, passes the secret scan and package checks, and runs your tests before production.
Connect your repository
Connect GitHub, GitLab or a self-hosted GitLab. Every push deploys, and its status is written on the commit and the pull request.
Gradual releases
Give the new version a share of traffic first and raise it step by step. If errors pass the threshold, it rolls back by itself. Each visitor stays on one version, and you can pause the automatic steps at any time.
Deployment protection
Preview addresses open only to team members or with a password, with a bypass token for automated tests.
A nightly job, no server
Every day at 3 a.m. Tehran time, old carts are cleared. The database is awake for those few seconds only.
name = "reports"
type = "function"
main = "index.ts"
[[db]]
binding = "DB"
database = "shop"
[triggers]
crons = ["0 3 * * *"]Functions that work together
One function calls another on the same edge and hands slow work to a queue. No address, no key.
name = "api"
type = "function"
main = "index.ts"
[[services]]
binding = "AUTH"
service = "auth"
[[queue]]
binding = "JOBS"
name = "jobs"Per request and active CPU
Each run counts as one request, plus the time your code actually spent on the CPU. Waiting for a database or an outside API does not count. It comes out of the month's credit first.
Questions
JavaScript or TypeScript, as a web-standard module. Python, Go, PHP, Java and other languages are built from source and run on instances.
Most do. Node built-ins are available and the CLI bundles your code with its dependencies. Packages that need native binaries do not run.
On our servers inside Iran. Each customer's code runs in its own process, never next to another customer's.
A function starts in its own process on its first request and stays up while requests arrive. The start time shows in the observability charts as part of that request's latency.
Encrypted under your account's key. Once saved, nobody sees the value again, not even you; only the function reads it while it runs.
Yes. Add a [[services]] binding in cloudhost.toml to another function or app of the same project, and call env.<NAME>.fetch() in your code. The request stays on the same edge, is not billed as outbound transfer, and counts as a request to the target.
Yes. With git push, the API, or your AI tool through the MCP server.
Deploy your first function
One file, one command, one address.
Sign-up is by invite for now. If you have a code, create your account.
Sign up withEmail codeSMS code