Skip to content

About

Production-ready B2B starter — Next.js 16 + Payload CMS 3 + MongoDB + Tailwind 4 + PL/EN i18n + Coolify deployment. Maintained by Digital Vantage.

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

14 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nextjs-payload-starter

Production-ready B2B starter — Next.js 16 + Payload CMS 3 + MongoDB + Tailwind 4, with PL/EN i18n and Coolify deployment notes baked in.

Maintained by Digital Vantage — a Polish software house building custom web platforms, B2B portals and digital products.

CI Next.js Payload MongoDB Tailwind CSS License: MIT

What's inside

A pre-wired Payload CMS website template plus the bits you need on every B2B project but always end up bolting on by hand:

  • Payload CMS 3.x with Pages, Posts, Media, Categories, Users collections + Header/Footer globals
  • Lexical rich-text editor with toolbars and link/upload features
  • Plugins: form-builder, nested-docs, redirects, search, SEO
  • Live preview for Pages and Posts with Mobile/Tablet/Desktop breakpoints
  • i18n PL/EN — Payload localization for content + next-intl scaffolding for UI strings
  • Tailwind 4 + shadcn-style component primitives (@radix-ui + class-variance-authority)
  • MongoDB via @payloadcms/db-mongodb, ships with docker-compose.yml
  • Coolify-ready Dockerfile (Next.js standalone output)
  • Tests: Vitest (integration) + Playwright (e2e) configs
  • Lint/format: ESLint 9 + Prettier with sane Next.js defaults
  • next-sitemap for sitemap.xml and robots.txt

Tech stack

Layer Choice
Framework Next.js 16 (App Router, Turbopack, React 19.2)
CMS Payload CMS 3.84+
Database MongoDB 7 (@payloadcms/db-mongodb)
Styling Tailwind CSS 4 + Radix UI + tw-animate-css
Forms react-hook-form + Payload form-builder plugin
i18n next-intl 4 (UI) + Payload localization (content)
Testing Vitest 4 + Playwright 1.59
Lint/format ESLint 9 (eslint-config-next) + Prettier 3

Quick start

1. Clone and install

git clone https://github.com/DigitalVantage/nextjs-payload-starter.git
cd nextjs-payload-starter
pnpm install --ignore-workspace

2. Start MongoDB

docker compose up -d mongo

3. Configure environment

cp .env.example .env
# generate secrets
echo "PAYLOAD_SECRET=$(openssl rand -base64 32)" >> .env
echo "CRON_SECRET=$(openssl rand -hex 32)" >> .env
echo "PREVIEW_SECRET=$(openssl rand -hex 32)" >> .env

4. Run the dev server

pnpm dev

The first time you open /admin, Payload will ask you to create the first user.

Project structure

nextjs-payload-starter/
├── src/
│   ├── app/
│   │   ├── (frontend)/        # public website routes (App Router)
│   │   └── (payload)/         # Payload admin + REST/GraphQL API
│   ├── collections/           # Pages, Posts, Media, Categories, Users
│   ├── blocks/                # CMS-driven content blocks (CallToAction, Hero, etc.)
│   ├── components/            # shared UI components
│   ├── heros/                 # hero variants (high/low impact, post)
│   ├── plugins/               # Payload plugin wiring
│   ├── i18n/                  # next-intl config + PL/EN messages
│   ├── providers/             # theme + headerTheme contexts
│   ├── utilities/             # helpers (formatDateTime, getURL, …)
│   └── payload.config.ts      # Payload CMS config — start here
├── tests/                     # Vitest int + Playwright e2e
├── docker-compose.yml         # MongoDB + optional app container
├── Dockerfile                 # production image (Next.js standalone)
├── next.config.ts             # Next + Payload + next-intl plugin
└── .env.example

i18n

This starter ships with two layers of internationalization:

Content (Payload localization)

Configured in src/payload.config.ts:

localization: {
  locales: [
    { code: 'pl', label: 'Polski' },
    { code: 'en', label: 'English' },
  ],
  defaultLocale: 'pl',
  fallback: true,
}

Mark any field with localized: true and Payload will store one value per locale and return the right one based on the ?locale= query parameter (or req.locale). The admin UI gets a locale switcher automatically.

UI strings (next-intl)

Lives in src/i18n/:

  • config.ts — locale list and default
  • request.ts — getRequestConfig: detects locale from NEXT_LOCALE cookie, then Accept-Language, then default
  • messages/pl.json, messages/en.json — translation dictionaries

Use it in components:

import { useTranslations } from 'next-intl'

export function CTA() {
  const t = useTranslations('common')
  return <button>{t('submit')}</button>
}

Next step (intentionally left to you): route-prefixed locales (/pl/..., /en/...). The starter detects locale from cookie/header so SEO defaults to defaultLocale. If you need per-URL locales, move src/app/(frontend)/* under [locale]/ and add next-intl/middleware. Skipped here because the right choice (path prefix vs. subdomain vs. domain-per-locale) depends on your setup.

Deployment on Coolify

The included Dockerfile is configured for Next.js output: 'standalone' — the smallest production image possible.

In Coolify:

  1. New Resource → Application → Public Repository → paste this repo's URL.
  2. Build pack: Dockerfile.
  3. Required environment variables:
    • DATABASE_URL (point at a Coolify-hosted MongoDB or external Atlas)
    • PAYLOAD_SECRET
    • NEXT_PUBLIC_SERVER_URL (your public URL, e.g. https://example.com)
    • CRON_SECRET, PREVIEW_SECRET
  4. Add a Persistent Volume mapped to /app/public/media if you want uploads to survive redeploys.
  5. Set the port to 3000.

For MongoDB, Coolify can spin up a database resource — copy its connection string into DATABASE_URL.

Scripts

pnpm dev                # start Next.js dev server
pnpm build              # production build (also runs next-sitemap)
pnpm start              # serve production build

# Quality
pnpm validate           # lint + typecheck + format:check + test:int + build
pnpm lint               # ESLint
pnpm lint:fix           # ESLint --fix
pnpm typecheck          # tsc --noEmit
pnpm format             # prettier --write
pnpm format:check       # prettier --check

# Tests
pnpm test               # vitest + playwright
pnpm test:int           # vitest only
pnpm test:e2e           # playwright only

# Payload utilities
pnpm generate:types     # regenerate Payload TypeScript types
pnpm generate:importmap # regenerate admin component import map

Contributing

Issues and PRs welcome.

License

MIT — Digital Vantage. Do whatever you want with it; we'd love to hear if you ship something cool on top.

Maintainer

Digital Vantage — partnerstwo technologiczne dla firm B2B w Polsce.

If you need a partner to build, scale or maintain a Payload + Next.js platform — get in touch.

About

Production-ready B2B starter — Next.js 16 + Payload CMS 3 + MongoDB + Tailwind 4 + PL/EN i18n + Coolify deployment. Maintained by Digital Vantage.

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages