Quick Start
For Application Developers (Using SonicJS)
# Create a new SonicJS application
npx create-sonicjs@latest my-app
cd my-app
npm run dev
# Visit http://localhost:8787Your app includes:
- ✅ SonicJS CMS pre-configured
- ✅ Database migrations ready
- ✅ Example content collections
- ✅ Admin interface at
/admin - ✅ Ready to deploy to Cloudflare
For Package Developers (Contributing to SonicJS)
# Clone this repository
git clone https://github.com/lane711/sonicjs.git
cd sonicjs
# Install dependencies
npm install
# Build the core package
npm run build:core
# Create a test app to validate changes
npx create-sonicjs@latest my-sonicjs-app
# Run tests
npm testSetting Up a Fresh Database
# Create a fresh D1 database for your branch (run from project root)
npm run db:resetThis creates a new D1 database named sonicjs-worktree-<branch-name>, applies all migrations, and updates wrangler.toml.
Working with Database Migrations
Migrations live in packages/core/migrations/. Test apps reference them via npm workspace symlink.
From your test app directory (e.g., my-sonicjs-app/):
# Check migration status
wrangler d1 migrations list DB --local
# Apply pending migrations
wrangler d1 migrations apply DB --local
# Apply to production
wrangler d1 migrations apply DB --remoteCreating New Migrations:
SonicJS bundles migrations at build time (Workers can't access the filesystem at runtime).
- Create
packages/core/migrations/NNN_description.sql(useCREATE TABLE IF NOT EXISTSandINSERT OR IGNOREfor idempotency) - Regenerate bundle:
cd packages/core && npm run generate:migrations - Rebuild:
npm run build:core - Apply locally:
cd my-sonicjs-app && wrangler d1 migrations apply DB --local
Common Commands
npm run dev # Start dev server
npm run deploy # Deploy to Cloudflare
npm run db:migrate # Apply migrations
npm run db:studio # Open database studio
npm test # Run testsSource captured: 2026-10-11