Backend
Deploying the backend#
You need Node.js 20+ and a PostgreSQL database. A managed Postgres (Supabase, Neon, your provider's) is the quickest route; one in Docker is fine too.
Get the code#
Clone it: git clone https://codeberg.org/pee/backend
Enter the directory: cd backend
Copy the config: cp .env.example .env
Fill in the two required values — see configuration.
Generate CRYPTO_SECRET once and keep it. Changing it later makes every
existing account's data permanently unreadable. There is no recovery.
Docker#
docker build -t pstream-backend .
docker run -d -p 3000:3000 --env-file .env pstream-backendDatabase migrations run automatically on start.
Node#
npm ci
npx prisma generate
npx prisma migrate deploy
npm run build
npm run previewNixpacks#
Works out of the box with Dokploy and Coolify. Manually:
curl -sSL https://nixpacks.com/install.sh | bash # or: brew install nixpacks
nixpacks build . --name pstream-backend
docker run -d -p 3000:3000 --env-file .env pstream-backendCheck it works#
curl http://localhost:3000/healthYou should get {"status":"ok","database":"up"}. If database says anything
else, DATABASE_URL is wrong or Postgres isn't reachable from the container.
Point P-Stream at it#
Put it behind HTTPS first, then on pstream.cfd:
Enter the URL and pick it under Select Backend Server.
Register an account there and your data syncs to your own instance from then on. Accounts are per backend, so an account on one is not an account on another.
Already have data on another backend? Migrate my data, on that same screen, moves it across rather than starting empty.