---
title: "Payload CMS hosting on Edge | Next.js-native, self-hosted"
description: "Run Payload inside your Next.js app on a real VM, with Postgres or MongoDB, S3-compatible uploads via @payloadcms/storage-s3 and a global CDN. Zero egress fees."
url: https://edge.network/solutions/payload
---

For Payload

# Payload on Edge, inside your Next.js app

The TypeScript-first CMS runs in the same next start process as your site: a real VM, uploads in S3-compatible storage and pages cached in 988 locations. No cold starts, no edge-runtime limits.

[Deploy a VM](/console/access/new?product=compute)[See the Next.js page](/solutions/nextjs)

The setup on this page costs $40.02 a month, with no egress line.

Why Payload on Edge

## Payload runs here exactly as it runs on your laptop

A real VM means a long-lived Node process. No serverless cold starts, no edge-runtime restrictions, no function time-outs.

-   ### Schema in TypeScript
    
    Collections, fields and access control are code in your repo, reviewed and versioned like everything else.
    
-   ### Embedded or standalone
    
    Run Payload inside your Next.js app on one VM, or split the admin and front end across two. Both are first-class.
    
-   ### The official S3 adapter
    
    @payloadcms/storage-s3 takes a custom endpoint, so uploads and generated sizes live in an Edge Storage bucket.
    
-   ### Postgres or MongoDB
    
    Run either on the same VM for small projects, or on a dedicated database VM over a private network.
    
-   ### A global CDN in front
    
    Pages, static assets and public API responses cache in 988 locations. The admin UI goes to origin.
    
-   ### One prompt: VM, DNS, CDN and bucket
    
    Ask the Edge agent API to deploy your Payload and Next.js app to a domain: VM, DNS, CDN, SSL and bucket.
    

Reference architecture

## Payload and Next.js in one process

Payload and Next.js share one process on one VM. The database sits beside it, uploads go to storage and the CDN handles the world.

-   [Compute](/compute)
    
    Runs Payload and Next.js in one Node process, with the database alongside.
    
-   [Storage](/storage)
    
    Holds upload collections and every generated image size.
    
-   [CDN](/cdn)
    
    Caches the front end and public API; the admin UI goes to origin.
    
-   [Image optimisation](/docs/cdn/image-optimization)
    
    Optional: skip Payload's resize step and transform at the edge.
    
-   [DNS](/dns)
    
    Anycast DNS for the apex, www and preview branches.
    
-   [Shield](/shield)
    
    Validates form submissions in a Payload hook with one call.
    
-   [Assist](/assist)
    
    AI answers from your published content on the front end.
    

Deploy

## Storage first, then build, migrate and start

The Payload 3 website template, deployed as a normal Next.js app. Swap the rsync for CI once it works by hand.

