Data Model
Overview
The data model is the foundation of your Monospace project. It defines how your data is structured, how it connects, and how users interact with it. Everything in Monospace builds on top of the data model — permissions, APIs, content management, and spaces all reference it.
When you connect a data source, Monospace introspects the database and automatically maps its schema into collections, fields, and relations. You can also create new collections directly from the Studio.
Collections
A collection represents a table or data structure within a data source — for example, customers, orders, or products. Collections are the primary unit you interact with across Monospace:
- Content — browse, create, and edit items
- Permissions — policies grant access at the collection level
- APIs — query collections across multiple data sources in a single call
Fields
Fields are the columns or attributes within a collection (e.g., email, price, created_at). Each field has a data type that defines what it stores:
| Category | Types |
|---|---|
| Text | String, Text, UUID |
| Numeric | Integer, Float, Decimal |
| Boolean | True / False |
| Date & Time | Date, DateTime, Timestamp |
| Structured | JSON, Array |
Monospace detects fields and their types automatically during introspection. Fields can be customized with Interfaces that control how they are displayed and edited in the Studio.
Relations
Relations define how collections are connected — typically through foreign keys in the database. For example, an orders collection might relate to customers through a customer_id field.
Monospace supports:
- Many-to-One (M2O) — many orders belong to one customer
- One-to-Many (O2M) — one customer has many orders
- Many-to-Many (M2M) — many articles have many authors (via a junction table)
- One-to-One (O2O) — one user has one profile
Relations work across data sources, enabling federated queries that join data from different databases without replication.
Interfaces
While a field defines what data is stored, an interface defines how users interact with that data in the Studio. For example, a text field could use a simple input, a textarea, or a slug input. A number field could use a numeric input or a slider.
Monospace automatically assigns a default interface based on each field's data type. You can change the interface for any field in the Data Model settings.
Input Interfaces
Input interfaces control how fields appear in forms when creating or editing items.
| Interface | Field Types | Description |
|---|---|---|
| Input | Text, Identifier | Single-line text input |
| Textarea | Text | Multi-line text input |
| Password | Text | Masked password input |
| Number | Number | Numeric input with min/max |
| Decimal Number | Number | Decimal/float input |
| Slider | Number | Range slider |
| Select | Select | Dropdown menu |
| Radio | Select | Radio button group |
| Tile Radio | Select | Visual tile-based selection |
| Checkbox | Select | Checkbox group (multiple selection) |
| Toggle | Boolean | Toggle switch |
| Color | Color | Color picker |
| Slug | Text | URL-friendly slug input |
| UUID | Identifier | Auto-generated UUID display |
Relational Interfaces
| Interface | Relation Type | Description |
|---|---|---|
| Select (M2O) | Many-to-One | Dropdown to select a related item |
| List (O2M) | One-to-Many | List of related items with add/remove |
| File (M2O) | Many-to-One | Single file picker/upload |
| Files (O2M) | One-to-Many | Multiple file picker/upload |
Field Type Defaults
Each field data type has a default input and display interface:
| Data Type | Default Input | Default Display |
|---|---|---|
| Text | Input | Formatted Value |
| Number | Number | Formatted Value |
| Boolean | Toggle | Boolean |
| Select | Select | Labels |
| Color | Color | Color |
| Relation | Select (M2O) / List (O2M) | Related Values |