Tutorial 2: Collections & Data Modeling
Every Buildpad app is backed by a DaaS (Data-as-a-Service) backend — a REST API server that manages your PostgreSQL database through structured collections (tables) and fields (columns). In this tutorial you’ll design the data model for the project management app using your AI assistant’s /create-collection skill.
By the end you’ll have:
- Two collections:
projectsandtasks - The right field types for each — from plain text inputs to date pickers and status dropdowns
- A scaffolded list page and form page for each collection (customized further in Tutorial 3)
- The ability to query your data via the DaaS REST API
Prerequisites
- Completed Tutorial 1: Your First App.
- Your dev server is running (
pnpm dev) and your AI MCP connections are active.
DaaS Core Concepts — A collection maps to a database table. Each field maps to a column and has an interface type that determines how it’s displayed in forms and lists. See the DaaS documentation for a full reference.
Create the projects Collection
In Copilot Chat, type:
/create-collectionDescribe the collection to your agent with the following fields:
| Field | Type | Notes |
|---|---|---|
name | input | Required. Short project title. |
description | textarea | Optional. Longer description. |
status | select-dropdown | Values: planning, active, on_hold, completed, cancelled. Default: planning. |
start_date | datetime | Optional. |
due_date | datetime | Optional. |
Audit fields are mandatory. The /create-collection skill automatically adds four Group A audit fields to every collection via MCP: user_created, date_created, user_updated, date_updated. These are required by the platform — the DaaS backend does not add them automatically.
The skill generates:
- API route handlers in
app/api/items/projects/ - A collection list page and form page under
app/[lang]/content/projects/ - API and page test files in
tests/
- A migration SQL file in
supabase/migrations/(version control reference — no apply step needed) - API route handlers in
app/api/items/projects/ - A collection list page and form page under
app/[lang]/content/projects/ - API and page test files in
tests/
DaaS manages the database schema directly when it registers the collection via MCP — by the time the skill finishes, your collection already exists in your project’s database and is immediately available at:
GET /api/items/projects
POST /api/items/projects
GET /api/items/projects/:id
PATCH /api/items/projects/:id
DELETE /api/items/projects/:idOn a Buildpad Engine project, the skill writes no migration file. There is no supabase/migrations folder and no local Postgres for the app schema. The agent creates the collection in the Engine over MCP. You can also create collections in the Studio (Open Studio on the project’s Details page).
Create the tasks Collection
Run /create-collection again, this time for tasks:
| Field | Type | Notes |
|---|---|---|
title | input | Required. |
description | textarea | Optional. |
status | select-dropdown | Values: todo, in_progress, in_review, done. Default: todo. |
priority | select-radio | Values: low, medium, high. Default: medium. |
due_date | datetime | Optional. |
assigned_to | input | Optional. User ID of the assignee. |
You’ll add the relation that links tasks to projects in Tutorial 6: Relations & Linked Data. For now, keep tasks standalone.
Navigation is not added automatically. The /create-collection skill scaffolds the pages but does not add a nav entry to your sidebar. After both collections are created, add them to NAV_ITEMS in components/layout/navigation.ts, above the buildpad:nav-insert line:
import { IconChecklist, IconFolder, IconHome } from "@tabler/icons-react";
export const NAV_ITEMS: NavItem[] = [
{ label: "Home", labelKey: "app.nav.home", href: "/", icon: IconHome },
{ label: "Projects", href: "/content/projects", icon: IconFolder },
{ label: "Tasks", href: "/content/tasks", icon: IconChecklist },
// buildpad:nav-insert — installed route modules add entries above this line. Do not remove.
];Verify the Schema via the DaaS API
Use your terminal (or any REST client) to confirm both collections exist and have the correct fields.
The <project-id>.daas.<domain> host is the Studio, not the data API, and the MCP token from .vscode/mcp.json is refused on the data API. Send each call to the Engine URL with an access token from a password sign-in. See Calling the Engine API From a Terminal for how to get the token.
# List the collections
curl -H "Authorization: Bearer <access-token>" \
<Engine URL>/api/collectionsYou should see projects and tasks in the response. To inspect fields for a specific collection:
curl -H "Authorization: Bearer <access-token>" \
<Engine URL>/api/fields/tasksTerminal
# Replace with your DaaS URL and token from .vscode/mcp.json
curl -H "Authorization: Bearer <your-token>" \
https://<your-project>.daas.buildpad.ai/api/collectionsYou should see projects and tasks in the response. To inspect fields for a specific collection:
curl -H "Authorization: Bearer <your-token>" \
https://<your-project>.daas.buildpad.ai/api/fields/tasksSeed Some Test Data
Create a few items via the DaaS API to use in the next tutorial:
Send the calls to the Engine URL with the access token from the previous step:
# Create a project
curl -X POST \
-H "Authorization: Bearer <access-token>" \
-H "Content-Type: application/json" \
-d '{"name": "Website Redesign", "status": "planning"}' \
<Engine URL>/api/items/projects
# Create a task
curl -X POST \
-H "Authorization: Bearer <access-token>" \
-H "Content-Type: application/json" \
-d '{"title": "Design homepage mockup", "status": "todo", "priority": "high"}' \
<Engine URL>/api/items/tasksYou can also add the records in the Studio (Open Studio on the project’s Details page).
# Create a project
curl -X POST \
-H "Authorization: Bearer <your-token>" \
-H "Content-Type: application/json" \
-d '{"name": "Website Redesign", "status": "planning"}' \
https://<your-project>.daas.buildpad.ai/api/items/projects
# Create a task
curl -X POST \
-H "Authorization: Bearer <your-token>" \
-H "Content-Type: application/json" \
-d '{"title": "Design homepage mockup", "status": "todo", "priority": "high"}' \
https://<your-project>.daas.buildpad.ai/api/items/tasksBrowse Your Data in the Studio
Open your project’s Studio (Open Studio on the project’s Details page)DaaS Studio and its Content menu. You should see both collections listed with the fields you defined, and the seed records you just created.

Understanding Field Interface Types
The interface type you choose for a field determines how it’s rendered in your UI components. Here’s a quick reference for the types used in this tutorial:
| Interface | Use For | Component Installed |
|---|---|---|
input | Short text, names, IDs | input |
textarea | Long text, descriptions | textarea |
select-dropdown | Single choice from a list | select-dropdown |
select-radio | Single choice, visible all at once | select-radio |
datetime | Dates and times | datetime |
The buildpad-ui component library maps every field interface type to a ready-built React component — you’ll install and use them in the next tutorial.
What’s Next
Your database schema is in place. In the next tutorial you’ll build the actual UI — a task list page and a task detail form — using Buildpad’s pre-built collection components.