---
title: Adding backend functionality
description: Learn how to use B12's Backends feature to securely store secrets and run backend logic with edge functions.
---

[Skip to content](https://support.b12.io/en/v3/adding-backend-functionality#main-content)

![b12 logo](https://support.b12.io/hubfs/b12%20logo.svg)

- [Help Center](https://support.b12.io/)
- [B12 Website](https://www.b12.io/)
- [AI Website Prompts](https://www.b12.io/ai-website-prompt-gallery)
- [Resources](https://www.b12.io/resource-center/)
- [Pricing](https://www.b12.io/pricing/)
- [Log in](https://b12.io/dashboard/)

Open main navigation

Close main navigation

- [Help Center](https://support.b12.io/)
- [B12 Website](https://www.b12.io/)
- [AI Website Prompts](https://www.b12.io/ai-website-prompt-gallery)
- [Resources](https://www.b12.io/resource-center/)
- [Pricing](https://www.b12.io/pricing/)
- [Log in](https://b12.io/dashboard/)
- [Start for free](https://b12.io/signup/)

[Start for free](https://b12.io/signup/)

 How can we help?

- There are no suggestions because the search field is empty.

1. [B12 Help Center](https://support.b12.io/en?hsLang=en)
2. [Built-in features](https://support.b12.io/en/built-in-features?hsLang=en)
3. [Data & users (Backends)](https://support.b12.io/en/built-in-features?hsLang=en#data-users-backends)

# Adding backend functionality

## Learn how to add backend functions like data & users to your B12 website.

| ![ronnel](https://support.b12.io/hs-fs/hubfs/Ronnel%20DG.png?width=60&height=60&name=Ronnel%20DG.png) Written by: Ronnel DG Last updated: 02 Jul., 2026 |
| --- |

Simple websites use frontend code to display content in a visitor's browser. For more complex websites and web applications, you may need to store data, authenticate user identities, or run additional server-side logic that doesn't happen in the browser.

EnablingBackends adds backend support to your B12 site, powered by [Supabase](https://supabase.com/). This lets you build websites with databases, user authentication, secrets, edge functions, real-time features, and more.

### Enabling Backends with the AI Agent

The AI Agent can detect when a feature you're asking for requires backend support. When it does, it shows an inline card in the chat with `Enable` and `Decline` buttons.

1. Ask the AI Agent for something that requires a backend.
   
    
2. When the Agent detects that your request requires backend support, it shows a Backends card directly in the chat.
3. Click `Enable`. Backends will be set up automatically, and the Agent immediately continues building your feature.

**Sample prompt:**

> Add a login page that lets users sign up with their email and password.

### Building with the AI Agent

Once Backends is enabled, the AI Agent can manage your Supabase backend directly and write both the frontend and backend code needed to bring a feature to life. You describe what you want in plain language, and the Agent handles the technical implementation.

Here's what the Agent can build for you:

- **User accounts and login:** Set up email and password sign-up, email verification, password reset flows, and members-only pages that redirect unauthenticated visitors.
- **Database management:** Create and manage database tables, define relationships between them, and set access rules so users only see data they're allowed to see.
- **Third-party API connections:** Connect external services via edge functions. Store your API keys securely as Secrets, and the Agent will reference them in the code it writes.
- **Real-time features:** Build pages that update automatically when new data comes in, without requiring a page refresh.

**Example prompts to try:**

```
Add a login page with email and password sign-up, and send a confirmation email when someone registers.
```

```
Add a chatbot that uses my OpenAI API key to answer questions about my business.
```

**Tip:** Describe the outcome you want rather than the technical steps. "Let users log in with Google" works better than "implement OAuth."

### Secrets and edge functions

Secrets and edge functions work together to keep sensitive information secure while allowing your website to communicate with external services.

#### Secrets

Secrets are a secure place to store sensitive information your website needs (like API keys) without exposing that information in your code. When you save a secret, it's encrypted and stored securely. Your edge functions can access it by referencing its name rather than its actual value.

**Example:** Instead of writing openai\_key = "sk-abc123..." directly in your code — where anyone with access could see it — you store that value as a secret and reference it as process.env.OPENAI\_KEY.

**Note:** Secrets are only accessible by your edge functions. They can't be read by visitors to your website.

#### Edge functions

Edge functions run code on your backend to keep secrets secure and handle tasks that can't be completed in the browser. An edge function may respond to a specific trigger ( like a form submission or an incoming request from another service) and can help you incorporate third-party tools into your workflows

**Tip:** Edge functions can access your saved secrets, so you can safely call external services without exposing sensitive credentials in your code.

Common uses for secrets and edge functions together include:

- Calling third-party APIs, such as sending transactional emails or processing payments
- Receiving data from external services (also called webhooks)
- Validating or transforming data before it's saved

**Example:** When a customer places an order through your website, an edge function can automatically send them a confirmation email in the background using your email provider's API key stored as a secret.

**Caution:** Deleting a secret or edge function that is currently in use will break the features that depend on it.

### Enabling Backends manually

1. In the left sidebar, click `Backends`.
2. Click `Enable Backends`.
3. Wait 1–2 minutes while the feature is set up. A new settings panel will appear when it's ready. Once enabled, you'll see two sections in the panel: **Secrets** and **Edge Functions**.

- [Getting started](https://support.b12.io/en/getting-started?hsLang=en#main-content)

    - [Introduction](https://support.b12.io/en/getting-started?hsLang=en#introduction)
    - [Detailed guides](https://support.b12.io/en/getting-started?hsLang=en#detailed-guides)
- [Working with B12's AI Agent](https://support.b12.io/en/working-with-b12s-ai-agent?hsLang=en#main-content)

    - [Agent Skills](https://support.b12.io/en/working-with-b12s-ai-agent?hsLang=en#agent-skills)
- [Built-in features](https://support.b12.io/en/built-in-features?hsLang=en#main-content)

    - [Visual edit](https://support.b12.io/en/built-in-features?hsLang=en#visual-edit)
    - [Code editor](https://support.b12.io/en/built-in-features?hsLang=en#code-editor)
    - [Data & users (Backends)](https://support.b12.io/en/built-in-features?hsLang=en#data-users-backends)
    - [Forms & submissions](https://support.b12.io/en/built-in-features?hsLang=en#forms-submissions)
    - [Commerce](https://support.b12.io/en/built-in-features?hsLang=en#commerce)
    - [Contact manager](https://support.b12.io/en/built-in-features?hsLang=en#contact-manager)
    - [eSignatures](https://support.b12.io/en/built-in-features?hsLang=en#esignatures)
    - [Email Marketing](https://support.b12.io/en/built-in-features?hsLang=en#email-marketing)
    - [Team](https://support.b12.io/en/built-in-features?hsLang=en#team)
    - [Analytics](https://support.b12.io/en/built-in-features?hsLang=en#analytics)
    - [Website settings](https://support.b12.io/en/built-in-features?hsLang=en#website-settings)
- [Adding functionality](https://support.b12.io/en/adding-functionality?hsLang=en#main-content)

    - [Third-party integrations](https://support.b12.io/en/adding-functionality?hsLang=en#third-party-integrations)
- [Publishing & growing](https://support.b12.io/en/publishing-growing?hsLang=en#main-content)

    - [Domains](https://support.b12.io/en/publishing-growing?hsLang=en#domains)
    - [Connecting your Domain](https://support.b12.io/en/publishing-growing?hsLang=en#connecting-your-domain)
    - [Managing Your Domain](https://support.b12.io/en/publishing-growing?hsLang=en#managing-your-domain)
    - [Email Forwarding & Sending](https://support.b12.io/en/publishing-growing?hsLang=en#email-forwarding-sending)
    - [Growth & Marketing](https://support.b12.io/en/publishing-growing?hsLang=en#growth-marketing)
- [Troubleshooting](https://support.b12.io/en/troubleshooting?hsLang=en#main-content)

    - [FAQs](https://support.b12.io/en/troubleshooting?hsLang=en#faqs)
- [Account & billing](https://support.b12.io/en/account-billing?hsLang=en#main-content)

    - [Account Login & Password](https://support.b12.io/en/account-billing?hsLang=en#account-login-password)
    - [Subscription & Payment Information](https://support.b12.io/en/account-billing?hsLang=en#subscription-payment-information)
    - [Your Account](https://support.b12.io/en/account-billing?hsLang=en#your-account)
    - [Managing Multiple Websites](https://support.b12.io/en/account-billing?hsLang=en#managing-multiple-websites)
    - [Multi-user](https://support.b12.io/en/account-billing?hsLang=en#multi-user)
- [Getting support](https://support.b12.io/en/getting-support?hsLang=en#main-content)

    - [Professional & Advanced Plan Support (B12 2.0)](https://support.b12.io/en/getting-support?hsLang=en#professional-advanced-plan-support-b12-2-0)
- [B12 2.0](https://support.b12.io/en/b12-2-0?hsLang=en#main-content)

    - [Website Structure and Content](https://support.b12.io/en/b12-2-0?hsLang=en#website-structure-and-content)
    - [Website Style & Design](https://support.b12.io/en/b12-2-0?hsLang=en#website-style-design)
    - [Sitewide Settings](https://support.b12.io/en/b12-2-0?hsLang=en#sitewide-settings)
    - [Using the B12 Editor](https://support.b12.io/en/b12-2-0?hsLang=en#using-the-b12-editor)
    - [Analytics & SEO](https://support.b12.io/en/b12-2-0?hsLang=en#analytics-seo)
    - [Integrations - General](https://support.b12.io/en/b12-2-0?hsLang=en#integrations-general)
    - [Integrations - Communication](https://support.b12.io/en/b12-2-0?hsLang=en#integrations-communication)
    - [Integrations - Language](https://support.b12.io/en/b12-2-0?hsLang=en#integrations-language)
    - [Integrations - Ecommerce](https://support.b12.io/en/b12-2-0?hsLang=en#integrations-ecommerce)
    - [Professional & Advanced Plan Features](https://support.b12.io/en/b12-2-0?hsLang=en#professional-advanced-plan-features)
    - [Troubleshooting & Resources](https://support.b12.io/en/b12-2-0?hsLang=en#troubleshooting-resources)
    - [Contact Forms](https://support.b12.io/en/b12-2-0?hsLang=en#contact-forms)
    - [Online Scheduling](https://support.b12.io/en/b12-2-0?hsLang=en#online-scheduling)
    - [Advanced Editing (Experts Only)](https://support.b12.io/en/b12-2-0?hsLang=en#advanced-editing-experts-only)

[![B12\_logo\_2025](https://support.b12.io/hs-fs/hubfs/B12_logo_2025.png?width=53&height=24&name=B12_logo_2025.png "B12_logo_2025")](https://www.b12.io)

© 2025 B12. All rights reserved.

<https://twitter.com/b12> <https://www.facebook.com/B12io> <https://www.youtube.com/@b12io> <https://www.instagram.com/b12io>

×