Skip to main content

Databases

Most apps need to remember things: signups, orders, posts, user accounts. Berrybell can give your app a real database and backend so it can store and retrieve data.

Adding a database​

Just ask in the chat:

Add a database to store contact form submissions, with name, email, and message.

Berrybell sets up the backend, creates the right structure for your data, and connects your app to it. From then on, the feature works end to end — a visitor submits the form, and the data is saved.

The Berrybell Cloud card​

If your request needs saved data and the project doesn't have a database yet, the AI stops before it starts building and shows a Berrybell Cloud card in the chat with two choices:

  • Enable Berrybell Cloud — Berrybell sets the database up, waits until it's ready, and then runs your original request against it. The card waits about 90 seconds; if the database isn't ready by then, it shows "Timed out waiting for the database to provision." and keeps your request on the card until you choose again. Closing the card or switching chats drops the request, so send it again.
  • Not now — it builds the feature straight away using in-browser storage, which lives on that one device only. It won't ask again for that request. You can still turn the database on later under Cloud → Database.
Enabling a database uses your plan

A database runs real cloud resources, so turning one on draws on your workspace's hosting budget — a workspace without one is asked to upgrade first. See Usage & costs.

What a backend gives your app​

Beyond storing records, a database-backed app can include:

  • Data storage — tables for the things your app tracks.
  • User accounts — sign-up and sign-in, so people have their own data. This one is a paid capability.
  • Custom logic — server-side behavior for things that shouldn't run in the browser.
  • File storage — turning Berrybell Cloud on also gives the project private storage for uploads like images and documents. Your app can use it from its next publish. You can see its status under Cloud → Storage, but you can't browse the files from the Studio.

Ask for these the same way. For uploads, say that the files go in the project's file storage — the AI isn't told about it otherwise. See Asking for uploads.

Sign-in has to be switched on before the AI can use it. Projects from a template that comes with sign-in have it switched on when they're created (on a paid plan), so there's nothing to do. On any other project, a workspace Admin turns it on in Cloud → Auth. The AI can't do that for you, and while it's off the AI won't build a login of its own: ask for sign-in and it asks you to turn it on there. Once it's on, ask ("let users sign in with email and password") and the AI adds sign-in to your app, or press Add sign-in to my app in Cloud → Auth.

See Sign-in for your app's users.

Working with your data​

As you build, you can ask the AI to:

  • Add or change fields ("add a status field to orders").
  • Show and filter data ("list the newest signups first").
  • Connect data across features ("link each order to the customer who placed it").

When the AI changes the structure of your data, it's set up to save the change as a numbered migration file under migrations/ in your project's code. Applying one falls under the Modify database permission, so by default it asks first. That's the rule it follows, not something Berrybell enforces. Renaming or removing a field may take two steps, so your published app keeps working while it changes. A change made in another environment, such as staging, doesn't reach production until it's applied there, and publishing doesn't do that for you. See Schema changes and migration files.

You can also work with the database directly in the project: browse its data and schema, run SQL, take and restore backups, and, on a Business plan, give other environments such as staging their own copy. See Your project database and Environments.

Good practices​

  • Describe the shape of your data up front — the fields you need and how they relate. It's easier to start close to right than to restructure later.
  • Review data-changing steps. Actions that modify your data may ask for approval before running — a good moment to confirm the change is what you intended.
  • Take a backup before a big change. Restoring a snapshot is much easier than reconstructing rows by hand. Backups are always of production, whichever environment is selected — an environment has none of its own. See Backups.

Next steps​