---
title: "Functions: server code, triggers and cron | Backenly Docs"
description: Functions run server code that keeps secret keys out of the browser, triggered by sign-ups, table changes, schedules or HTTP calls, with a log of every run.
url: https://backenly.com/docs/functions
markdown_url: https://backenly.com/docs/functions.md
updated: 2026-10-12
---

# Functions

Functions run your own code on Backenly’s servers instead of in the user’s browser. A function runs when something happens: a user signs up, a row changes, a schedule comes round, or your app calls its HTTP endpoint.

In the console: Build › Functions · Build · Updated October 12, 2026

## Why you need it

Some work cannot run in the browser. A Stripe secret key or an email API key would be visible to anyone who opens the developer tools, and a browser tab cannot run a job at 3 a.m. or react when another user changes a row. Functions are where that code goes. It runs on the server, reads secrets your app never sees, and starts on its own when its trigger fires.

For example:

- Send a welcome email when a user signs up.
- When an order is inserted, charge the card and record the payment.
- Every night, delete carts that were abandoned more than 30 days ago.
- Check a coupon code against rules your frontend should not be able to read.

## How it works

1. **Your agent writes the function.** From a description, or from your own source code. A function whose code does not compile and load is never saved.
2. **You choose what starts it.** A user signing up; an insert, update or delete on a table (captured inside the database, so it fires no matter which door wrote the row, within about a minute); a schedule (every 15 minutes, or a 5-field cron expression); an HTTP request to `/api/v1/{projectId}/fn/{name}`; or only when you run it by hand.
3. **It runs on the server.** It can read encrypted environment variables you set for the project, so secret keys never reach the browser.
4. **Every run is logged.** The console shows each run with its result, duration, log lines and error, including the check Backenly runs when an HTTP function is created. You can test-run a function from the console before relying on it.

## Try it

Ask your agent:

```text
When a user signs up, send them a welcome email through Resend.
```

```text
Every night at 2:00, delete carts older than 30 days that never became orders.
```

## Good to know

- Runs are counted per month, and the allowance depends on your plan. See [Pricing](https://backenly.com/pricing).
- Turning a function off stops its trigger without deleting it. Deleting one from your agent waits for a person to approve it.
- There are no SQL functions (`rpc()`). Logic that would live in a stored procedure runs here instead.

Previous: [Storage](https://backenly.com/docs/storage.md) · Next: [Realtime](https://backenly.com/docs/realtime.md)

---

Source: [Functions: server code, triggers and cron | Backenly Docs](https://backenly.com/docs/functions). Every page in Markdown: https://backenly.com/index.md. Agent docs: https://backenly.com/llms.txt.
