Skip to content

Commands

Everything, in one place.

Setup

bash
corepack enable && corepack prepare pnpm@9.0.0 --activate
pnpm install
docker compose up -d db redis            # add `livekit` for voice work
cd packages/database && pnpm db:generate && pnpm db:migrate && pnpm db:seed && cd ../..
pnpm build

Development

bash
pnpm dev                                 # api + esu + ogun + mobile
pnpm dev:all                             # everything

pnpm --filter @playpals/api dev
pnpm --filter @playpals/esu dev
pnpm --filter @playpals/ogun dev
pnpm --filter @playpals/anansi dev
pnpm --filter @playpals/igdb-heartbeat dev
pnpm --filter @playpals/web dev
pnpm --filter @playpals/docs dev

pnpm --filter @playpals/mobile ios
pnpm --filter @playpals/mobile android
pnpm --filter @playpals/mobile start -- --clear    # clear the Metro cache

Build and quality

bash
pnpm build
pnpm build --filter=@playpals/db
turbo build --filter=@playpals/api

pnpm check-types                         # tsc --noEmit everywhere
pnpm lint
pnpm format                              # prettier --write

cd apps/ogun   && pnpm test
cd apps/anansi && pnpm test

Database

bash
cd packages/database

pnpm db:generate                         # regenerate the Prisma client
pnpm db:migrate                          # create + apply a migration (dev)
pnpm db:deploy                           # apply only (production)
pnpm db:seed
pnpm db:push                             # no migration file — local experiments only

pnpm exec prisma studio                  # browse data
pnpm exec prisma migrate status
pnpm exec prisma validate
pnpm exec prisma format

Reset locally:

bash
docker compose down -v && docker compose up -d db redis
cd packages/database && pnpm db:migrate && pnpm db:seed

Docker

bash
docker compose up -d db redis livekit
docker compose ps
docker compose logs db --tail 50
docker compose down                      # stop
docker compose down -v                   # stop and delete volumes

./start-dev.sh                           # live-reload backend in containers
./start-dev.sh -d api

Redis

bash
docker exec -it playpals-redis redis-cli -a playpalz

KEYS 'bull:media-processing:*'
LLEN 'bull:media-processing:wait'
LRANGE 'bull:media-processing:failed' 0 -1
KEYS 'feed|u:*'
FLUSHDB                                  # local only

Build and push images

bash
doctl registry login

./scripts/build-api.sh [tag]
./scripts/build-web.sh [tag]
./scripts/build-esu.sh [tag]
./scripts/build-ogun.sh [tag]
./scripts/build-anansi.sh [tag]
./scripts/build-igdb-heartbeat.sh [tag]
./scripts/build-all.sh [tag]

Kubernetes

bash
doctl kubernetes cluster kubeconfig save playpalz-production-k8s
# or: cd infra/terraform && make kubeconfig

kubectl get pods
kubectl get deployments
kubectl get services
kubectl get ingress
kubectl get certificate
kubectl get hpa

kubectl logs -l app=playpalz-api --tail=100 -f
kubectl logs <pod> --previous                  # logs from a crashed container
kubectl describe pod <pod>
kubectl exec -it <pod> -- sh

kubectl apply -f infra/k8s/api-deployment.yaml
kubectl rollout restart deployment/playpalz-api
kubectl rollout status  deployment/playpalz-api
kubectl rollout undo    deployment/playpalz-api
kubectl scale deployment/playpalz-api --replicas=5

kubectl top nodes
kubectl top pods
kubectl get events --sort-by=.lastTimestamp | tail -30

Terraform

bash
cd infra/terraform

./validate-setup.sh
make init
make plan
make apply
make output
make kubeconfig
make registry-login
make check-cluster
make check-db
make cost
make backup-state
make destroy                             # irreversible

Secrets

bash
kubectl create secret generic <name> \
  --namespace default \
  --from-literal=KEY='value' \
  --dry-run=client -o yaml \
| ./infra/k8s/sealed-secrets/seal.sh <name>

kubectl apply -f infra/k8s/sealed-secrets/<name>.yaml
kubectl rollout restart deployment/<consumer>

# back up the controller's private key — without it, sealed secrets are unrecoverable
kubectl get secret -n sealed-secrets \
  -l sealedsecrets.bitnami.com/sealed-secrets-key -o yaml > sealed-secrets-key-backup.yaml

Mobile builds

bash
cd apps/mobile

eas login
eas build  --profile development --platform ios
eas build  --profile preview     --platform all
eas build  --profile production  --platform all
eas submit --profile production  --platform all

npx expo run:ios                         # local native build

Migrations in production

bash
doctl databases backups list <database-id>

kubectl run prisma-migrate --rm -it \
  --image=registry.digitalocean.com/playpalzproduction/api:latest \
  --env="DATABASE_URL=$DATABASE_URL" \
  --restart=Never \
  -- npx prisma migrate deploy --schema packages/database/prisma/schema.prisma

Health checks

bash
curl http://localhost:4000/health
curl http://localhost:4010/health

curl https://api.playpalz.gg/health
curl https://socket.playpalz.gg/health
curl -I https://www.playpalz.gg

Utilities

bash
pnpm --filter @playpals/esu admin-ui:creds      # Socket.IO Admin UI credentials
ngrok http 4000                                 # expose local webhooks
lsof -i :4000                                   # what is on this port

# nuclear reinstall
rm -rf node_modules apps/*/node_modules packages/*/node_modules .turbo apps/*/.turbo packages/*/.turbo
pnpm install && cd packages/database && pnpm db:generate && cd ../.. && pnpm build

Internal documentation — PlayPalz platform