Payload requires the following software:
- Any JavaScript package manager (Yarn, NPM, or pnpm)
- Node.js version 16+
- Any compatible database (MongoDB or Postgres)
To quickly scaffold a new Payload app in the fastest way possible, you can use create-payload-app. To do so, run the following command:
npx create–payload–app@latest
Then just follow the prompts! You’ll get set up with a new folder and a functioning Payload app inside.
Adding Payload to either a new or existing TypeScript + Express app is super straightforward. To add to an existing app, just run npm install --save --legacy-peer-deps payload.
From there, the first step is writing a baseline config. Create a new payload.config.ts in your project’s /src directory (or whatever your root TS dir is). The simplest config contains the following:
import { buildConfig } from ‘payload/config’
2
3export default buildConfig({
4 // By default, Payload will boot up normally
5 // and you will be provided with a base `User` collection.
6 // But, here is where you define how you’d like Payload to work!
7})
Write the above code into your newly created config file. This baseline config will automatically provide you with a default User collection. For more information about users and authentication, including how to provide your own user config, jump to the Authentication section.
Although this is just the bare minimum config, there are many more options that you can control here. To reference the full config and all of its options, click here.