Skip to content

Hello world! ๐Ÿ‘‹ This is a super powerful boilerplate built with Payload CMS 3.0 and Next.js 15! Everything is ready to get started right away! โœจ

Notifications You must be signed in to change notification settings

Xjectro/payload-cms-boilerplate

Repository files navigation

๐Ÿš€ Payload CMS Boilerplate

Modern, powerful and super fun CMS experience! ๐ŸŽ‰

Hello world! ๐Ÿ‘‹ This is a super powerful boilerplate built with Payload CMS 3.0 and Next.js 15! Everything is ready to get started right away! โœจ

๐ŸŒŸ Features

  • ๐ŸŽจ Modern UI/UX - Beautiful design with Tailwind CSS and Radix UI
  • ๐Ÿ” Secure Authentication - Login/Register system ready
  • ๐Ÿ“ฑ Responsive Design - Mobile, tablet and desktop compatible
  • ๐ŸŒ™ Dark/Light Mode - Theme switcher for night/day mode
  • ๐Ÿ“ Rich Text Editor - Powerful text editor with Lexical
  • ๐Ÿ–ผ๏ธ Media Management - File upload and image management
  • ๐Ÿ” SEO Optimized - Optimized for search engines
  • ๐ŸŒ GraphQL API - Modern API structure
  • ๐Ÿณ Docker Ready - Easy to deploy
  • โšก Live Preview - Real-time preview

๐Ÿ› ๏ธ Technologies

Technology Version Description
๐Ÿš€ Next.js 15.3.3 React framework
๐Ÿ“ฆ Payload CMS 3.43.0 Headless CMS
๐ŸŽจ Tailwind CSS 4.1.10 CSS framework
๐Ÿ—„๏ธ PostgreSQL - Database
๐Ÿ”ง TypeScript 5.7.3 Type safety
๐ŸŽญ React 19.1.0 UI library

๐Ÿ Quick Start

1. ๐Ÿ“ฅ Clone the Project

git clone https://github.com/Xjectro/payload-cms-boilerplate.git
cd payload-cms-boilerplate

2. ๐Ÿ“ฆ Install Dependencies

pnpm install
# or
npm install
# or
yarn install

3. โš™๏ธ Environment Setup

Create a .env.local file and add the required variables:

# Database Configuration
DATABASE_URI=postgres://postgres:B100dy50.waf!@127.0.0.1:5432/this-is-my-test-db

# Application Secrets
PAYLOAD_SECRET=YOUR_SECRET_HERE
PREVIEW_SECRET=your_preview_secret_here

# Site
SITE_URL=http://localhost:3000
SITE_NAME=Your Site Name

# Environment Variables for Next.js
NEXT_PUBLIC_SITE_URL=${SITE_URL}
NEXT_PUBLIC_SITE_NAME=${SITE_NAME}

4. ๐Ÿ—„๏ธ Setup Database

# Start PostgreSQL (with Docker)
docker-compose up -d

# Migrate the database
pnpm payload migrate

5. ๐ŸŽ‰ Start the Project

pnpm dev

Go to http://localhost:3000 in your browser! ๐ŸŽฏ

๐Ÿ“ Project Structure

