
How to Setup NextBlock: From Scratch
How to Setup NextBlock: From Scratch
Whether you're a contributor diving into the full monorepo or a developer bootstrapping a standalone project, NextBlock offers two clear paths to get started. This guide walks through both.
Choose Your Path
🔧 Monorepo (git clone)
For contributors, plugin developers, and teams that want full control over every library in the Nx workspace.
⚡ CLI (npm create)
For developers who want a standalone Next.js project with NextBlock baked in — ready to deploy in minutes.
Path 1: The Monorepo (Contributors & Advanced)
Clone the full Nx monorepo to contribute or build custom libraries:
git clone https://github.com/nextblock-cms/nextblock.git
cd nextblock
npm install
npm run setup
The npm run setup wizard will:
- Create
.env.localfrom the template - Prompt for your Supabase project URL and keys
- Optionally configure R2 storage and SMTP
- Link the Supabase CLI to your project
- Push the database schema with
npm run db:push
Then start the dev server:
npx nx serve nextblock
Useful monorepo commands:
# Build all workspace projects
npm run all-builds
# Lint the main app
npm run nx:lint:nextblock
# Regenerate DB types after schema changes
npm run db:types
# View the dependency graph
npx nx graph
Path 2: The CLI (Quick Start)
Scaffold a standalone project in seconds:
npm create nextblock@latest my-site
cd my-site
The CLI copies a production-ready template, rewrites workspace imports to published packages, and optionally runs the setup wizard. Your project is a standard Next.js app — no Nx required.
Configure your environment in .env.local:
NEXT_PUBLIC_SUPABASE_URL=your-project-url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-key
SUPABASE_SERVICE_ROLE_KEY=your-service-role-key
NEXT_PUBLIC_URL=http://localhost:3000
Push the schema and start developing:
npm run db:push
npm run dev
Activating Premium Modules
For CLI-generated projects, activate the e-commerce package:
npx create-nextblock activate ecommerce
This injects route wrappers for /cms/orders, /cms/products, /checkout, and the checkout API — all gated through verifyPackageOnline() so premium routes stay aligned with your license.
Deployment
NextBlock deploys as a standard Next.js app. Push to Vercel, Netlify, or any Node.js host. Ensure your server-side environment variables (Supabase service role, Stripe keys, CRON_SECRET) are configured in your hosting provider's dashboard.