Database Schema Designer: Design Your Data Model Visually
Use GenMB's visual Schema Designer to create data models, define relationships, and generate backend code — no SQL required.
Ambuj Agrawal
Founder & CEO
What Is the Schema Designer?
The Schema Designer is a visual tool inside GenMB that lets you define your application's data model without writing SQL or database migration code. You create collections, add fields with types, define relationships between entities, and GenMB uses this schema to generate backend code that matches your data architecture exactly.
Instead of describing your database structure in natural language and hoping the AI interprets it correctly, the Schema Designer gives you a structured, visual interface where every table, field, and relationship is explicit. The result is more accurate code generation, especially for data-heavy applications.
Creating Your First Schema
Getting started with the Schema Designer takes just a few steps.
Step 1: Open the Schema Panel
In the app editor, click the Schema button in the sidebar. This opens the Schema Designer where you can see all your collections and their relationships.
Step 2: Add a Collection
Click Add Collection and give it a name — for example, products. This creates a new entity in your data model. The designer automatically adds an id field as the primary key.
Step 3: Define Fields
Click on your collection to add fields. For each field, you specify:
- Name: The field identifier (e.g.,
title,price,created_at) - Type: The data type (see below)
- Required: Whether the field must have a value
- Default: An optional default value
Step 4: Add More Collections
Repeat the process for each entity in your application. A typical e-commerce app might have products, orders, customers, and order_items.
Field Types
The Schema Designer supports a comprehensive set of field types that cover most application needs:
| Type | Description | Example |
|---|---|---|
| Text | String values | Product name, email, description |
| Number | Integer or decimal | Price, quantity, age |
| Boolean | True/false | Is active, is published, has discount |
| Date | Date and timestamp | Created at, due date, birthday |
| Validated email string | User email, contact email | |
| URL | Validated URL string | Website, image URL, profile link |
| Select | Enum / predefined options | Status (active/inactive), category |
| Relation | Foreign key reference | Product belongs to category |
| JSON | Flexible structured data | Metadata, settings, preferences |
Choose the most specific type available. Using Email instead of Text for email fields gives the AI better context for validation and UI generation.
Defining Relationships
Relationships connect your collections and are essential for generating proper data fetching and display logic.
One-to-Many
The most common relationship. One record in Collection A can have many related records in Collection B.
Example: One category has many products.
To set this up, add a Relation field to the "many" side (products) and point it at the "one" side (categories). The designer creates the foreign key reference automatically.
Many-to-Many
When records on both sides can relate to multiple records on the other side.
Example: products can have many tags, and tags can apply to many products.
For many-to-many relationships, the designer creates a junction collection automatically — in this case, product_tags — with foreign keys to both sides.
One-to-One
A direct link between two collections where each record on one side corresponds to exactly one record on the other.
Example: Each user has one profile.
Set this up by adding a Relation field and marking it as unique.
Generating Backend Code from Your Schema
Once your schema is complete, the AI uses it during code generation and refinement. Here is what happens:
During Generation
When you generate a new app with a schema defined, GenMB includes the full schema context in its prompt to the AI. The generated code includes:
- Data models matching your collections and field types
- CRUD operations for each collection
- Proper form inputs with validation matching field types
- List views with appropriate column rendering
- Detail views showing related records
During Refinement
When you refine an existing app, the AI references your schema to ensure changes remain consistent with your data model. If you ask "add a product listing page," the AI knows exactly which fields to display because they are defined in your schema.
Example Prompt with Schema
With a products schema already defined (fields: title, description, price, category, image_url, in_stock), your prompt can be simple:
"Create a product catalog with grid view, search, category filtering, and a detail page for each product"
The AI generates code that uses every field from your schema — no need to describe the data model in your prompt.
Schema Subscriptions (Pro)
Pro users get access to schema subscriptions, which enable real-time updates in your generated app. When data changes in your database, the UI updates automatically without manual refresh.
This is particularly useful for:
- Dashboards that need live data
- Collaborative apps where multiple users edit the same data
- Activity feeds and notification panels
Tips for Effective Schemas
Start with Your Core Entities
Identify the 3-5 most important collections in your application before adding secondary ones. For a blog platform, start with posts, authors, and comments before adding tags, likes, or bookmarks.
Use Descriptive Field Names
Name fields clearly. Use created_at instead of date, is_published instead of status, and author_name instead of name when the context might be ambiguous.
Define Relationships Early
Add relationships before generating code. The AI produces much better data fetching patterns when it knows how collections connect from the start.
Keep Schemas Focused
You do not need to model every possible field upfront. Start with the essential fields and add more as your application evolves. The Schema Designer supports iterative updates.
Use Select Types for Status Fields
Instead of using a Text field for values like "active", "pending", "completed", use a Select field with predefined options. This gives the AI context to generate dropdown selects and proper filtering in the UI.
Summary
The Schema Designer transforms database design from an afterthought into a first-class step in your development process. By defining collections, fields, types, and relationships visually, you give the AI precise context that produces more accurate, data-aware code. Start with core entities, define relationships early, use specific field types, and let GenMB generate the backend code that matches your data model exactly.
Frequently Asked Questions
Do I need to know SQL to use the Schema Designer?▼
Can I update my schema after generating code?▼
What relationship types are supported?▼
What are schema subscriptions?▼
Ambuj Agrawal
Founder & CEO
Award-winning AI author and speaker. Building the future of app development at GenMB.
Follow on LinkedIn