๐Ÿ“ฆ payload-cms-boilerplate
โ”œโ”€โ”€ ๐ŸŽจ src/
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ app/                     # Next.js App Router
โ”‚   โ”‚   โ”œโ”€โ”€ (api)/                 # API routes
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ health/            # Health check
โ”‚   โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ route.ts       # Health endpoint
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ next/              # Next.js integration
โ”‚   โ”‚   โ”‚       โ”œโ”€โ”€ exit-preview/  # Preview exit
โ”‚   โ”‚   โ”‚       โ”‚   โ””โ”€โ”€ route.ts
โ”‚   โ”‚   โ”‚       โ””โ”€โ”€ preview/       # Preview mode
โ”‚   โ”‚   โ”‚           โ””โ”€โ”€ route.ts
โ”‚   โ”‚   โ”œโ”€โ”€ (frontend)/            # Frontend application
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ layout.tsx         # Frontend main layout
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ (auth)/            # Authentication pages
โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ layout.tsx     # Auth layout
โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ login/         # Login page
โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ page.tsx
โ”‚   โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ register/      # Register page
โ”‚   โ”‚   โ”‚   โ”‚       โ””โ”€โ”€ page.tsx
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ (protected)/       # Protected area
โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ layout.tsx     # Protected layout
โ”‚   โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ dashboard/     # Dashboard page
โ”‚   โ”‚   โ”‚   โ”‚       โ””โ”€โ”€ page.tsx
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ (public)/          # Public area
โ”‚   โ”‚   โ”‚       โ”œโ”€โ”€ layout.tsx     # Public layout
โ”‚   โ”‚   โ”‚       โ”œโ”€โ”€ page.tsx       # Home page
โ”‚   โ”‚   โ”‚       โ””โ”€โ”€ [slug]/        # Dynamic pages
โ”‚   โ”‚   โ”‚           โ””โ”€โ”€ page.tsx   # Slug page
โ”‚   โ”‚   โ””โ”€โ”€ (payload)/             # Payload admin
โ”‚   โ”‚       โ”œโ”€โ”€ layout.tsx         # Payload layout
โ”‚   โ”‚       โ”œโ”€โ”€ custom.scss        # Admin custom styles
โ”‚   โ”‚       โ”œโ”€โ”€ admin/             # Admin panel
โ”‚   โ”‚       โ”‚   โ”œโ”€โ”€ importMap.js   # Import map
โ”‚   โ”‚       โ”‚   โ””โ”€โ”€ [[...segments]]/
โ”‚   โ”‚       โ”‚       โ”œโ”€โ”€ not-found.tsx
โ”‚   โ”‚       โ”‚       โ””โ”€โ”€ page.tsx
โ”‚   โ”‚       โ””โ”€โ”€ api/               # Payload API routes
โ”‚   โ”‚           โ”œโ”€โ”€ [...slug]/     # Dynamic API
โ”‚   โ”‚           โ”‚   โ””โ”€โ”€ route.ts
โ”‚   โ”‚           โ”œโ”€โ”€ graphql/       # GraphQL endpoint
โ”‚   โ”‚           โ””โ”€โ”€ graphql-playground/
โ”‚   โ”œโ”€โ”€ ๐Ÿ—‚๏ธ collections/            # Payload collections
โ”‚   โ”‚   โ”œโ”€โ”€ Media/                 # Media collection
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ index.ts
โ”‚   โ”‚   โ”œโ”€โ”€ Pages/                 # Pages collection
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ hooks.ts           # Page hooks
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ index.ts
โ”‚   โ”‚   โ””โ”€โ”€ Users/                 # Users collection
โ”‚   โ”‚       โ””โ”€โ”€ index.ts
โ”‚   โ”œโ”€โ”€ ๐Ÿงฉ components/             # React components
โ”‚   โ”‚   โ”œโ”€โ”€ common/                # Common components
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ footer.tsx         # Footer
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ header.tsx         # Header
โ”‚   โ”‚   โ”œโ”€โ”€ features/              # Feature components
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ auth/              # Authentication components
โ”‚   โ”‚   โ”‚       โ”œโ”€โ”€ buttons/       # Auth buttons
โ”‚   โ”‚   โ”‚       โ””โ”€โ”€ forms/         # Auth forms
โ”‚   โ”‚   โ”œโ”€โ”€ payload/               # Payload components
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ rich-text.tsx      # Rich text renderer
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ blocks/            # Content blocks
โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ render-blocks.tsx # Block renderer
โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ banner-block/  # Banner block
โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ code-block/    # Code block
โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ content-block/ # Content block
โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ cta-block/     # CTA block
โ”‚   โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ media-block/   # Media block
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ fields/            # Custom field components
โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ link/          # Link field
โ”‚   โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ media/         # Media field
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ heroes/            # Hero components
โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ config.ts      # Hero configuration
โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ high-impact.tsx # High impact hero
โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ low-impact.tsx # Low impact hero
โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ medium-impact.tsx # Medium impact hero
โ”‚   โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ render-hero.tsx # Hero renderer
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ plugins/           # Plugin components
โ”‚   โ”‚   โ”‚       โ””โ”€โ”€ live-preview-listener.tsx
โ”‚   โ”‚   โ”œโ”€โ”€ providers/             # Provider components
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ theme/             # Theme components
โ”‚   โ”‚   โ”‚       โ”œโ”€โ”€ theme-provider.tsx # Theme provider
โ”‚   โ”‚   โ”‚       โ””โ”€โ”€ theme-toggle.tsx # Theme switcher
โ”‚   โ”‚   โ””โ”€โ”€ ui/                    # UI components
โ”‚   โ”‚       โ”œโ”€โ”€ design-system.tsx  # Design system
โ”‚   โ”‚       โ”œโ”€โ”€ forms/             # Form components
โ”‚   โ”‚       โ”‚   โ”œโ”€โ”€ form-box.tsx   # Form box
โ”‚   โ”‚       โ”‚   โ””โ”€โ”€ submit-button.tsx # Submit button
โ”‚   โ”‚       โ””โ”€โ”€ primitives/        # UI primitives
โ”‚   โ”‚           โ”œโ”€โ”€ alert.tsx      # Alert component
โ”‚   โ”‚           โ”œโ”€โ”€ badge.tsx      # Badge component
โ”‚   โ”‚           โ”œโ”€โ”€ button.tsx     # Button component
โ”‚   โ”‚           โ”œโ”€โ”€ checkbox.tsx   # Checkbox component
โ”‚   โ”‚           โ”œโ”€โ”€ form.tsx       # Form component
โ”‚   โ”‚           โ”œโ”€โ”€ input.tsx      # Input component
โ”‚   โ”‚           โ””โ”€โ”€ label.tsx      # Label component
โ”‚   โ”œโ”€โ”€ ๐Ÿ”— fields/                 # Payload field types
โ”‚   โ”‚   โ”œโ”€โ”€ link-group.ts          # Link group field
โ”‚   โ”‚   โ”œโ”€โ”€ link.ts                # Link field
โ”‚   โ”‚   โ””โ”€โ”€ slug/                  # Slug field
โ”‚   โ”‚       โ”œโ”€โ”€ format-slug.ts     # Slug format
โ”‚   โ”‚       โ”œโ”€โ”€ index.scss         # Slug styles
โ”‚   โ”‚       โ”œโ”€โ”€ index.ts           # Slug field
โ”‚   โ”‚       โ””โ”€โ”€ slug-component.tsx # Slug component
โ”‚   โ”œโ”€โ”€ ๐Ÿ”ง lib/                    # Helper libraries
โ”‚   โ”‚   โ”œโ”€โ”€ auth.ts                # Authentication
โ”‚   โ”‚   โ””โ”€โ”€ utils.ts               # General helpers
โ”‚   โ”œโ”€โ”€ ๐Ÿ”„ migrations/             # Database migrations
โ”‚   โ”œโ”€โ”€ ๐ŸŽจ styles/                 # Global styles
โ”‚   โ”‚   โ””โ”€โ”€ globals.css            # Global CSS
โ”‚   โ”œโ”€โ”€ ๐Ÿ› ๏ธ utils/                  # Utility functions
โ”‚   โ”‚   โ”œโ”€โ”€ plugins.ts             # Plugin configuration
โ”‚   โ”‚   โ”œโ”€โ”€ helpers/               # Helper functions
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ generate-preview-path.ts
โ”‚   โ”‚   โ”œโ”€โ”€ meta/                  # Meta data
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ generate-meta.ts   # Meta generator
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ open-graph.ts      # OpenGraph utilities
โ”‚   โ”‚   โ”œโ”€โ”€ payload-hooks/         # Payload hooks
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ access.ts          # Access controls
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ revalidate-redirects.ts
โ”‚   โ”‚   โ””โ”€โ”€ validations/           # Validation schemas
โ”‚   โ”‚       โ””โ”€โ”€ auth.ts            # Auth validations
โ”‚   โ”œโ”€โ”€ payload-types.ts           # Payload type definitions
โ”‚   โ””โ”€โ”€ payload.config.ts          # Payload configuration
โ”œโ”€โ”€ ๐Ÿ–ผ๏ธ public/                     # Static files
โ”‚   โ”œโ”€โ”€ favicon.ico                # Site icon
โ”‚   โ”œโ”€โ”€ opengraph-image.webp       # OpenGraph image
โ”‚   โ””โ”€โ”€ media/                     # Media files
โ”œโ”€โ”€ โš™๏ธ Config Files
โ”‚   โ”œโ”€โ”€ .env                       # Environment variables
โ”‚   โ”œโ”€โ”€ .prettierrc.json           # Prettier settings
โ”‚   โ”œโ”€โ”€ components.json            # Shadcn/ui config
โ”‚   โ”œโ”€โ”€ docker-compose.yml         # Docker Compose
โ”‚   โ”œโ”€โ”€ Dockerfile                 # Docker build
โ”‚   โ”œโ”€โ”€ eslint.config.mjs          # ESLint settings
โ”‚   โ”œโ”€โ”€ next.config.mjs            # Next.js configuration
โ”‚   โ”œโ”€โ”€ package.json               # Project dependencies
โ”‚   โ”œโ”€โ”€ tailwind.config.ts         # Tailwind configuration
โ”‚   โ””โ”€โ”€ tsconfig.json              # TypeScript settings

