rsnext/examples/cms-payload
Jessica Chowdhury cca9dd1297
examples: Add new cms-payload example. (#49616)
This PR adds `cms-payload` to the examples folder. The demo provides a
NextJS frontend, built with Payload, which can be deployed together in a
single instance.

### Improving Documentation or adding/fixing Examples

- [x] The "examples guidelines" are followed from our contributing doc
https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md
- [x] Make sure the linting passes by running `pnpm build && pnpm lint`.
See
https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md

---------

Co-authored-by: Lee Robinson <me@leerob.io>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-06-16 07:32:51 -07:00
..
app examples: Add new cms-payload example. (#49616) 2023-06-16 07:32:51 -07:00
components examples: Add new cms-payload example. (#49616) 2023-06-16 07:32:51 -07:00
css examples: Add new cms-payload example. (#49616) 2023-06-16 07:32:51 -07:00
pages/api examples: Add new cms-payload example. (#49616) 2023-06-16 07:32:51 -07:00
payload examples: Add new cms-payload example. (#49616) 2023-06-16 07:32:51 -07:00
public examples: Add new cms-payload example. (#49616) 2023-06-16 07:32:51 -07:00
utilities examples: Add new cms-payload example. (#49616) 2023-06-16 07:32:51 -07:00
.env.example examples: Add new cms-payload example. (#49616) 2023-06-16 07:32:51 -07:00
.gitignore examples: Add new cms-payload example. (#49616) 2023-06-16 07:32:51 -07:00
.npmrc examples: Add new cms-payload example. (#49616) 2023-06-16 07:32:51 -07:00
cssVariables.js examples: Add new cms-payload example. (#49616) 2023-06-16 07:32:51 -07:00
next-env.d.ts examples: Add new cms-payload example. (#49616) 2023-06-16 07:32:51 -07:00
next-env.scss.d.ts examples: Add new cms-payload example. (#49616) 2023-06-16 07:32:51 -07:00
next.config.js examples: Add new cms-payload example. (#49616) 2023-06-16 07:32:51 -07:00
package.json examples: Add new cms-payload example. (#49616) 2023-06-16 07:32:51 -07:00
payload-types.ts examples: Add new cms-payload example. (#49616) 2023-06-16 07:32:51 -07:00
README.md examples: Add new cms-payload example. (#49616) 2023-06-16 07:32:51 -07:00
tsconfig.json examples: Add new cms-payload example. (#49616) 2023-06-16 07:32:51 -07:00

Next + Payload Serverless Demo

This is a demo showing how to utilize @payloadcms/next-payload to deploy Payload serverlessly, in the same repo alongside of a NextJS app.

Deploy your own

Deploy the example using Vercel:

Deploy with Vercel

How to use

Execute create-next-app with npm, Yarn, or pnpm to bootstrap the example:

npx create-next-app --example cms-payload cms-payload-app
yarn create next-app --example cms-payload cms-payload-app
pnpm create next-app --example cms-payload cms-payload-app

Deploy it to the cloud with Vercel (Documentation).

The only thing you need to do to deploy to Vercel is to ensure that you have a Mongo Atlas database connection string and an S3 bucket (if desired).

Fill out the same environment variables that are shown in the .env.example with your own values, and then you're good to go!

Developing locally

To develop with this package locally, make sure you have the following required software:

  1. MongoDB
  2. Node + NPM / Yarn
  3. An S3 bucket to store media (optional)

Getting started

Follow the steps below to spin up a local dev environment:

  1. Clone the repo
  2. Run yarn or npm install
  3. Run cp .env.example .env and fill out all ENV variables as shown
  4. Run yarn dev to start up the dev server

From there, you can visit your admin panel via navigating to http://localhost:3000/admin. Go ahead and start working!