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. A Supabase 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/(authenticated)/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 Postgres 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

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 { label: "Projects", href: "/content/projects" } and { label: "Tasks", href: "/content/tasks" } to your app nav config manually.

Verify the Schema via the DaaS API

Use your terminal (or any REST client) to confirm both collections exist and have the correct fields:

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

# 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 DaaS Studio

Open your project’s DaaS Studio (Content menu). You should see both collections listed with the fields you defined, and the seed records you just created.

DaaS Studio showing the projects and tasks collections in the data model view

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