Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

The official Next.js website for payloadcms.com

License

NotificationsYou must be signed in to change notification settings

payloadcms/website

Repository files navigation

This is the repository forPayload's official website. It was built completely in public using Payload itself,more on that here.

Payload headless CMS website

This site showcases lots of cool stuff like how to use Next.js 15 + Payload's local API to its fullest extent, how to build a super dynamic light / dark mode into a Next site without any first-load flickering, how to render remotely stored docs from MDX to Next.js pages using just Payload (no external libraries), how to use Stripe to build a custom SaaS integration, and much more.

✨ Tech stack

  • Payload (obviously)
  • TypeScript
  • Next.js 15 and its new App Router
  • SCSS Modules
  • MDX for docs, using theLexical MDX Converter
  • GraphQL for Payload Cloud
  • Stripe for Payload Cloud

⭐ The CMS

Payload is leveraged for everything that this site does, outside of its documentation which is all stored as Markdown in the Payload repo on GitHub. Both the CMS and the website frontend are found within the same app folder.

☁️ Payload Cloud

This repo contains the source code forPayload Cloud. This is a one-click integration to deploy production-ready instances of your Payload apps directly from your GitHub repo,read the blog post to get all the details. The entire frontend of Payload Cloud has been built in public and is included within this repo 😱.

🚀 Running the project locally

To get started with this repo locally, follow the steps below:

  • Clone the repo
  • pnpm i
  • Runcp .env.example .env to create an.env file
  • Fill out the values within your new.env, corresponding to your own environment
  • Runpnpm dev
  • Bam

Hosts file

The locally running app must run onlocal.payloadcms.com:3000 because of http-only cookie policies and how the GitHub App redirects the user back to the site after authenticating. To do this, you'll need to add the following to your hosts file:

127.0.0.1 local.payloadcms.com

On Mac you can find the hosts file at/etc/hosts. On Windows, it's atC:\Windows\System32\drivers\etc\hosts:

Documentation

The documentation for this site is stored in thePayload repo as Markdown files. These are fetched when you press the "Sync Docs" button in the CMS. Pressing that button does the following:

  1. Docs are pulled from the Payload repo on GitHub.
  2. The docs are converted from MDX to Lexical and stored in the CMS.
  3. The frontend docs pages are revalidated.
  4. Visiting the docs pages will pull the latest docs from the CMS, and render those lexical nodes to JSX.

Working on the docs locally - GitHub

By default, the docs are pulled from themain branch of the Payload repo on GitHub. You canload the docs for a different branch by opening the /docs/dynamic/ route on the website. This will dynamically load them every time you visit the page, without needing to sync them in the CMS.

Example:

In order to edit docs for that branch without touching markdown files, you can use the branch selector in the CMS to select the branch you want to work on. After making changes and saving the document, the lexical docs will be converted to MDX and pushed to the selected branch on GitHub.

You will need to set the following environment variables to work with the GitHub sync:

// .env# For reading from GitHubGITHUB_ACCESS_TOKEN=ghp_GITHUB_CLIENT_SECRET=# For writing to GitHub - you can run the https://github.com/payloadcms/gh-commit repo locallyCOMMIT_DOCS_API_URL=COMMIT_DOCS_API_KEY=

Working on docs locally - local markdown files

If you have the docs stored locally as markdown files and would like to preview them in the website, you can use the /docs/local/ route in the website. First, you need to set theDOCS_DIR_V3 environment variable to point to your localdocs directory.

// .envDOCS_DIR_V3=/documents/github/payload/docs

Then, just open the/docs/local/ route:http://localhost:3000/docs/local/getting-started/concepts.

Every time you make a change to the markdown files, just reload the page to see the changes reflected. The local MDX files are read, automatically converted to lexical on-the-fly, and rendered in the website. This process will not make any changes to the database.

Beta and Legacy environment flags

You can also specify abeta version andlegacy version to render different versions of the docs:

  • Set the environment variableNEXT_PUBLIC_ENABLE_BETA_DOCS totrue to enable the beta docs.
  • Specify a branch, commit, or tag withNEXT_PUBLIC_BETA_DOCS_REF. The default for the beta docs isbeta.
  • Set the environment variableNEXT_PUBLIC_ENABLE_LEGACY_DOCS totrue to enable the legacy docs.
  • Specify a branch, commit, or tag withNEXT_PUBLIC_LEGACY_DOCS_REF. The default for the legacy docs isnull, and will fallback to themain branch.

License

The Payload website is available as open source under the terms of theMIT license.

About

The official Next.js website for payloadcms.com

Topics

Resources

License

Stars

Watchers

Forks

Contributors22


[8]ページ先頭

©2009-2025 Movatter.jp