CLI — create-paperdb

create-paperdb scaffolds a new project with the PaperDB SDK pre-configured. It prompts you for a framework, auth providers, and features, then generates a ready-to-run project.

Quickstart

npx create-paperdb@latest

Or pass a project name directly to skip the first prompt:

npx create-paperdb@latest my-app

What it generates

The CLI walks you through four choices and then writes the project:

  • Framework — React / Next.js, Vue / Nuxt, Svelte / SvelteKit, or Vanilla JS (CDN)
  • Auth providers — Email/password (always included), Google OAuth, GitHub OAuth, Apple OAuth, Magic Link
  • Features — Realtime, Webhooks, Cron Jobs, File Storage, Full-Text Search, Offline Sync

The generated project includes:

  • src/db/schema.ts — example schema with users and posts collections
  • src/db/index.ts — typed PaperDB client
  • paperdb.config.ts — feature flags and auth config
  • .env.example — all required environment variables
  • Framework entry point and a working example component

After scaffolding

cd my-app
npm install
cp .env.example .env
# Add your PAPERDB_API_KEY to .env
npm run dev

Get your API key from the Dashboard → Databases → API Keys page after creating a database.

Manual setup

If you prefer to add PaperDB to an existing project:

npm install paperdb
import { createClient } from "paperdb";

const db = createClient({
  apiKey: process.env.PAPERDB_API_KEY,
});