๐ŸŽฎ Available Commands

Command Description
pnpm dev ๐Ÿš€ Start development server
pnpm build ๐Ÿ“ฆ Build for production
pnpm start โ–ถ๏ธ Start production server
pnpm lint ๐Ÿ” Check code quality
pnpm format โœจ Format code
pnpm payload โšก Payload CLI commands

๐ŸŒˆ Block Types

This boilerplate includes many pre-built block types:

  • ๐ŸŽฏ Banner Block - Eye-catching banners
  • ๐Ÿ“ Content Block - Rich content areas
  • ๐Ÿ–ผ๏ธ Media Block - Image/video blocks
  • ๐Ÿ’ป Code Block - Code display
  • ๐ŸŽช CTA Block - Call-to-action buttons

๐Ÿ” Authentication

  • โœ… User registration and login
  • ๐Ÿ”’ Protected page redirects
  • ๐Ÿ‘ค User profile management
  • ๐Ÿšช Secure logout

๐ŸŒ API Endpoints

Endpoint Description
/api/graphql ๐Ÿ”— GraphQL API
/api/graphql-playground ๐ŸŽฎ GraphQL Playground
/admin ๐Ÿ”ง Payload Admin Panel

๐Ÿณ Running with Docker

# Start all services
docker-compose up -d

