Skip to main content

Data Modeling

Learn how to model data for ComposeDB.

Overview


Models and composites are the core building blocks for ComposeDB apps.

Models

A model is the GraphQL schema for a single piece of data (e.g. social post) including its relations to other models and accounts. Models are designed to be plug-and-play so they can easily be reused by developers; when multiple apps use the same model, they share the same underlying data set. To be usable in your ComposeDB app, you need to bundle one or more models into a composite.

# Example Model that stores a display name

type DisplayName @createModel(accountRelation: SINGLE, description: "Display name for a user") {
displayName: String! @string(minLength: 3, maxLength: 50)
}

Composites

A composite is a group of one or more models that defines the complete graph data schema for your app. Composites are used on both the ComposeDB server and the client.

Getting Started