Skip to content

Setup on macOS

This guide explains how to run website-nextjs locally on a MacBook.

1) Install required tools

Install Homebrew (see https://brew.sh/) if it is not already installed:

bash
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Install project dependencies:

bash
brew install postgresql@18 nvm git gh pnpm

Install and use Node 22:

bash
nvm install 22
nvm use 22

2) Clone the repository

Authenticate GitHub CLI and clone the repo:

bash
gh auth login
gh repo clone prezly/website-nextjs
cd website-nextjs

3) Configure environment variables

Create local environment file:

bash
cp .env.example .env.local

Set database connection in .env.local (replace the password):

dotenv
POSTGRES_URL=postgres://website_user:change_me_strong_password@127.0.0.1:5432/website?sslmode=disable

Also set required secrets such as PAYLOAD_SECRET and WEBSITE_REVALIDATION_SECRET.

4) Prepare PostgreSQL

Make sure PostgreSQL is running:

bash
brew services start postgresql@18

Create the local role and database:

bash
psql postgres <<'SQL'
CREATE ROLE website_user WITH LOGIN PASSWORD 'change_me_strong_password';
CREATE DATABASE website OWNER website_user;
GRANT ALL PRIVILEGES ON DATABASE website TO website_user;
SQL

Grant schema permissions:

bash
psql postgres://website_user:change_me_strong_password@127.0.0.1:5432/website <<'SQL'
GRANT ALL ON SCHEMA public TO website_user;
ALTER SCHEMA public OWNER TO website_user;
ALTER DEFAULT PRIVILEGES IN SCHEMA public
GRANT ALL ON TABLES, SEQUENCES, FUNCTIONS TO website_user;
SQL

Restore latest local DB dump:

bash
./scripts/db-restore-latest.sh

If script execution fails with permissions, run:

bash
chmod +x ./scripts/*.sh

5) Install dependencies and run the app

bash
pnpm install
pnpm dev

Open http://localhost:3000. Payload admin is available at /admin.