payload-template-project

Next.js 16 and Payload starter with Clerk auth, MongoDB, S3 media storage, Resend email and shadcn/ui

payload-template-project preview

Overview

Summary generated from the README

A general-purpose starter for customer websites, landing pages and SaaS apps built on Next.js 16, Payload 3 and MongoDB. Authentication is handled by Clerk, media uploads go to S3-compatible storage, and transactional email uses Resend. The UI uses Tailwind CSS 4 and shadcn/ui. It needs a MongoDB connection string, Clerk keys and storage credentials, and includes an optional Docker Compose file for local MongoDB.

Features

  • Clerk-backed Users collection with admin panel access and webhook verification
  • Media collection with preset image sizes, focal point support and S3-compatible storage
  • Payload SEO and redirects plugins with live preview and Lexical rich text
  • Resend email adapter for transactional email
  • Tailwind CSS 4, shadcn/ui, Lucide icons and Motion for the front end
  • Docker Compose for local MongoDB and semantic-release tooling

Good for

  • Bootstrapping client websites or landing pages on a consistent Next.js and Payload stack
  • Starting SaaS projects that rely on Clerk for authentication instead of Payload auth
  • Standardizing an agency or team baseline with shared auth, storage and UI conventions

From the author

Get started quickly with Next.js, Clerk Auth, Payload CMS and MongoDB.

Get started

This repository is a GitHub template: create your own copy of it in one click.

Create a repository from this template

README

Payload Template Project

Internal starter template for building customer websites, landing pages, and SaaS applications on a consistent stack. Bootstrap new projects from this repo instead of starting from scratch — auth, CMS, storage, and UI conventions are already wired up.

Stack

  • Framework: Next.js 16 (App Router)
  • CMS: Payload CMS 3
  • Database: MongoDB
  • Auth: Clerk
  • Storage: S3-compatible object storage (media uploads)
  • Email: Resend
  • UI: Tailwind CSS 4, shadcn/ui, Lucide icons, Motion

Requirements

  • Node.js ^18.20.2 or >=20.9.0
  • pnpm ^9, ^10, or ^11
  • A MongoDB connection string (local, Docker, or Atlas)

Setup

  1. Clone the repo and install dependencies:

    pnpm install
    
  2. Copy the environment file and fill in the values:

    cp .env.example .env
    
    VariablePurpose
    DATABASE_URLMongoDB connection string
    PAYLOAD_SECRETPayload's signing secret
    PREVIEW_SECRETSecret used for live preview links
    CRON_SECRETSecret for authenticating scheduled/cron jobs
    NEXT_PUBLIC_SERVER_URLPublic URL the app is served from
    CLERK_SECRET_KEY / NEXT_PUBLIC_CLERK_PUBLISHABLE_KEYClerk API keys
    CLERK_WEBHOOK_SIGNING_SECRETVerifies incoming Clerk webhooks
    NEXT_PUBLIC_CLERK_SIGN_IN_URL, ..._SIGN_IN_FALLBACK_REDIRECT_URL, ..._SIGN_UP_FALLBACK_REDIRECT_URLClerk auth flow routing
    S3_BUCKET, S3_ACCESS_KEY_ID, S3_ACCESS_KEY_SECRET, S3_REGION, S3_ENDPOINTMedia storage (S3-compatible)
    RESEND_API_KEY, RESEND_FROM_EMAIL, RESEND_FROM_NAMETransactional email
  3. Start the dev server:

    pnpm dev
    
  4. Open http://localhost:3000. Follow the on-screen instructions to log in via Clerk and complete first-run setup.

Docker (optional)

To run MongoDB locally via Docker instead of a standalone instance or Atlas:

  1. Set DATABASE_URL in .env to mongodb://127.0.0.1/<dbname>.
  2. Match <dbname> in docker-compose.yml.
  3. Run docker-compose up (add -d to run in the background).

Available Scripts

ScriptPurpose
pnpm devStart the Next.js dev server
pnpm buildProduction build
pnpm startServe the production build
pnpm lintRun ESLint
pnpm payloadRun the Payload CLI
pnpm generate:typesRegenerate Payload's TypeScript types from the config
pnpm generate:importmapRegenerate Payload's admin import map

Run pnpm generate:types after changing any collection, global, or field config so generated types stay in sync.

Project Structure

  • src/ — application code (Next.js routes, Payload config, collections, components)
  • context/ — living documentation (architecture, UI tokens/rules, code standards, build plan, progress tracker) used to keep new projects built from this template consistent
  • docker-compose.yml — local MongoDB for Docker-based development

Collections

  • Users — auth-enabled collection with admin panel access, backed by Clerk.
  • Media — uploads collection with pre-configured image sizes and focal point support, backed by S3-compatible storage.

See the Payload Collections docs to extend either.

Using This as a Starter

When bootstrapping a new internal project from this template:

  1. Update package.json name/description and this README's title.
  2. Review context/ and update it to describe the new project's purpose, scope, and architecture — it should not still describe this template once customized.
  3. Keep the Clerk, Payload, S3, and Resend wiring unless the new project has a reason to diverge — the point of the template is a consistent baseline across projects.

Support

Internal questions: ask in the team channel. For upstream framework issues, see the Payload Discord or Payload GitHub discussions.

Claim this template

More Starters & boilerplates templates

payload-cms-boilerplate screenshot

payload-cms-boilerplate

Blank Payload 3 and Next.js 16 starter with Postgres, Tailwind, shadcn/ui primitives and a built-in SEO module

19
v3
Next.js
Updated 3 months ago
payload-template-project screenshot

payload-template-project

Next.js 16, Payload 3, Clerk auth, Postgres and S3 storage wired up as a baseline for new projects

0
v3
Next.js
Updated 2 weeks ago
acme-website screenshot

acme-website

Payload 3 starter with Better Auth, Postgres, S3 storage, a blog and composable layout and motion components

126
v3
Next.js
Updated 1 months ago