Structure your database to drive your app’s functionality

Softr
/
May 18, 2025
/
00:12:11

In this lesson, we're going to be talking about how to set up your database, what a database is, the important terminology you'll need to know, and how Softr connects to that database.

First, when you click on a block in Softr, specifically a dynamic block, it exposes the data it is connected to through the source tab. You can use many different data sources with Softr, and you can even use different data sources for different blocks on the same page.

For example, I could use an Airtable data source for one block, and for my orders block, I could use Google Sheets or HubSpot. You can bring multiple data sources together within your application.

[.blog-callout]
While Softr integrates with 17+ external data sources, Softr Databases is the powerful, native way to manage data directly within Softr for maximum performance.
[.blog-callout]

We organize our data using tables, and within those tables, we have what we call fields. In this example, we have our users table, which is essential to every single application.

The users table normally contains the email for all users, as that is the unique property used in Softr to map users to your application. Within the table, you can inspect each field and choose from various field types.

Formatting the data type tells the database what it's expecting to receive. For instance, an email field formats the data as an email, while a name field is usually formatted as single line text.

For roles, we use a single select field, meaning a user can only belong to one group at a time, such as a warehouse manager or a sales manager. If you wanted them to belong to multiple groups, you could use a multi-select field instead.

There are several ways to handle user group enrollment within Softr. You can manually add users to groups, or you can use fields on the user table to dynamically enroll or exit users in an automated way using Softr's powerful user group system.

[.blog-callout]
Instead of setting up these groups and permissions manually, you can use the AI co-builder to generate your initial app templates and user logic just by describing your needs.
[.blog-callout]

We also use attachment fields for profile avatars to show images in Softr. Another important concept is the linked field, which creates a relationship between two different tables.

In our case, linking sales managers to their orders allows us to visualize revenue data in Softr graphs. For example, we can see that Olivia Brown is responsible for a specific sales order value because the tables are connected.

Linked fields allow you to build one table and relate it to others without duplicating data. This ensures your information stays updated across several different areas from one central source of truth.

Beyond the users table, we have a products table to manage all of our inventory. This table stores product names, selling prices, purchase costs, and long text descriptions for product details.

We also use lookup fields to pull data from other tables to show key metrics like units available. This pulls from quantities of purchase orders and sales orders to show real-time inventory levels.

[.blog-callout]
If you are building a tool for project management or inventory, Softr Workflows can help you automate your status changes and data updates natively without needing external tools.
[.blog-callout]

For sales orders, we have a specific table for the orders and another for sales order items. This structure accommodates cases where one sale includes multiple different parts or products.

Finally, we have purchase orders for buying more inventory from suppliers. We use a status field, which is a single select, to track if an order is a draft, submitted, or received.

By structuring your database this way, you can create a dynamic inventory page where users can view products and create new orders easily. This core structure is what drives the functionality of your entire Softr app.