Files
payload/examples/redirects/nextjs

Redirects Example Front-End

This is a Next.js project bootstrapped with create-next-app that fetches data from Payload CMS.

This example repo was made explicitly to demonstrate the ease of using the Redirects plugin to support redirects on your site.

Getting Started

Payload CMS

First you'll need a running CMS. If you have not done so already, open up the cms folder and follow the setup instructions. Take note of your server URL, you'll need this in the next step.

Next.js App

First, get your environment setup:

  1. First copy the example .env file as your own:
      cp .env.example .env
    
  2. Then open the .env file and paste your Payload server URL:
      NEXT_PUBLIC_CMS_URL=http://localhost:8000
    

First, run the development server:

npm run dev
# or
yarn dev

Open http://localhost:3000 with your browser to see the result.

Once running, you will find a couple seeded pages on your local environment.

You can also start editing the pages by modifying the documents within your CMS.

Learn More

To learn more about PayloadCMS and Next.js, take a look at the following resources:

You can check out the Payload CMS GitHub repository as well as the Next.js GitHub repository - your feedback and contributions are welcome!

Deploy on Vercel

The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.

Check out our Payload CMS deployment documentaton or the Next.js deployment documentation for more details.