Manual Installation (Developers)

Use this method if you want to run POSVelo directly with npm — for development, debugging or customising the source. If you just want to run the product, use the much simpler Docker setup instead.

You run the backend and frontend as two separate processes. You can provide PostgreSQL and Redis either with Docker (easiest) or by installing them natively.

Step 1 — Provide PostgreSQL & Redis

Easiest: Docker for the databases only

Run PostgreSQL and Redis as two standalone containers (any password you choose; the data survives restarts in the named volumes):

docker run -d --name posvelo-postgres \
  -e POSTGRES_DB=posvelo -e POSTGRES_USER=posvelo \
  -e POSTGRES_PASSWORD=change-me \
  -p 5432:5432 -v posvelo_pg_data:/var/lib/postgresql/data \
  postgres:16-alpine

docker run -d --name posvelo-redis \
  -p 6379:6379 -v posvelo_redis_data:/data \
  redis:7-alpine

This starts PostgreSQL on 5432 and Redis on 6379. (On Windows PowerShell, paste each command on one line without the \ continuations.) Later you can stop/start them with docker stop posvelo-postgres posvelo-redis and docker start posvelo-postgres posvelo-redis.

Or: install them natively

  • PostgreSQL 16 — create a database:
    psql -U postgres
    CREATE DATABASE posvelo;
    \q
    
  • Redis 7:
    # Ubuntu/Debian
    sudo apt install redis-server && sudo systemctl start redis
    # macOS (Homebrew)
    brew install redis && brew services start redis
    

Step 2 — Configure & start the Backend

cd Backend
cp .env.example .env        # Windows: copy .env.example .env

Open .env and set at least:

NODE_ENV=development
PORT=5000

DATABASE_URL=postgresql://postgres:postgres@localhost:5432/posvelo?schema=public
REDIS_URL=redis://localhost:6379

JWT_ACCESS_SECRET=<random 64-char string>
JWT_REFRESH_SECRET=<different random 64-char string>
MASTER_ENCRYPTION_KEY=<run: openssl rand -hex 32>

CORS_ORIGINS=http://localhost:3000
SETUP_ACCESS_CODE=<any secret code you choose>

Match DATABASE_URL to your database. If you used the two docker run commands from Step 1, the database is posvelo with user posvelo on localhost:5432, and the password is whatever you set as POSTGRES_PASSWORD. So the URL is postgresql://posvelo:<POSTGRES_PASSWORD>@localhost:5432/posvelo?schema=public.

Generate secrets with:

node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"

Install dependencies, apply migrations and start:

npm install
npx prisma generate
npx prisma migrate deploy
npm run dev          # starts on http://localhost:5000
npm run dev:worker   # in a second terminal: scheduled reports and nightly jobs

Optional demo data: npm run db:seed loads a fully populated sample shop (see First-Time Setup for the demo logins). Skip it for a clean install and use the setup wizard.

Keep this terminal open.

Step 3 — Configure & start the Frontend

Open a second terminal:

cd Frontend
cp .env.example .env        # Windows: copy .env.example .env

Set in Frontend/.env:

NEXT_PUBLIC_TEST_MODE=false
NEXT_PUBLIC_API_URL=http://localhost:5000/api/v1

NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME=<your cloudinary cloud name>
NEXT_PUBLIC_CLOUDINARY_UPLOAD_PRESET=<your unsigned upload preset>
CLOUDINARY_API_KEY=<your cloudinary api key>
CLOUDINARY_API_SECRET=<your cloudinary api secret>

Cloudinary fields may be left blank to start (uploads disabled). See Configuration.

Install and start:

npm install
npm run dev          # starts on http://localhost:3000

Step 4 — Open and set up

Go to http://localhost:3000 and complete the first-run wizard (First-Time Setup).

Open the frontend URL; the setup wizard appears until the first business exists.

Useful backend scripts

CommandPurpose
npm run devStart the API with hot reload
npm run buildCompile to dist/
npm startRun the compiled production build
npm run worker / npm run dev:workerRun the background jobs (scheduled reports, ledger posting, loyalty expiry, HR sweeps)
npm run db:migrateCreate/apply a migration (dev)
npm run db:migrate:prodApply migrations (production)
npm run db:seedLoad demo data
npm run db:studioOpen Prisma Studio (visual DB browser)
npm testRun the test suite
npm run lint / npm run typecheckQuality checks