# Start only the database
docker-compose up -d postgres

๐Ÿš€ Deployment

Deploy to Vercel

# With Vercel CLI
vercel deploy

# or push to GitHub, auto deploy! ๐ŸŽ‰

Deploy with Docker

# Build image
docker build -t payload-cms-app .

# Run
docker run -p 3000:3000 payload-cms-app

๐Ÿค Contributing

  1. ๐Ÿด Fork it
  2. ๐ŸŒฟ Create feature branch (git checkout -b feature/amazing-feature)
  3. ๐Ÿ’พ Commit your changes (git commit -m 'Add amazing feature')
  4. ๐Ÿ“ค Push to the branch (git push origin feature/amazing-feature)
  5. ๐ŸŽฏ Create a Pull Request

๐Ÿ“ž Support

Got any issues? ๐Ÿค”

๐Ÿ“„ License

This project is licensed under the MIT License. See the LICENSE file for details! ๐Ÿ“œ


โญ Don't forget to star if you liked it! โญ

Made with โค๏ธ by Xjectro

๐Ÿš€ Happy coding! ๐Ÿš€

About

Hello world! ๐Ÿ‘‹ This is a super powerful boilerplate built with Payload CMS 3.0 and Next.js 15! Everything is ready to get started right away! โœจ

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published