Backends

What a backend is

A backend is a small piece of code that runs when someone calls yoursite/_api/…. Think contact form, API proxy, webhook receiver. Not a whole app.

It answers on your site’s own address: a site at you.upubli.sh/contact gets its backend at you.upubli.sh/contact/_api/, and a site on your own domain works the same way. There’s still no server for you to run.

Backends come as an add-on to the Pro and Max plans, and pricing has the details.

Add one

You don’t write a config file or deploy anything by hand. Ask:

Add a backend to my contact page that sends each message to my Discord.

Your agent bundles the code on your machine, checks it, and ships it in one call. Secrets go in separately and never come back out, not even to you.

The plugin ships a contact-form starter that already does the fiddly parts: it checks the input, stops bots with a Turnstile check, and posts each message to a Slack or Discord webhook. Your page posts the form to the backend from the site itself.

Add a backend to my contact site using the upublish contact-form template.

First time? Your agent turns the add-on on for you. It shows you the price and waits for a clear yes before anything is charged. Prefer clicking? Pick the address on your dashboard home and open Backend.

Secrets

API keys and webhook URLs belong in secrets, never in the page or the code. Paste the value into your own message:

Set the secret CONTACT_WEBHOOK_URL on my contact site to https://discord.com/api/webhooks/…

The contact-form template also checks a Cloudflare Turnstile token, so it needs TURNSTILE_SECRET set the same way. Your agent will ask for it.

It’s sent once and never shown again, so when you ask for the list later, all you get back is the names:

List the secrets on my contact site.

Secrets survive every redeploy and take effect on the next request. To drop one:

Delete the secret CONTACT_WEBHOOK_URL from my contact site.

Logs

Anything your backend writes with console.log shows up in its logs, along with how each request ended.

Show the last backend logs for my contact site.

You get the last 100 lines. They can lag a minute behind the request, so ask again if the newest one isn’t there yet.

Versions and rollback

Every deploy goes live at once as a new version, which makes a bad one easy to undo:

Roll my contact backend back to version 1.

Besides the live one, the 10 newest earlier versions are kept.

To take it offline for a while without deleting anything, turn it off and switch it back on whenever you’re ready:

Turn off the backend on my contact site.
Turn the backend on my contact site on again.

Deleting is different. The code, every version and every secret go for good, which is why your agent has to name the site again before it removes anything.

Limits

Five backends per address. Each call gets 50 ms of CPU on Pro, 100 ms on Max. That’s plenty for a form, and nowhere near enough for a crypto miner, on purpose. Backends answer with JSON, text or images, never HTML. Your pages stay pages.

The bundled code must stay under 1 MB. npm packages are fine. Node built-ins such as node:fs aren’t there, so your agent writes to the web APIs instead: fetch, Request, Response and crypto.subtle.

Cost and turning it off

Wait, I thought there was no server?

There still isn’t one you run. A backend is a few lines of code we run at the edge next to your site. You don’t patch it, scale it or wake up for it.

What does the Backend add-on cost?

$3/month or $30/year on top of Pro or Max, and it covers every address on your account. It includes Site data. It’s billed with your plan, monthly or yearly to match, starting with a prorated charge today. Already paying for Site data? Backend replaces it: you’re charged the prorated difference today and keep your rows. If your last payment failed, update your card under Manage billing first; until then the add-on can’t be added.

What happens if I turn it off?

Your backends stop right away, on every address, and we keep their code for 30 days. Your agent asks you one thing first: keep Site data or end both. Keep it (the default) and Site data stays on with every row, billed at the Site data price from your next invoice. End both and Site data’s rows are deleted after 30 days. If Site data can’t be kept at that moment, nothing changes and your agent asks again before ending both. No refund for the unused part of the current period.

Turn off the Backend add-on.

Turn it back on within those 30 days and your backends return as they were, secrets included.