Manual setup and deployment

Running Liyaqa on your own server with a production build, a process manager and a reverse proxy.

Production build

npm ci
cp .env.example .env        # then edit it (see Environment variables)
npx prisma generate
npx prisma db push
npm run db:seed             # creates the head coach; sample data only on an empty database
npm run build
npm start                   # listens on port 3306

For a real gym you may not want the 30 sample members. Create the database, run the seed once (it also creates the head coach), then remove the sample accounts in Coach > Members (deactivate) or start from an empty database and change prisma/seed.mjs to stop after ensureHeadCoach().

Keep it running

Use any process manager. With PM2:

pm2 start npm --name liyaqa -- start
pm2 save

Or a systemd unit with WorkingDirectory=/srv/liyaqa, ExecStart=/usr/bin/npm start and Restart=always.

Reverse proxy (HTTPS)

Put Nginx, Apache or Caddy in front and forward to http://127.0.0.1:3306. Pass the client address so the rate limits work per visitor:

location / {
  proxy_pass http://127.0.0.1:3306;
  proxy_set_header Host $host;
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_set_header X-Forwarded-Proto $scheme;
  client_max_body_size 10m;   # progress photos
}

Set SITE_URL="https://your-gym.om"; session cookies are then marked Secure.

Files that must survive updates

Path What
prisma/liyaqa.db the SQLite database (or use PostgreSQL, see Requirements)
storage/progress/ members' private progress photos
storage/media/ images uploaded by coaches
.env your settings and secrets

Set STORAGE_DIR to keep uploads outside the app folder, for example on a mounted volume.

Updating the code

git pull            # or copy the new files over, keeping the paths above
npm ci
npx prisma db push  # applies new columns; never use --force-reset on a live gym
npm run build
pm2 restart liyaqa

Backups

Copy prisma/liyaqa.db and storage/ every night. With SQLite, copy while the server is stopped or use sqlite3 liyaqa.db ".backup backup.db".