Skip to main content

Building Your First App

Let’s build a complete todo list app from scratch and deploy it to Cubby.

What We’ll Build

A simple todo app with:
  • Add new todos
  • Mark todos complete
  • Delete todos
  • Data persisted in Cubby’s default SQLite database
  • User-specific data (each user sees only their todos)
Time: ~15 minutes

Prerequisites

  • Node.js 18 or later
  • Docker Desktop (for local development)
  • Cubby account and CLI installed

Step 1: Create the Project

This creates a Next.js + Prisma project configured for Cubby’s default SQLite path.

Step 2: Define the Data Model

Edit prisma/schema.prisma to add a Todo model:

Step 3: Create the API Routes

List and Create Todos

Create app/api/todos/route.ts:

Update and Delete Todos

Create app/api/todos/[id]/route.ts:

Step 4: Build the UI

Replace app/page.tsx with:

Step 5: Test Locally

Start the development environment:
Open http://localhost:3000 and test:
  • Add a few todos
  • Mark some complete
  • Delete one
Data persists between page refreshes because it’s stored in the local SQLite database.

Step 6: Deploy to Production

The CLI will:
  1. Package your code
  2. Run platform checks
  3. Build a Docker image
  4. Inject the production DATABASE_URL
  5. Start your container and route traffic to it
When complete, you’ll see:

Step 7: Test in Production

Visit your app URL. You’ll be prompted to log in with your Cubby account. After login:
  • Add some todos
  • Refresh the page - data persists
  • Share the app with a friend (they’ll see their own todos, not yours)

What’s Next?

  • Add a secret: Try integrating an API like OpenAI
  • Share your app: From the dashboard, share with other Cubby users
  • Add more features: Due dates, categories, search

Troubleshooting

”Build failed”

Run cubby check to see what’s wrong:

“Not logged in”

Database Errors

Reset your local database and try again: