Skip to content

Functions

A function is a JavaScript or TypeScript file in a functions/ directory at the root of your project. It exports a handler that takes a Web API Request and returns a Response, the same shape Netlify, Cloudflare and Deno use, so a handler written for one of them usually runs here unchanged. Your next production deploy bundles each file on its own and registers it under the file’s name. There is no framework to add, no configuration file and no separate build step.

Every function has two doors, and the same file answers both. A schedule can start it too.

Call it over HTTPS. Each function gets its own hostname, https://{name}-{subdomain}.fn.deploybase.eu, with a certificate already in place. A request to that hostname runs your handler and returns whatever Response it produced, so a page on your site can fetch() it directly. Instances scale to zero when nobody is calling, unless the function is one of your plan’s always-warm functions. The first request after a quiet spell takes 2 to 5 seconds while an instance starts; the requests after it do not.

Queue it through the API. A POST to https://api.deploybase.eu/api/v1/public/functions/{subdomain}/{name} answers 202 Accepted at once with a URL to poll. The function runs in the background in its own container, and the poll URL returns its status code, headers and body when it has finished. This suits work that does not need to answer inside the request: a webhook that can take a while, a job you fire from a script. The reference describes the request and reply shapes.

Run it on a schedule. Add export const schedule = "0 * * * *" to the file and the next production deploy runs it on that cron, in UTC, through the queued door. The reference has the rules and the plan limits.

A function reads the project’s environment variables marked Runtime through context.env, so an API key stays out of the repository. A change reaches running functions without a redeploy.

Getting started takes you from an empty functions/ directory to a live URL. The reference holds the contract, the limits and the errors.

On Astro you do not write a handler yourself: the deploybase adapter turns the pages and API routes that render on demand into a function at build time.

HTTP functions are included in the Starter, Pro and Scale plans. There is nothing to apply for: a team on one of those plans can deploy a function and call it at its hostname straight away. Access is per team, so every project on the team gets it at once. The Free plan does not include HTTP functions; upgrade from the billing page to get them. Teams that were let into the earlier closed beta by hand keep their access, whatever their plan.

How much memory and concurrency an instance gets follows the plan. The limits table has the numbers.

Functions are still in beta, and requests are not counted while it lasts. When the beta ends they are priced as part of paid plans, with at least 30 days notice by email before anything changes.

Queued calls are not gated by plan. Any team can queue a function today, Free included; only the HTTPS hostname needs a paid plan.

  • Compute: Scaleway Kapsule in Paris, on nodes reserved for functions. Every instance runs under gVisor, a sandbox that keeps one customer’s code away from the host kernel and from other customers, on top of the usual container isolation.
  • Bundles: stored in a private Bunny.net storage zone in Germany. Nothing under functions/ is ever published to your site’s CDN.
  • Logs and queued-call records: Paris. Request bodies and results of queued calls are kept for 7 days.
  • Outbound network: functions can reach the public internet over HTTPS only. Plain HTTP, private networks and the cloud metadata service are blocked.

Our DPA covers personal data your functions process.

These are on the list, none with a date. Watch the changelog.

  • A SvelteKit adapter. Astro has one: on-demand rendering with Astro runs your server routes on a function. For other frameworks a handler is a file you write.
  • Choosing which functions stay warm. Paid plans keep 1 to 5 production functions always running, picked automatically; every other function scales to zero, and the cold start above applies.
  • Logs for HTTPS calls in the dashboard. Queued calls show their output; HTTPS calls do not yet.
  • Usage metering and per-plan request caps. The beta asks for fair use instead.
  • A path on your own domain routed to a function. A function is reachable at its own hostname only.

Something broke, or something here is wrong? Send feedback from the app, or write to support@deploybase.eu.

Live 022265e7 built