This guide walks you through setting up a complete PayD development environment on your local machine from scratch.
Make sure you have the following installed before starting:
| Tool | Minimum Version | Check |
|---|---|---|
| Node.js | 20+ | node --version |
| npm | 9+ | npm --version |
| PostgreSQL | 14+ | psql --version |
| Git | 2.30+ | git --version |
| Docker (optional) | 20+ | docker --version |
macOS shortcut: Install Node.js via
brew install nodeand PostgreSQL viabrew install postgresql@16
Windows: Use nvm-windows for Node.js and the PostgreSQL installer
git clone https://github.com/Gildado/PayD.git
cd PayDcp .env.example .envcp backend/.env.example backend/.envOpen backend/.env and fill in the required values:
# Database (required)
DATABASE_URL=postgresql://postgres:yourpassword@localhost:5432/payd_dev
# JWT (required — use a long random string)
JWT_SECRET=your-long-random-secret-here
# Stellar Network
STELLAR_NETWORK=TESTNET
HORIZON_URL=https://horizon-testnet.stellar.org
# Port
PORT=3001
NODE_ENV=developmentTip: Generate a strong JWT secret with
openssl rand -hex 64
# Start PostgreSQL (macOS with Homebrew)
brew services start postgresql@16
# Create the database
createdb payd_dev
# Run migrations
cd backend
npm run db:migratedocker run -d \
--name payd-postgres \
-e POSTGRES_PASSWORD=yourpassword \
-e POSTGRES_DB=payd_dev \
-p 5432:5432 \
postgres:16
cd backend
npm run db:migrate# Install backend dependencies
cd backend
npm install
# Install frontend dependencies (from repo root)
cd ..
npm installPopulate the database with sample data for development:
cd backend
npm run db:seedThis creates:
- A sample organization
- An employer account (
employer@payd.dev/password123) - A few sample employees
cd backend
npm run devThe API will be available at http://localhost:3001
# From the repo root
npm run devThe UI will be available at http://localhost:5173
Run both at once using two terminals, or install
concurrently:npm install -g concurrently concurrently "cd backend && npm run dev" "npm run dev"
curl http://localhost:3001/health
# Expected: {"status":"ok","database":"connected"}Open http://localhost:3001/api-docs in your browser to explore the Swagger UI.
# Backend tests
cd backend
npm test
# Frontend tests
cd ..
npm testPayD uses the Stellar testnet for development. You need a funded testnet account:
- Generate a keypair: visit https://laboratory.stellar.org/#account-creator
- Click Generate keypair and save your Secret Key
- Click Fund account using friendbot to get free testnet XLM
- Add to
backend/.env:STELLAR_SECRET_KEY=SXXXXXXXXXXXXX...
PostgreSQL is not running. Start it:
# macOS
brew services start postgresql@16
# Ubuntu/Debian
sudo systemctl start postgresql
# Docker
docker start payd-postgresRegenerate your JWT secret:
openssl rand -hex 64Update JWT_SECRET in backend/.env and restart the server.
Run migrations again:
cd backend
npm run db:migrateChange the port in backend/.env:
PORT=3002Make sure your testnet account is funded. Visit the friendbot URL:
https://friendbot.stellar.org?addr=YOUR_PUBLIC_KEY
PayD/
├── backend/ # Node.js / Express / Prisma API
│ ├── src/
│ │ ├── controllers/ # Route handlers
│ │ ├── services/ # Business logic
│ │ ├── middlewares/ # Auth, rate limiting, IP whitelist
│ │ ├── routes/ # Express routers
│ │ └── config/ # Database, env, Swagger
│ └── .env.example # Backend environment template
├── frontend/ # React + Vite frontend
│ └── src/
├── src/ # Shared frontend source
└── .env.example # Root environment template
| Command | Description |
|---|---|
cd backend && npm run dev |
Start the API server with hot reload |
npm run dev (root) |
Start the Vite frontend dev server |
cd backend && npm test |
Run backend test suite |
cd backend && npm run db:migrate |
Run database migrations |
cd backend && npm run db:seed |
Seed sample data |
cd backend && npm run build |
Build backend for production |
npm run build (root) |
Build frontend for production |
- Read the CONTRIBUTING.md for contribution guidelines
- Check ARCHITECTURE_DIAGRAM.md for system design
- Open a GitHub Issue if you're stuck