Documentation Index
Fetch the complete documentation index at: https://docs.cubby.pro/llms.txt
Use this file to discover all available pages before exploring further.
Building Database Apps
Cubby is database-ready out of the box. The defaultcubby init template is SQLite on every plan — choose the Neon Postgres template (Builder/Pro) only when you need Postgres features. The default is SQLite, not Postgres.
Most first cubbies should start with SQLite. It is simple, fast, and already wired into the default
cubby init template.Choose a database path
| Path | Best for | Availability |
|---|---|---|
| SQLite | personal tools, friend-group apps, prototypes, small dashboards, first cubbies | every plan |
| Neon Postgres | heavier relational apps, concurrent writes, Postgres-specific features, branching/snapshots | Builder and Pro |
DATABASE_URL from the runtime environment. Cubby injects it for you.
SQLite: the default path
Runcubby init and choose the default Next.js + SQLite template:
Define your models
Editprisma/schema.prisma:
Decide data scoping before you write a schema — default to shared
Cubby’s gateway already controls who can open the app (the owner + explicitly-shared users). Thex-cubby-user-id header answers “is this person allowed in?” — it is an
access gate, not a partition key. So default to a shared dataset: one deployment =
one shared dataset. For a separate group, deploy a separate copy.
x-cubby-user-id, x-cubby-username).
Local development
SQLite (the default template): no Docker, and no local DB is needed for frontend work — Cubby runsprisma db push for you on deploy. Just run:
data/ directory must
exist first, or prisma db push fails with
P1003 Database does not exist:
DATABASE_URL as file:./data/app.db — never a ../ path (it escapes the project
and breaks the sandbox).
Neon (the nextjs-neon template): use cubby dev, which requires Docker (it runs a
local postgres:17-alpine):
DATABASE_URL at a real Neon branch in .env.local and run
npm run dev. See cubby dev for details.
Before deploying, make sure the schema is in source control and the app reads
DATABASE_URL from the environment instead of hardcoding a file path.
Deploy
DATABASE_URL, applies platform checks, builds the app, and runs it with persistent storage.
Neon Postgres: Builder and Pro
Choose Neon Postgres when you need Postgres behavior rather than just persistence:- concurrent writes beyond SQLite’s sweet spot
- Postgres extensions or SQL features
- database branching and snapshots
- a workflow that already expects Postgres
cubby.yaml for Neon:
DATABASE_URL and DIRECT_URL at runtime. See Building with Neon Postgres for the full walkthrough.
Secrets are not database config
Do not commit.env files or database URLs. For third-party keys, use Cubby secrets:
local, so pass --env prod for production secrets. Set them only
after your first deploy, then redeploy (or run cubby secrets apply --env prod).
Database URLs are platform-managed. App secrets are yours to set.
Troubleshooting
Prisma cannot find DATABASE_URL
Prisma cannot find DATABASE_URL
Make sure your schema uses
url = env("DATABASE_URL"). Locally, create the expected local env file or run through cubby dev; on Cubby, the value is injected at runtime.My app needs Postgres-specific SQL
My app needs Postgres-specific SQL
Use the Neon Postgres template and a Builder or Pro plan. SQLite is the default path, not the only path.
Data disappeared locally
Data disappeared locally
Check whether you changed or deleted your local SQLite file. Local data is separate from Cubby runtime data.
The AI assistant wants to add auth or a database service
The AI assistant wants to add auth or a database service
Point it at
CUBBY.md. Cubby already provides auth headers and database injection; the app should use those platform primitives.Next steps
Build your first app
A complete SQLite-first todo app walkthrough.
Use Neon Postgres
The Builder/Pro Postgres path.