A block-based page builder powered by PayloadCMS for Next.js. Install this package into any Next.js project to add a full CMS with dynamic page content that can be shared across multiple applications.
- Block-Based Page Builder — Hero, Content, Contact Form, Features, Pricing, Testimonials, CTA, Team, FAQ, Image Gallery
- Multi-App Support — Share one PostgreSQL database across multiple Next.js apps
- Admin Panel — Visual editor for managing pages and content
- Dynamic Routes — Automatic page rendering at
/[slug] - SEO Fields — Meta titles, descriptions, images per page
- Draft Mode — Preview changes before publishing
- TypeScript — Full type safety with generated types
Run the setup command in your Next.js project:
npx payload-next-starterOr install globally:
npm install -g payload-next-starter
payload-next-starterThe setup script will:
- Copy Payload admin routes to
src/app/(payload)/ - Copy API routes to
src/app/api/[...payload]/ - Copy collections (Users, Media, Pages) to
src/collections/ - Copy block components to
src/components/blocks/ - Copy BlockRenderer and RichTextContent components
- Copy dynamic
[slug]page renderer tosrc/app/(frontend)/[slug]/ - Copy seed script to
src/scripts/seedPages.ts - Install required dependencies
- Update
next.config.tswith Payload plugin - Add scripts to
package.json - Create
.env.examplewith required variables
-
Copy
.env.exampleto.envand fill in your values:DATABASE_URL=postgresql://user:password@host:5432/database?sslmode=require PAYLOAD_SECRET=your-secret-key-min-16-chars NEXT_PUBLIC_SERVER_URL=http://localhost:3000 -
Generate Payload import maps:
npm run generate:importmap
-
Generate TypeScript types:
npm run generate:types
-
Start your dev server:
npm run dev
-
Visit
http://localhost:3000/adminto create your first admin user -
Seed sample pages (optional):
npm run seed:pages
This package is designed to be installed in multiple Next.js apps that share the same database. See CONSUMER_GUIDE.md for detailed instructions on:
- Installing the package in a consumer app
- Configuring the shared database connection
- Rendering dynamic pages with BlockRenderer
- Using individual block components
- Managing content across multiple apps
- Users — Authentication-enabled collection with admin access
- Media — Uploads collection with image handling
- Pages — Block-based page builder with SEO fields
| Block | Description |
|---|---|
HeroBlock |
Hero section with title, subtitle, CTA |
ContentBlock |
Rich text content with heading |
ContactFormBlock |
Contact form with info display |
FeaturesBlock |
Feature grid with icons |
PricingBlock |
Pricing plans table |
TestimonialsBlock |
Customer testimonials |
CTABlock |
Call-to-action banner |
TeamBlock |
Team member cards |
FAQBlock |
Accordion FAQ section |
ImageGalleryBlock |
Image grid gallery |
After running npm run seed:pages, the following sample pages are created:
| Route | Content |
|---|---|
/home |
Hero → Features → Testimonials → CTA |
/about-us |
Hero → Story → Values → Team → CTA |
/contact-us |
Hero → Contact Form → FAQ |
/services |
Hero → Services → How We Work → CTA |
/pricing |
Hero → Pricing → FAQ → CTA |
/faq |
Hero → General FAQ → Technical FAQ → CTA |
/share |
Hero → Share Ways → Referral → Testimonials → CTA |
- Next.js 13+ with App Router
- Node.js 18.20+ or 20.9+
- PostgreSQL database (Neon, Supabase, or any managed Postgres)
Deploy to Vercel, Railway, or any platform supporting Next.js:
npm run buildEnsure these environment variables are set in production:
DATABASE_URLPAYLOAD_SECRETNEXT_PUBLIC_SERVER_URL
Edit src/payload.config.ts to add:
- More collections
- Globals
- Hooks
- Access control
- Custom block types
Edit block components in src/components/blocks/ to customize styling and behavior.
MIT
- GitHub Issues
- Consumer Guide — For using in other Next.js apps
- Payload Docs