Overview
The Next.js 13 App Router Payload CMS Monorepo is a starter project that combines Next.js, Payload CMS, pnpm, and Turbo monorepo. It provides a seamless integration of Payload CMS with a Next.js application. The admin panel for Payload CMS appears under the Next.js application as /admin, and the Payload API endpoint can be accessed under /api. The project includes various features such as Next.js 13 with App Router and custom Next.js server integration, shared packages for Tailwind CSS, ESLint, and a custom UI kit. It also includes a MongoDB example configuration for easy setup and a configured Storybook installation with a dark theme switcher for Tailwind CSS.
Features
- Next.js 13 with App Router and custom Next.js server with Payload CMS integration
- Shared packages for Tailwind CSS, ESLint, and a custom UI kit
- Configured Storybook installation with dark theme switcher for Tailwind CSS
- MongoDB example docker-compose.yml configuration for easy setup
Installation
- Clone the repository.
- Copy the
app/server/.env_examplefile toapp/server/.env. - Generate the Payload CMS secret session key by running
node apps/server/generatePayloadSecret.jsand update the.envfile with the generated key. - Optionally, start your local MongoDB database using Docker.
- Install pnpm if not already installed.
- In the project root, run
pnpm installto install dependencies. - Run
pnpm devto start the server and development environment, orpnpm dev:seedto start with a seeded Payload CMS including an admin and guest user. - To run a production build, run
pnpm buildfollowed bypnpm serve. - To clean up build artifacts and node_modules, run
pnpm clean. - Use
http://localhost:3000andhttp://localhost:3000/admininstead of127.0.0.1to prevent CORS errors in Payload CMS admin.
Summary
The Next.js 13 App Router Payload CMS Monorepo is a powerful starter project that combines the benefits of Next.js, Payload CMS, pnpm, and Turbo monorepo. It provides a seamless integration of Payload CMS with a Next.js application, allowing developers to easily build and manage content-driven websites. The project includes key features such as Next.js 13 with App Router and custom Next.js server integration, shared packages for Tailwind CSS and ESLint, and a configured Storybook installation for UI development. With the MongoDB example configuration and easy installation steps, developers can quickly set up a local environment to start building their applications. Overall, this starter project offers a comprehensive solution for building robust and flexible web applications with Next.js and Payload CMS.