Files
payload/examples/auth/next-pages/README.md
2023-07-20 14:06:26 -04:00

2.7 KiB

Payload Auth Example Front-End

This is a Payload + Next.js app using the Pages Router made explicitly for the Payload Auth Example. It demonstrates how to authenticate your Next.js app using Payload Authentication.

This example uses the Pages Router, the legacy API of Next.js. If your app is using the latest App Router, check out the official App Router Example.

Getting Started

Payload

First you'll need a running Payload app. If you have not done so already, clone down the cms folder and follow the setup instructions there to get it up and running. This will provide all the necessary APIs that your Next.js app will be using for authentication.

Next.js

  1. Clone this repo
  2. cd into this directory and run yarn or npm install
  3. cp .env.example .env to copy the example environment variables
  4. yarn dev or npm run dev to start the server
  5. open http://localhost:3001 to see the result

Once running, a user is automatically seeded in your local environment with some basic instructions. See the Payload Auth Example for full details.

Learn More

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

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

Deployment

The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js. You could also combine this app into a single Express server and deploy in to Payload Cloud.

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

Questions

If you have any issues or questions, reach out to us on Discord or start a GitHub discussion.