Table of Contents

Design Your Database

Danielle Kellogg Updated by Danielle Kellogg

Behind each Knack app is an online database - this stores all the data that your app will use.

The first step in building your app is to define the data is will store and how it will work together. This happens in the Schema section of the Knack Builder.

 

How does Knack organize your data?

In Knack, each piece of data you want to store and manage is called a field, and similar fields are grouped into objects. You can think of an object like a single sheet in a spreadsheet, and each field like a column in that spreadsheet.

For example, a Products object would have fields for name, part number, and product label. An Orders object would have fields for order total, date, and delivery status.

Each field can be a different type, like text, number, or multiple choice. These types define how Knack views your data and how the field is used in your app. For example, a file field is used to upload and download files, while a text field stores and displays simple text.

How does Knack store this data?

Your data defines what is stored in your database and what type of application you can build.

Once your objects are defined you can add records in the Records section of the Builder. For example, here’s what stored records look like for the Products object:

How does Knack use this data?

In the Pages section of the Builder you can build the Live App to display and manage the records stored in your app.

You’ll use the Product fields you added to build forms, tables, and other tools for viewing and managing these customer records.

For example, each Product field is available to add as a column in a table view:

 

Connecting your data together

What really makes an app powerful? It’s the ability to define relationships that connect your data together.

For example, instead of each order record existing in isolation, you can connect it to the product record used in that order. If that same product makes used in a second order, you don’t need to keep adding their product details over and over. You simply connect the second order to the same product record that already exists from the first order.

Each object lists its connections in the right column. When you add a new connection it creates a special field that defines the connection:

Knack makes connections easy. You don’t need to worry about mapping fields or managing keys, you simply look-up the record you want to connect to.

Here’s example of an order form where you look-up the product to connect the order to:

Knack uses connections in a lot of powerful ways. For example, using the connection between customer and orders, you could:

  • Show all of the order records for a specific customer
  • Add up all the order totals for each customer
  • Run reports on each customer’s average order total each month
  • Let each customer login to view their order history

Learn more on whats possible with connections here.

Special Objects

Knack has two special objects that add functionality on top of a normal object, Users and Payments. Both User Accounts and Charges can be used just like regular Objects in your database. They are listed separately to emphasize their special nature.

Users

User Accounts are objects with special email and password fields that are used to manage user logins. You can choose to require logins to access your Live App, and each user record would represent a user account that can log in.

You can create multiple user objects to represent different roles and permissions. For example, you may have Customer users who can log in to one part of your app to view their order history, and Shipping Manager users who log in to another part of your app to view pending orders and ship for delivery.

There are additional security settings available with user logins to help ensure the security of your Live App pages.

User objects behave the same as regular objects, with the exception of being able to be used as logins.

Payments

Payments are objects that include fields for storing E-Commerce transactions like charge total and date. You can choose to add E-Commerce to your app to accept payments. When a credit card is charged, that payment information is stored in a new charge record.

Up next, learn how to manage the records in your in app.

You can find the full documentation on Knack in our Builder Guide, here.

How did we do?

How Knack Works

Do More With Knack

Contact