1.  01
    
    ### Wire uploads to Edge Storage
    
    Serve files from your CDN domain rather than proxying them through Payload. Uploads then never touch the VM on the way out.
    
    payload.config.ts
    
    ```
    import { buildConfig } from 'payload'
    import { postgresAdapter } from '@payloadcms/db-postgres'
    import { s3Storage } from '@payloadcms/storage-s3'
    
    export default buildConfig({
      db: postgresAdapter({
        pool: { connectionString: process.env.DATABASE_URI },
      }),
      plugins: [
        s3Storage({
          collections: {
            media: {
              disablePayloadAccessControl: true,
              generateFileURL: ({ filename }) =>
                `https://media.acme.dev/${filename}`,
            },
          },
          bucket: 'acme-uploads',
          config: {
            endpoint: 'https://storage.edge.network',
            region: 'us-east-1',
            forcePathStyle: true,
            credentials: {
              accessKeyId: process.env.EDGE_KEY!,
              secretAccessKey: process.env.EDGE_SECRET!,
            },
          },
        }),
      ],
      // collections, editor, secret…
    })
    ```
    
2.  02
    
    ### Create the VM and database
    
    A Performance VM gives Next.js builds and Postgres room to breathe on the same box.
    
    shell
    
    ```
    $ edge compute create --name site --size s-4vcpu-8gb \
        --image ubuntu-24 --region london --script nodejs
    $ edge storage create acme-uploads
    
    $ edge compute ssh vm-6f2d90
    $ apt install -y postgresql
    $ sudo -u postgres createdb acme
    ```
    
3.  03
    
    ### Build, migrate and start
    
    Run migrations before each start so the schema in code and the database never disagree.
    
    shell
    
    ```
    $ rsync -a --exclude node_modules ./ root@<vm-ip>:/srv/site/
    $ ssh root@<vm-ip>
    $ cd /srv/site && pnpm install --frozen-lockfile
    $ pnpm payload migrate && pnpm build
    $ pm2 start pnpm --name site -- start
    ```
    
4.  04
    
    ### Put the CDN in front
    
    One domain for the app, one for uploads with image transforms switched on.
    
    shell
    
    ```
    $ edge cdn create --name acme-site
    $ edge cdn domains add cdn-a1b2c3 \
        --domain acme.dev --origin https://<vm-ip>
    $ edge cdn domains add cdn-a1b2c3 \
        --domain media.acme.dev --jit-image \
        --origin-type storage --storage-bucket acme-uploads
    ```
    
5.  05
    
    ### Query with the Local API
    
    Same process, same VM: server components read straight from the database with no HTTP hop.
    
    app/(frontend)/page.tsx
    
    ```
    import { getPayload } from 'payload'
    import config from '@payload-config'
    
    export default async function Page() {
      const payload = await getPayload({ config })
      const posts = await payload.find({ collection: 'posts' })
      return <PostList posts={posts.docs} />
    }
    ```
    

Prefer to hand it off? [Give the job to your AI agent](/solutions/agentic-development) or [have our engineers do it](/solutions/expert-services).

What it costs

## CMS and front end on one bill line

Payload, Next.js and Postgres share one VM. Uploads sit in a bucket and the CDN takes the reads.

-   No per-seat or per-document fees
-   No function invocations to meter
-   Upload delivery at $0 egress

[See compute pricing](/compute/pricing)

Estimated monthly bill on Edge

Payload + Next.js on one VM, ~5.5M requests/mo, 25 GB of uploads

USD

-   Compute$38.47Performance VM, 4 vCPU, 8 GiB, Payload, Next.js + Postgres
-   CDN$1.255.5M requests: 500k free, then 5M × $0.25 per million
-   Storage$0.3025 GB of uploads: 5 GB free, then 20 GB × $0.015
-   DNS$0.00Apex, www and preview records
-   Egress$0.00

Total$40.02

FAQ

## Embedded or standalone, Mongo or Postgres

Something else? [Ask an engineer](/contact).

Embedded in Next.js or standalone?

Either. Embedded means one VM serves the admin at /admin and your front end. Standalone puts the CMS API and the front end on separate VMs, which helps when they scale differently or several apps share one CMS.

MongoDB or Postgres?

Postgres suits relational schemas and teams that already run it. MongoDB suits document-heavy content with flexible fields. Payload supports both; pick what your team knows.

How does this compare to managed Payload hosting?

Same open-source software, but you control the host. You get a predictable bill, custom plugins and Payload sitting next to the rest of your infrastructure.

Can I deploy with Docker?

Yes. Payload runs cleanly in a container; see the Docker stack for the pattern. Plain Node with PM2 or systemd is leaner if you don't need it.

Does next/image work with Payload uploads?

Yes. Point next/image at the CDN with a custom loader, as on our Next.js page. You get resizing and AVIF or WebP from the upload URL with no per-image fees.

Drop-in services

## A beforeChange hook and a widget

-   [
    
    Edge ShieldBot protection`POST /siteverify → score: 94`
    
    Validate form submissions in a Payload beforeChange hook with one server-side call. No CAPTCHA widget.
    
    Free forever, with unlimited widgets. No puzzles for visitors.Explore
    
    ](/shield)
-   [
    
    Edge AssistAI answers`<script src="…/assist.js">`
    
    Add the widget to your Next.js front end for answers grounded in your published content.
    
    Free tier: 250 answered questions a monthExplore
    
    ](/assist)

Related stacks

## Headless peers, and the Next.js app it lives in

[All 38 stacks](/solutions/stacks)

-   [Next.jsSelf-host Next.js without the lock-in](/solutions/nextjs)
-   [StrapiThe leading open-source headless CMS](/solutions/strapi)
-   [DirectusInstant API over any SQL database](/solutions/directus)
-   [MedusaModern headless commerce, Node.js-native](/solutions/medusa)

## Run Payload and Next.js as one app

Start free. Pair it with our Next.js guide for the full TypeScript story.

[Deploy a VM](/console/access/new?product=compute)[Talk to an engineer](/contact)

Billed hourly from a prepaid balance. Egress is free on every product.
