It is recommended to use pnpm as the package manager for this project. Assuming you have Node, pnpm can be activated by running:
corepack enable pnpm
Install dependencies:
pnpm install
Generate typescript types for PayloadCMS:
yarn generate
Generate PayloadCMS secret:
node -e "console.log(require('crypto').randomBytes(48).toString('hex'))"
Create a .env.local
file in the root directory using the .env.example
file as a template.
Run the MongoDB database:
docker compose up mongo -d
Run the web app:
yarn dev
Go to http://localhost:3000 to view the web app. Go to http://localhost:3000/admin to view the Payload CMS admin panel.
Whenever you make changes to the PayloadCMS configuration, you need to re-generate the types
yarn generate
Create a .env file with
MEDIA_PATH=<path/for/media>
MEDIA_PATH
is the path where media files will be stored. It should be a directory other than the project directory to ensure persistence of media files across container restarts. For example, you can use /srv/www/<domain>/media
with domain replaced with the actual domain name.
Then follows: [https://beease.fr/blog/guide-payload-nextjs-docker-vps]