Skip to content

Functions & secrets

Some things can’t (or shouldn’t) happen in the visitor’s browser: sending emails, talking to third-party APIs with secret keys, processing data on a schedule. That’s what Functions are for — small pieces of server-side code that run in your Dedicated Cloud.

The left rail lists your functions with a status dot (green = live, gray = draft). Select one — or click New function — to open the editor.

  • Name it (lowercase letters, digits, dashes — e.g. send-welcome-email).
  • Functions are TypeScript and can span multiple files — tabs across the top, index.ts is the entry point, Add File for more.
  • Don’t write code? Use the Ask AI to write a function bar: describe the job (“send a welcome email when a user signs up”) and it generates the code.
  • Deploy (top-right) pushes the function live.
  • The Invoke card shows the one-liner your site uses to call it.
  • Recent invocations at the bottom shows the function’s logs — every run with its timestamp and output — with a Refresh button. Your first stop when a function isn’t doing what you expect.

Functions often need API keys — for an email service, a payment provider, an external API. Never paste keys into code; store them in the Secrets tab:

  • Add name/value pairs (names auto-uppercase, e.g. RESEND_API_KEY) and Save secrets.
  • Values are encrypted and never shown again after saving — the list displays masked values only. To change one, save a new value under the same name; to remove it, delete it.

Inside a function, a secret is read by name — the Functions editor’s Secrets card shows the exact snippet and how many secrets you have defined.