**Tags:** CMS · Payload

# Payload CMS + Next.js Showcase 

Payload CMS ([zerops-recipe-apps/payload](https://github.com/zerops-recipe-apps/payload)) with a Vite + React frontend ([payload-next-frontend](https://github.com/zerops-recipe-apps/payload-next-frontend)) on [Zerops](https://zerops.io). PostgreSQL ships with the project. Default **Site Info** content seeds in Payload and displays in React. Omit `frontend*` services for CMS-only — use the [payload](https://app.zerops.io/recipes/payload) recipe instead.

### Available Environments

- [AI Agent](https://app.zerops.io/recipes/payload-nextjs.md?environment=ai-agent)
- [Remote (CDE)](https://app.zerops.io/recipes/payload-nextjs.md?environment=remote-cde)
- [Local](https://app.zerops.io/recipes/payload-nextjs.md?environment=local)
- [Stage](https://app.zerops.io/recipes/payload-nextjs.md?environment=stage)
- **Small Production** ← current
- [Highly-available Production](https://app.zerops.io/recipes/payload-nextjs.md?environment=highly-available-production)

### Services in this Environment

**Services:**

- **core** (core:single@2)
  - Containers: 1 × Shared Core, 0.00 GB RAM, 0 GB Disk
- **db** (postgresql:single@17) :5432, :6432
  - Containers: 1 × Shared Core, 1.25 GB RAM, 1 GB Disk
- **payload** (ubuntu/nodejs@24) :3000
  - Containers: 1 × Shared Core, 1.50 GB RAM, 1 GB Disk
  - Repository: [zerops-recipe-apps/payload](https://github.com/zerops-recipe-apps/payload)
- **frontend** (ubuntu/nodejs@24) :3000
  - Containers: 1 × Shared Core, 0.19 GB RAM, 1 GB Disk
  - Repository: [zerops-recipe-apps/payload-next-frontend](https://github.com/zerops-recipe-apps/payload-next-frontend)

**Total Resources:** 4 containers, 2.94 GB RAM, 3 GB Disk

### One-Click Deploy (Import YAML)

Use this YAML with `zcli project import` to deploy this environment:

```yaml
#zeropsPreprocessor=on
# yaml-language-server: $schema=https://api.app-prg1.zerops.io/api/rest/public/settings/import-project-yaml-json-schema.json

# Payload + Next.js — split repos (payload-next + payload-next-frontend).
# Setups: only `dev` and `prod`. Stage hostnames use `zeropsSetup: prod`.
# Vault: API_URL / APP_URL (+ DEV_* on Agent/Remote). Map NEXT_PUBLIC_PAYLOAD_URL from API_URL in storefront zerops.yaml in frontend zerops.yaml.
# Payload services use envIsolation: service only — do not add service@frontend on Payload CMS.

project:
  name: payload-next-small-prod
  vault:
    APP_URL: https://frontend-${zeropsSubdomainHost}.prg1.zerops.app
    API_URL: https://payload-${zeropsSubdomainHost}-3000.prg1.zerops.app
    DEV_APP_URL: https://frontend-${zeropsSubdomainHost}.prg1.zerops.app
    DEV_API_URL: https://payload-${zeropsSubdomainHost}-3000.prg1.zerops.app

    PAYLOAD_SECRET:
      value: <@generateRandomString(<32>)>
      sensitive: true


services:
  - hostname: db
    type: postgresql:single@17
    profile: oltp-staging
    priority: 10
  - hostname: payload
    type: nodejs@24
    priority: 6
    zeropsSetup: prod
    buildFromGit: https://github.com/zerops-recipe-apps/payload
    enableSubdomainAccess: true
    verticalAutoscaling:
      minRam: 1
      minFreeRamGB: 0.5
    envIsolation: service
  - hostname: frontend
    type: nodejs@24
    priority: 5
    zeropsSetup: prod
    buildFromGit: https://github.com/zerops-recipe-apps/payload-next-frontend
    enableSubdomainAccess: true
    envIsolation: service

```

---

## Next Steps

After deploying one of the environments and getting to know Zerops, you have two paths to choose from:

1. **Template Flow** — Clone our GitHub repositories and use the whole recipe as a template
2. **Integrate Flow** — If you already have an existing application on a similar stack, integrate the recipe setup with your application

Select a flow: [Template Flow](https://app.zerops.io/recipes/payload-nextjs.md?environment=small-production&guideFlow=template) or [Integrate Flow](https://app.zerops.io/recipes/payload-nextjs.md?environment=small-production&guideFlow=integrate)

Both flows are shown below:

## How to take over the Small Production environment

### 📦 Clone the template repositories

Fork or clone the following repositories to your local machine or GitHub account:

- [zerops-recipe-apps/payload](https://github.com/zerops-recipe-apps/payload)
- [zerops-recipe-apps/payload-next-frontend](https://github.com/zerops-recipe-apps/payload-next-frontend)

### 1. Find your service name

Many commands and configurations need the exact name of your service. You can find it in the Zerops Dashboard.

- Open your project in the Zerops Dashboard.
- In the project overview, find the service you want to manage.
- Use this exact name whenever a command or pipeline configuration asks for `<service-name>`.

<img src="https://storage-prg1.zerops.io/4gfos-storage/copy1_cd2a6044c8.jpg" style="display: block; margin: 0 auto;" alt="Zerops GUI: Locating the Service Name" width="500" />

### 2. Configure deployment pipeline

Go to Service Settings > Pipelines & CI/CD Settings in the Zerops Dashboard and connect your repository.

For production, use a trigger on new tags. This keeps deployments intentional and tied to a specific version. You can also add a regex filter, such as `^v[0-9]+\.[0-9]+\.[0-9]+$`, if you want to allow only semantic version tags.

<img src="https://storage-prg1.zerops.io/4gfos-storage/triggerborder_b865860a89.jpg" style="display: block; margin: 0 auto;" alt="Zerops GUI: Triggers" width="500" />

Alternatively, add `zcli push` to your existing CI/CD pipeline if you want full control over when deployments happen.

Learn more about pipeline triggers: https://docs.zerops.io/features/pipeline

### 3. Deploy to production

Create and push a new Git tag to deploy a specific version of your app:

```bash
git tag -a v1.0.0 -m "Release version 1.0.0"
git push origin v1.0.0
```

> [!TIP]
> Open the pipeline detail in the Zerops Dashboard to check the build progress and verify that all steps finish successfully.

### 4. Configure autoscaling

Review the autoscaling settings for your runtime services and databases in Service Settings > Automatic Scaling Configuration in the Zerops Dashboard.

<img src="https://storage-prg1.zerops.io/4gfos-storage/scaling_ac0880aef5.png" style="display: block; margin: 0 auto;" alt="Zerops GUI: Autoscaling configuration" width="500" />

The most important settings are:

```yaml
verticalAutoscaling:
  minRam: 1
  minFreeRamGB: 0.5
  minFreeRamPercent: 20
```

> [!CAUTION]
> Pay attention to `minFreeRamGB`. This value tells Zerops when to scale RAM vertically. Adjust it based on your app’s real memory needs. RAM scales up immediately, while CPU scales after two consecutive measurements below the threshold.

> [!TIP]
> Run a quick stress test with a tool like hey before real users arrive. This helps you see how your app behaves under load and tune the autoscaling settings.

### 5. Set up your domain

To send real traffic to your app, configure public HTTP access in Service Settings > Public Access & Internal Ports in the Zerops Dashboard.

Add your custom domain and point your DNS records to the Zerops IPs shown in the dashboard:

<img src="https://storage-prg1.zerops.io/4gfos-storage/subdomain_8cafd801e8.jpg" style="display: block; margin: 0 auto;" alt="Zerops GUI: Public access and custom domain" width="500" />

```text
Type   Name          Content          TTL
A      example.com   <zerops-ipv4>    Auto
AAAA   example.com   <project-ipv6>   Auto
```

For wildcard domains, add a CNAME record for SSL validation.

Check the public access documentation: https://docs.zerops.io/features/access

> [!TIP]
> When changing DNS records for production, start with a low TTL value. Make sure SSL certificates are active before you disable the fallback Zerops subdomain.

Once everything works, you can disable the Zerops subdomain so all traffic goes through your custom domain.

---

### 🎉 You are good to go!

Your application is live in production and the core setup is complete.

The following sections are optional. They cover extra production features such as log forwarding, backups, and diagnostic access. You can stop here and come back later when you need them.

---

### 6. Set up log forwarding (Optional)

To send logs to an external service, go to Project Settings > Log Forwarding & Logs Overview in the Zerops Dashboard.

You can forward logs to services like Better Stack, Papertrail, or your own self-hosted solution.

Learn more about log forwarding: https://docs.zerops.io/references/logging

### 7. Configure database backups (Optional)

Manage automated encrypted backups in Service Settings > Backups in the Zerops Dashboard.

By default, backups run daily between 00:00 and 01:00 UTC.

Before a major deployment, create a manual protected backup:

```bash
zcli backup create <db-service> --tags pre-deploy,protected
```

Read the backup documentation for more options: https://docs.zerops.io/features/backup

### 8. Set up diagnostic access (Optional)

Use zCLI and VPN access when you need to inspect or maintain services directly.

For runtime services:

```bash
zcli vpn up
ssh <service-name>.zerops
```

For databases, connect through the VPN to reach the project’s private network, or set up secure direct IP access for your database admin tools.

Check the VPN documentation: https://docs.zerops.io/references/cli/commands#vpn-up

## How to integrate payload with Zerops

### Add `zerops.yaml`

Add the following `zerops.yaml` file to the root of your repository:

```yaml
# yaml-language-server: $schema=https://api.app-prg1.zerops.io/api/rest/public/settings/zerops-yaml-json-schema.json
#
# Payload CMS 3 (Next.js + admin + REST). Setups: `prod` and `dev` only.

zerops:
  - setup: prod
    build:
      base: nodejs@24
      envVariables:
        NODE_ENV: production
        NODE_OPTIONS: --max-old-space-size=4096
        PAYLOAD_SECRET: ${PAYLOAD_SECRET}
        DATABASE_URL: postgresql://${db_user}:${db_password}@${db_hostname}:5432/${db_hostname}?sslmode=disable
      buildCommands:
        - npm ci --include=dev
        - npx payload migrate
        - npx payload generate:importmap
        - npm run build
      deployFiles:
        - .next/standalone
        - .next/static
        - public
      cache:
        - node_modules
    deploy:
      readinessCheck:
        httpGet:
          port: 3000
          path: /admin
    run:
      base: nodejs@24
      envVariables:
        NODE_ENV: production
        PORT: "3000"
        PAYLOAD_SECRET: ${PAYLOAD_SECRET}
        DATABASE_URL: postgresql://${db_user}:${db_password}@${db_hostname}:5432/${db_hostname}?sslmode=disable
        SERVER_URL: ${zeropsSubdomain}
        APP_URL: ${APP_URL}
        DEV_APP_URL: ${DEV_APP_URL}
        FRONTEND_URL: https://frontend-${zeropsSubdomainHost}-3000.prg1.zerops.app
        DEV_FRONTEND_URL: https://frontenddev-${zeropsSubdomainHost}-3000.prg1.zerops.app
      ports:
        - port: 3000
          httpSupport: true
      start: node .next/standalone/bin/run.mjs
      healthCheck:
        httpGet:
          port: 3000
          path: /api/access

  - setup: dev
    build:
      base: nodejs@24
      os: ubuntu
      buildCommands:
        - npm install
      deployFiles: ./
      cache:
        - node_modules
    run:
      base: nodejs@24
      os: ubuntu
      envVariables:
        NODE_ENV: development
        PAYLOAD_SECRET: ${PAYLOAD_SECRET}
        DATABASE_URL: postgresql://${db_user}:${db_password}@${db_hostname}:5432/${db_hostname}?sslmode=disable
        SERVER_URL: ${DEV_API_URL}
        APP_URL: ${DEV_APP_URL}
        DEV_APP_URL: ${DEV_APP_URL}
        DEV_API_URL: ${DEV_API_URL}
      ports:
        - port: 3000
          httpSupport: true
      start: zsc noop --silent

```

## How to integrate frontend with Zerops

### Add `zerops.yaml`

Add the following `zerops.yaml` file to the root of your repository:

```yaml
# yaml-language-server: $schema=https://api.app-prg1.zerops.io/api/rest/public/settings/zerops-yaml-json-schema.json
#
# Next.js storefront (reads Payload REST API). Setups: `prod` and `dev`.

zerops:
  - setup: prod
    build:
      base: nodejs@24
      envVariables:
        NEXT_PUBLIC_PAYLOAD_URL: https://payload-${zeropsSubdomainHost}-3000.prg1.zerops.app
      buildCommands:
        - npm ci --include=dev
        - npm run build
      deployFiles:
        - .next/standalone
        - .next/static
        - public
      cache:
        - node_modules
    deploy:
      readinessCheck:
        httpGet:
          port: 3000
          path: /api/health
    run:
      base: nodejs@24
      ports:
        - port: 3000
          httpSupport: true
      envVariables:
        NODE_ENV: production
        PORT: "3000"
        NEXT_PUBLIC_PAYLOAD_URL: ${API_URL}
        PAYLOAD_URL: ${API_URL}
      start: node .next/standalone/bin/run.mjs
      healthCheck:
        httpGet:
          port: 3000
          path: /api/health

  - setup: dev
    build:
      base: nodejs@24
      os: ubuntu
      buildCommands:
        - npm install
      deployFiles: ./
      cache:
        - node_modules
    run:
      base: nodejs@24
      os: ubuntu
      ports:
        - port: 3000
          httpSupport: true
      envVariables:
        NODE_ENV: development
        NEXT_PUBLIC_PAYLOAD_URL: ${DEV_API_URL}
      start: zsc noop --silent

```

### 🎯 What's next?

**Deploy other environments** — Ready to scale? Deploy additional environments for different stages of your workflow:

- [AI Agent](https://app.zerops.io/recipes/payload-nextjs.md?environment=ai-agent)
- [Remote (CDE)](https://app.zerops.io/recipes/payload-nextjs.md?environment=remote-cde)
- [Local](https://app.zerops.io/recipes/payload-nextjs.md?environment=local)
- [Stage](https://app.zerops.io/recipes/payload-nextjs.md?environment=stage)
- [Highly-available Production](https://app.zerops.io/recipes/payload-nextjs.md?environment=highly-available-production)

## Knowledge Base

### Platform Reference

- [Routing & Domains](https://docs.zerops.io/features/access)
- [Scaling](https://docs.zerops.io/features/scaling)
- [Environment Variables](https://docs.zerops.io/features/env-variables)
- [CLI (zcli)](https://docs.zerops.io/references/cli)

### Service Type Reference

**PostgreSQL**

- [Connect](https://docs.zerops.io/postgresql/how-to/connect)
- [Backup & Restore](https://docs.zerops.io/postgresql/how-to/backup)
- [Manage](https://docs.zerops.io/postgresql/how-to/manage)
- [Scale](https://docs.zerops.io/postgresql/how-to/scale)

**Node.js**

- [Build & Deploy](https://docs.zerops.io/nodejs/how-to/build-pipeline)
- [Customize Runtime](https://docs.zerops.io/nodejs/how-to/customize-runtime)

**Node.js**

- [Build & Deploy](https://docs.zerops.io/bun/how-to/build-pipeline)
- [Customize Runtime](https://docs.zerops.io/bun/how-to/customize-runtime)

---

## Related Recipes

- [Payload CMS](https://app.zerops.io/recipes/recipe.md)
- [WordPress](https://app.zerops.io/recipes/wordpress.md)
- [Medusa Direct-to-Consumer (DTC)](https://app.zerops.io/recipes/medusa-dtc.md)
- [Medusa Showcase](https://app.zerops.io/recipes/medusa-showcase.md)

