When you’re working on your first app for Smart Builder, you may wonder how exactly your app works or how the app saves the data.

Schema objects can help explain how this works.

Schema

A schema is an object composed of functions as property values that help us create our structure.

In other words, a schema is like an object where you can configure the model you want to use in your app, but with Unbounce official syntax.

The complexity of building an app is placed in the schema. For that reason, you must take some time to understand how schemas work in Unbounce.

<aside> 💡 You can find all the available Schema methods on this page: Schema Methods/Types.

</aside>

The following sample code demonstrates how we import the schema and how it looks:

import { Schema } from 'ub-shared';

const schema = Schema.object({
  firstName: Schema.string(),
  lastName: Schema.string(),
  styles: Schema.newStyle({
    textAlign: {
      layoutSpecific: true,
    },
  }),
});

A schema will always start with an object; that you can use to add other properties if you require so.

Think of a schema as a collection of properties where its values are other schema methods or a chain of them.

Data types

As in Javascript, the schema has data types, such as an object, string, number, and boolean.