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

# cubby init

> Create a new Cubby app

# cubby init

Scaffold a new Cubby app with Next.js and Prisma preconfigured for the platform (SQLite by default; Neon Postgres on Builder/Pro).

## Usage

```bash theme={null}
cubby init [name]
```

## Arguments

| Argument | Description                           | Default        |
| -------- | ------------------------------------- | -------------- |
| `name`   | App name or `.` for current directory | `my-cubby-app` |

## Examples

```bash theme={null}
# Create app in new directory
cubby init myapp

# Initialize in current directory
cubby init .

# Create with default name
cubby init
```

## What Gets Created

The scaffold includes a complete Next.js 16 + Prisma setup (SQLite by default):

```
myapp/
├── app/
│   ├── api/
│   │   └── health/
│   │       └── route.ts       # Health check endpoint
│   ├── page.tsx               # Home page
│   ├── layout.tsx             # Root layout
│   └── globals.css            # Global styles
├── lib/
│   └── db.ts                  # Prisma client singleton
├── prisma/
│   └── schema.prisma          # Database schema
├── public/
│   ├── manifest.json          # PWA manifest
│   └── favicon.ico
├── .env.example               # Environment template
├── .gitignore
├── cubby.yaml                 # Platform configuration
├── CUBBY.md                   # AI context file
├── next.config.ts             # Next.js config (standalone output)
├── package.json
└── tsconfig.json
```

## App Name Rules

App names must be DNS-safe:

* 3-30 characters
* Lowercase letters, numbers, and hyphens only
* Must start and end with a letter or number

Names are automatically slugified:

* `My App` becomes `my-app`
* `app_name` becomes `app-name`

## After Initialization

```bash theme={null}
cd myapp
npm install
npm run dev
```

For the **default SQLite template, `npm run dev` needs no Docker and no local database** —
Cubby runs `prisma db push` for you on deploy. Hot reload works immediately.

If you chose the **Neon Postgres template**, use `cubby dev` instead — it runs a local
Postgres container and **requires Docker** (see [`cubby dev`](/cli-reference/dev)).

```bash theme={null}
cubby dev   # Neon template — Docker required; local Postgres + automatic schema sync
```

## The CUBBY.md File

Every scaffolded app includes a `CUBBY.md` file that provides context for AI coding assistants. It documents:

* Platform constraints
* API route patterns
* Database access patterns
* Authentication (handled by Cubby SSO)
* What NOT to do

When using Claude or other AI tools, this file helps them understand Cubby's conventions.

## Customizing the Schema

Edit `prisma/schema.prisma` to define your data models:

```prisma theme={null}
model Task {
  id        String   @id @default(cuid())
  title     String
  completed Boolean  @default(false)
  createdAt DateTime @default(now())
}
```

You only need to push the schema locally if you want a live local database. On the SQLite
template, the `data/` dir must exist first, or `prisma db push` fails with
`P1003 Database does not exist`:

```bash theme={null}
mkdir -p data              # create the data/ dir (prisma db push then creates the .db file)
npx prisma db push
npx prisma generate
```

On deploy, Cubby runs `prisma db push` for you — so for frontend work you can just run
`npm run dev`. On the Neon template, `cubby dev` (Docker) handles schema sync automatically.

## Next Steps

After `cubby init`:

1. **Install dependencies**: `npm install`
2. **Start development**: `npm run dev` (SQLite/no-DB; no Docker) or `cubby dev` (Neon; Docker)
3. **Edit your schema**: `prisma/schema.prisma`
4. **Build your app**: Add pages in `app/`
5. **Deploy**: `cubby deploy`

## Related Commands

* [`cubby dev`](/cli-reference/dev) - Start local development
* [`cubby deploy`](/cli-reference/deploy) - Deploy to production
* [`cubby check`](/cli-reference/check) - Validate project
