Skip to Content
TutorialsDeveloper Series2. Collections & Data

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: projects and tasks
  • 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

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-collection

Describe the collection to your agent with the following fields:

FieldTypeNotes
nameinputRequired. Short project title.
descriptiontextareaOptional. Longer description.
statusselect-dropdownValues: planning, active, on_hold, completed, cancelled. Default: planning.
start_datedatetimeOptional.
due_datedatetimeOptional.

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:

  1. API route handlers in app/api/items/projects/
  2. A collection list page and form page under app/[lang]/content/projects/
  3. API and page test files in tests/
  1. A migration SQL file in supabase/migrations/ (version control reference — no apply step needed)
  2. API route handlers in app/api/items/projects/
  3. A collection list page and form page under app/[lang]/content/projects/
  4. 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/:id

On 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:

FieldTypeNotes
titleinputRequired.
descriptiontextareaOptional.
statusselect-dropdownValues: todo, in_progress, in_review, done. Default: todo.
priorityselect-radioValues: low, medium, high. Default: medium.
due_datedatetimeOptional.
assigned_toinputOptional. 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:

components/layout/navigation.ts
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/collections

You 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/tasks
# Replace with your DaaS URL and token from .vscode/mcp.json curl -H "Authorization: Bearer <your-token>" \ https://<your-project>.daas.buildpad.ai/api/collections

You 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/tasks

Seed 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/tasks

You 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/tasks

Browse 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.

The Studio's Content module with the projects and tasks collections, showing the seed tasks

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:

InterfaceUse ForComponent Installed
inputShort text, names, IDsinput
textareaLong text, descriptionstextarea
select-dropdownSingle choice from a listselect-dropdown
select-radioSingle choice, visible all at onceselect-radio
datetimeDates and timesdatetime

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.

Continue to Tutorial 3: Building UI →

Last updated on