Skip to main content

Understanding data in Gainable

When you describe data in your prompts, Gainable creates data models - structured definitions of what information your app stores. Think of a data model as a template for each type of thing you’re tracking.

What is a data model?

A data model defines:
  • What fields each item has (name, email, status, etc.)
  • What type each field is (text, number, date, etc.)
  • How items relate to other items (belongs to, has many)
When you say “track deals with name, amount, and status”, Gainable creates a Deal model:
FieldTypeDescription
nameTextThe deal name
amountNumberThe deal value
statusOptionsSelected from predefined choices
createdAtDateAutomatically added
updatedAtDateAutomatically added

Field types

When describing your data, you can specify field types to get exactly what you need:

Text fields

For names, descriptions, and other text content.
Prompt: "title (text)" or just "title"
Stores: Any text content
Example: "Enterprise License Renewal"

Number fields

For quantities, amounts, and measurements.
Prompt: "quantity (number)" or "amount"
Stores: Numeric values
Example: 42, 3.14, 1000000

Currency fields

For money values with proper formatting.
Prompt: "price (currency)" or "amount in dollars"
Stores: Numeric value
Displays: $1,234.56

Date fields

For dates and timestamps.
Prompt: "due date" or "created date"
Stores: Date and time
Displays: Formatted date

Option fields (Enums)

For selecting from a predefined list.
Prompt: "status (new, in progress, done)"
Stores: One of the specified options
Displays: Dropdown or badges

Yes/No fields (Boolean)

For true/false values.
Prompt: "is active (yes/no)" or "completed (checkbox)"
Stores: True or false
Displays: Checkbox or toggle

Reference fields

For linking to other data models.
Prompt: "assigned to (user)" or "belongs to company"
Stores: Link to another item
Displays: Name or selector

Relationships between data

One-to-Many

One item has multiple related items.
"Each project has many tasks"
"Tasks belong to a project"
This creates:
  • Project model (parent)
  • Task model with a “project” field linking to Project

Many-to-One

Multiple items link to one item.
"Contacts belong to a company"
"Deals are linked to a contact"

Self-referential

Items that reference the same type.
"Each employee has a manager (another employee)"
"Tasks can have subtasks"

Automatic fields

Every data model automatically includes:
FieldPurpose
_idUnique identifier for each item
createdAtWhen the item was created
updatedAtWhen the item was last modified
You don’t need to ask for these - they’re always there.

Best practices

Be explicit about fields

Build a contact manager with:
- Full name
- Email address
- Phone number
- Company
- Job title
- Notes

Specify options for status fields

Status options: draft, pending, approved, rejected

Name relationships clearly

Each task belongs to one project
Each project has many tasks
Tasks can be assigned to one user

Use meaningful field names

closeDate, expectedRevenue, primaryContact

Viewing your data

Once your app is built, you can:
  • See all items in list views
  • Add new items through forms
  • Edit items by clicking on them
  • Delete items with confirmation
  • Filter and search to find specific items

Data persistence

All data in Gainable apps is:
  • Automatically saved when you create or edit items
  • Persistent across sessions and users
  • Backed up regularly
  • Accessible via API endpoints
You don’t need to worry about “saving” - data is stored as soon as you submit a form or complete an action.

Learn more