Requirements · Quick Start · How it works
The CMS Payload is where we store content to serve the LMS (Learning Management Service). This CMS acts as a database that provides us with custom structures for the LMS such as topic unit and topic content.
- Node.js >= 18.17.0
- Docker
To spin up this example locally, follow these steps:
-
Clone
If you have not done so already, you need to have a standalone copy of this repo on your machine. If you've already cloned this repo, skip to Development.
Go to Payload Cloud and clone this template. This will create a new repository on your GitHub account with this template's code which you can then clone to your own machine.
Use the
create-payload-app
CLI to clone this template directly to your machine:npx create-payload-app@latest my-project -t websit
Use the
git
CLI to clone this template directly to your machine:git clone -n --depth=1 --filter=tree:0 https://github.com/payloadcms/payload my-project && cd my-project && git sparse-checkout set --no-cone templates/website && git checkout && rm -rf .git && git init && git add . && git mv -f templates/website/{.,}* . && git add . && git commit -m "Initial commit"
-
cp .env.example .env
to copy the example environment variables -
yarn
to install dependencies -
docker-compose up
to fetch containers and run them (one is a MongoDB container, and one is a container created from the source code of this project) -
Seed the CMS:
To seed the database with a few pages, posts, and projects you can run
yarn seed
. This template also comes with aGET /api/seed
endpoint you can use to seed the database from the admin panel. The seed script will also create two users for demonstration purposes only:- Demo Author
- Email:
[email protected]
- Password:
password
- Role:
admin
- Email:
- Demo User
- Email:
[email protected]
- Password:
password
- Role:
user
- Email:
- Demo Author
NOTICE: seeding the database is destructive because it drops your current database to populate a fresh one from the seed template. Only run this command if you are starting a new project or can afford to lose your current data.
To run Payload in production, you need to build and serve the Admin panel. To do so, follow these steps:
- Invoke the
payload build
script by runningyarn build
ornpm run build
in your project root. This creates a./build
directory with a production-ready admin bundle. - Finally run
yarn serve
ornpm run serve
to run Node in production and serve Payload from the./build
directory. - When you're ready to go live, see Deployment for more details.
- This is where the CMS stores Topics. A Topic can be created here and we can assign Content Items to the Topic we want to. We can understand a Topic as a course unit that has many course contents (Content Items) and we can choose which content we want to be in a created unit.
- This is where the CMS stores all of its course content. We can create a new Content Item here using the schema provided by the CMS.
-
Users are auth-enabled and encompass both admins and regular users based on the value of their
roles
field. Onlyadmin
users can access your admin panel to manage your website whereasuser
can authenticate on your front-end to leave comments and read premium content but have limited access to the platform. See Access Control for more details.For additional help, see the official Auth Example or the Authentication docs.
-
Posts are used to generated blog posts, news articles, or any other type of content that is published over time. All posts are layout builder enabled so you can generate unique layouts for each post using layout-building blocks, see Layout Builder for more details. Posts are also draft-enabled so you can preview them before publishing them to your website, see Draft Preview for more details.
Users can also leave comments on posts if they are logged in. Then, editors can log in to review and approve comments before they are published. See Comments for more details.
Posts can also restrict access to content or digital assets behind authentication, see Premium Content for more details.
-
Comments are used to allow logged-in users to leave comments on posts. Comments are draft-enabled so admins can review and approve them before they are published to your website, see Comments for more details.
-
Projects are used to showcase your work. All projects are layout builder enabled so you can generate unique layouts for each project using layout-building blocks, see Layout Builder for more details. Projects are also draft-enabled so you can preview them before publishing them to your website, see Draft Preview for more details.
-
All pages are layout builder enabled so you can generate unique layouts for each page using layout-building blocks, see Layout Builder for more details. Pages are also draft-enabled so you can preview them before publishing them to your website, see Draft Preview for more details.
-
This is the uploads enabled collection used by pages, posts, and projects to contain media like images, videos, downloads, and other assets.
-
A taxonomy used to group posts or projects together. Categories can be nested inside of one another, for example "News > Technology". See the official Payload Nested Docs Plugin for more details.
See the Globals docs for details on how to extend this functionality.
-
Header
The data required by the header on your front-end like nav links.
-
Footer
Same as above but for the footer of your site.
Basic role-based access control is setup to determine what users can and cannot do based on their roles, which are:
admin
: They can access the Payload admin panel to manage your site. They can see all data and make all operations.user
: They cannot access the Payload admin panel and can perform limited operations based on their user (see below).
This applies to each collection in the following ways:
users
: Only admins and the user themselves can access their profile. Anyone can create a user but only admins can delete users.posts
: Everyone can access published posts, but only admins can create, update, or delete them. Some posts may also have content that is only accessible to users who are logged in. See Premium Content for more details.projects
: Everyone can access published projects, but only admins can create, update, or delete them.pages
: Everyone can access published pages, but only admins can create, update, or delete them.comments
: Everyone can access published comments, but only admins can access draft comments. Users can create new comments but they will be saved as drafts until an admin approves them.
For more details on how to extend this functionality, see the Payload Access Control docs.
Before deploying your app, you need to:
- Ensure your app builds and serves in production. See Production for more details.
The easiest way to deploy your project is to use Payload Cloud, a one-click hosting solution to deploy production-ready instances of your Payload apps directly from your GitHub repo. You can also deploy your app manually, check out the deployment documentation for full details.
If you have any issues or questions, reach out to us on Discord or start a GitHub discussion.