This template comes configured with the bare minimum to get started on anything you need.
This template can be deployed directly from our Cloud hosting and it will setup MongoDB and cloud S3 object storage for media.
To spin up this template locally, follow these steps:
After you click the Deploy button above, you'll want to have standalone copy of this repo on your machine. If you've already cloned this repo, skip to Development.
-
First clone the repo if you have not done so already
-
cd my-project && cp .env.example .envto copy the example environment variables. You'll need to add theMONGODB_URLfrom your Cloud project to your.envif you want to use S3 storage and the MongoDB database that was created for you. -
pnpm install && pnpm devto install dependencies and start the dev server -
open
http://localhost:3000to open the app in your browser
That's it! Changes made in ./src will be reflected in your app. Follow the on-screen instructions to login and create your first admin user. Then check out Production once you're ready to build and serve your app, and Deployment when you're ready to go live.
If you prefer to use Docker for local development instead of a local MongoDB instance, the provided docker-compose.yml file can be used.
To do so, follow these steps:
- Modify the
MONGODB_URLin your.envfile tomongodb://127.0.0.1/<dbname> - Modify the
docker-compose.ymlfile'sMONGODB_URLto match the above<dbname> - Run
docker-compose upto start the database, optionally pass-dto run in the background.
The Payload config is tailored specifically to the needs of most websites. It is pre-configured in the following ways:
See the Collections docs for details on how to extend this functionality.
-
Users are auth-enabled collections that have access to the admin panel.
For additional help, see the official Auth Example or the Authentication docs.
-
This is the uploads enabled collection. It features pre-configured sizes, focal point and manual resizing to help you manage your pictures.
Alternatively, you can use Docker to spin up this template locally. To do so, follow these steps:
- Follow steps 1 and 2 from above, the docker-compose file will automatically use the
.envfile in your project root - Next run
docker-compose up - Follow steps 4 and 5 from above to login and create your first admin user
That's it! The Docker instance will help you get up and running quickly while also standardizing the development environment across your teams.
To deploy this application on Coolify, follow these steps:
- In Coolify, go to Resources → New → Database → PostgreSQL
- Configure the database:
- Name:
payload-db(or your preference) - Database:
payload - Username:
payload - Password: Generate a secure password
- Name:
- Deploy the database
- Note the Internal URL (e.g.,
postgres://payload:PASSWORD@payload-db:5432/payload)
- Go to Resources → New → Application
- Select your Git repository
- Choose Dockerfile as the build pack
- Set the Dockerfile path to
Dockerfile
Database migrations run during the Docker build, so you need to configure build arguments:
- Go to your application's Settings → Build
- Add these Build Arguments:
| Build Arg | Value |
|---|---|
DATABASE_URL |
Internal PostgreSQL URL from Step 1 |
PAYLOAD_SECRET |
Random 32+ character string (generate with openssl rand -base64 32) |
Add the same values as runtime environment variables:
| Variable | Value |
|---|---|
DATABASE_URL |
Same as build arg |
PAYLOAD_SECRET |
Same as build arg |
- Set the Exposed Port to
3000 - Configure your domain/subdomain
- Enable HTTPS (Let's Encrypt)
- Click Deploy
- Migrations will run automatically during the build
- Access
/adminto create your first admin user
Note: Ensure both the PostgreSQL database and your app are on the same Coolify network so they can communicate via the internal hostname.
If you have any issues or questions, reach out to us on Discord or start a GitHub discussion.