Skip to content

Payload CMS installation

Installing Payload CMS Locally and Restoring PostgreSQL Dump

Section titled “Installing Payload CMS Locally and Restoring PostgreSQL Dump”
  1. Unzip your Payload CMS project to a desired location, e.g.

    C:\Users\milan\Desktop\cosmus
  2. Install Dependencies. Open Command Prompt in the project folder and run:

    pnpm i
  3. Create PostgreSQL Database. Go to your PostgreSQL bin folder::

    cd "C:\Program Files\PostgreSQL\18\bin"
  4. Connect to PostgreSQL.

    psql -h 127.0.0.1 -U postgres

    Enter your password (postgres in this example) when prompted.

  5. Create the Database.

    CREATE DATABASE test1;
  6. Configure Payload CMS Set your PostgreSQL connection URL: inn .env

    DATABASE_URL=postgres://postgres:postgres@127.0.0.1:5432/test1
    PAYLOAD_SECRET=your_secret_key
    PORT=3000
  7. Generate Database Migration Before running the project locally, generate the migration files:

    npx payload migrate:create
  8. Run the Migration Apply the migrations to the database:

    npx payload migrate
  9. Start Payload CMS Locally

    Open Command Prompt in your project folder.

    Run:

    pnpm dev
  10. Open a browser and go to:

    Run:

    http://localhost:3000/admin

    You should see the Payload CMS admin interface with your restored data.

  1. Upload the project files. First, upload the botify.zip file to your VPS using FTP, SCP, or your preferred file transfer method.

    scp main.zip root@your-server-ip:/var/www/
  2. Unzip the project once uploaded.

    cd /var/www/
    sudo unzip cosmus.zip -d cosmus
  3. Navigate to the project directory.

    cd /var/www/cosmus
  4. Update the .env file with the correct credentials and configuration values.

    NEXT_PUBLIC_SERVER_URL=http://localhost:3000
    DATABASE_URL=postgresql://myuser:mypassword@localhost:5432/my_database
    PAYLOAD_SECRET=ca6091550caf2145f47f96a3
    SMTP_HOST=smtp.hostinger.com
    SMTP_USER=sales@codenik.in
    SMTP_PASS=Codenik@2026
    STRIPE_SECRET_KEY=sk_test_51XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_test_51Hxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    STRIPE_WEBHOOKS_SIGNING_SECRET=whsec_
    PAYLOAD_ENABLE_JOB_QUEUE=true
    WHATSAPP_API_KEY=codeNoVOvQNGJJvvMAVHSWBUaLTYKhyUoipNpODlZsWmpqaGMlDYvMoDXwSLCmeyonBa
    GOOGLE_CLIENT_ID=983564525535-54kfn8nhinmi0a1n66iqnp0c1uo8g374.apps.googleusercontent.com
    GOOGLE_CLIENT_SECRET=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
    NEXT_PUBLIC_GOOGLE_MAPS_API_KEY=AIzaSyCkeYNFGGgb-zQDLhAv24zgM8tj3Q84ylY
    BETTER_AUTH_SECRET=2cdca31f3a89046f740fe52150986b459203021948a30148acfef5f1cd61c0e8
    BETTER_AUTH_URL=https://payloadecommerce.codenik.in
    NEXT_PUBLIC_RAZORPAY_PUBLISHABLE_KEY=rzp_test_THp4wuoo6gL8Ql
  5. Run the following command to install all project dependencies.

    pnpm i
  6. Execute the initial database migrations.

    pnpm migrate
  7. Start the application.

    pnpm start
  8. Keep your Node.js application running continuously in the background with PM2.

    pm2 start pnpm -- start

    Note: Click Here PM2 Installation

Note: Botify Docker installation requires an extended license. Please contact us for more details.

  1. Upload the project files to your VPS using FTP, SCP, or your preferred transfer method.

    scp cosmus.zip root@your-server-ip:/var/www/
  2. Unzip the project once uploaded.

    cd /var/www/
    sudo unzip cosmus.zip -d cosmus
  3. Navigate to the project directory.

    cd /var/www/cosmus
  4. Open the Dockerfile in the root directory and update it with the correct port and configuration settings.

    FROM node:20-alpine AS builder
    RUN npm install -g pnpm
    WORKDIR /app
    COPY package.json pnpm-lock.yaml ./
    RUN pnpm install --frozen-lockfile
    ENV DATABASE_URL=postgres://postgres:postgres@db:5432/cosmos
    ENV NEXT_PUBLIC_SERVER_URL=https://beauty.codenik.in
    ENV PAYLOAD_SECRET=secret
    ENV NODE_ENV=production
    ENV PAYLOAD_DISABLE_DB_PUSH=true
    COPY . .
    RUN pnpm build
    FROM node:20-alpine AS prod
    WORKDIR /app
    COPY --from=builder /app/.next/standalone ./
    COPY --from=builder /app/public ./public
    COPY --from=builder /app/.next/static ./.next/static
    EXPOSE 3000
    ENV PORT=3000
    ENV NODE_ENV=production
    ENV PAYLOAD_DISABLE_DB_PUSH=true
    CMD ["node", "server.js"]
  5. Open docker-compose.yml in the root directory and update it with the correct port and configuration settings.

    services:
    payloadecommerce:
    build: .
    container_name: payload_ecommerce
    volumes:
    - ./public/uploads:/app/public/uploads
    ports:
    - "3005:3005"
    depends_on:
    db:
    condition: service_healthy
    migration:
    condition: service_completed_successfully
    restart: unless-stopped
    environment:
    NODE_ENV: production
    PAYLOAD_SECRET: secret
    DATABASE_URL: postgres://postgres:postgres@payload_db:5432/payloadecommerce7
    NEXT_PUBLIC_SERVER_URL: your domain name
    networks:
    - default-net
    migration:
    build: .
    container_name: payload_ecommerce_migration
    environment:
    NODE_ENV: production
    PAYLOAD_SECRET: ca6091550caf2145f47f96a3
    DATABASE_URL: postgres://postgres:postgres@payload_db:5432/payloadecommerce7
    depends_on:
    db:
    condition: service_healthy
    command: pnpm payload:migrate
    networks:
    - default-net
  6. Verify containers are running.

    sudo docker ps

    You should see containers for:

    • botify-web (Next.js app)
    • postgres
  7. Start the application using Docker.

    sudo docker compose up -d --build
  8. Access the application.

    http://yourdomain.com

    You will be automatically redirected to the onboarding page.

    Success

    Your Payload CMS cosmus template is now successfully installed and running in a secure, Dockerized environment.

  9. Create admin account.

    Onboarding

    Note: The first user typically has full administrative privileges and can create additional users and manage roles.