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)
Example: Deal model
Example: Deal model
When you say “track deals with name, amount, and status”, Gainable creates a Deal model:
| Field | Type | Description |
|---|---|---|
| name | Text | The deal name |
| amount | Number | The deal value |
| status | Options | Selected from predefined choices |
| createdAt | Date | Automatically added |
| updatedAt | Date | Automatically 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.Number fields
For quantities, amounts, and measurements.Currency fields
For money values with proper formatting.Date fields
For dates and timestamps.Option fields (Enums)
For selecting from a predefined list.Yes/No fields (Boolean)
For true/false values.Reference fields
For linking to other data models.Relationships between data
One-to-Many
One item has multiple related items.- Project model (parent)
- Task model with a “project” field linking to Project
Many-to-One
Multiple items link to one item.Self-referential
Items that reference the same type.Automatic fields
Every data model automatically includes:| Field | Purpose |
|---|---|
_id | Unique identifier for each item |
createdAt | When the item was created |
updatedAt | When the item was last modified |
Best practices
Be explicit about fields
Specify options for status fields
Name relationships clearly
Use meaningful field names
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.