Overview
Sptfy.in uses a split-stack architecture:- Frontend: SvelteKit app deployed on Cloudflare Pages
- Backend: PocketBase running in Docker on a VPS
System Requirements
VPS (Backend)
The production instance runs on a 2 vCPU / 2 GB RAM / 20 GB disk VPS. This is sufficient for moderate traffic.
- 1 vCPU
- 1 GB RAM
- 10 GB disk space
- Ubuntu 20.04+ or Debian 11+ (other Linux distros work too)
- Public IPv4 address
- Root or sudo access
- Docker Engine 20.10+
- Docker Compose V2
- Git
- Nginx (for reverse proxy)
- curl (for health checks)
Cloudflare Account (Frontend)
You’ll need:- A Cloudflare account (free tier works)
- A domain configured in Cloudflare DNS
- Cloudflare Pages access
- Cloudflare Turnstile site (free, for bot protection)
Development Machine (Optional)
For local development:- Node.js 18+ (recommended: 20 LTS)
- pnpm 8+
- Git
Installation Steps
Clone the repository
Create a directory for PocketBase and clone the repo:
The production deployment uses
~/pb-docker as the working directory. The GitHub Actions deployment workflow expects this path.Set up Cloudflare Turnstile
Turnstile provides bot protection for the link creation form.
- Go to Cloudflare Dashboard → Turnstile
- Create a new site:
- Site name: sptfyin (or your domain)
- Domain: your-domain.com
- Widget mode: Managed
- Copy the Secret Key (you’ll need this for
.env) - Copy the Site Key (you’ll need this for frontend env vars)
Create environment file
Create a Edit the file and add your Cloudflare Turnstile secret:Save and exit (Ctrl+X, then Y, then Enter).
.env file in the ~/pb-docker directory:Verify Docker Compose configuration
Check the Key configuration points:
docker-compose.yml to understand the setup:- Image:
ghcr.io/muchobien/pocketbase:0.23.12 - Port:
8091:8090(host port 8091 maps to container port 8090) - Volumes: Persistent data in
./pb_data,./pb_public,./pocketbase/pb_hooks,./pocketbase/pb_migrations - Health check: HTTP check on
/api/healthevery 60 seconds - Timezone:
Asia/Jakarta(change if needed) - Environment:
CF_SECRET_KEYfrom.envfile
Start PocketBase
Launch the PocketBase container:Check the logs:You should see output indicating PocketBase is running. Press Ctrl+C to exit logs.
Next Steps
Now that PocketBase is installed:- Set up the database - Create admin account and configure collections
- Configure environment variables - Set up all required settings
- Deploy to production - Set up Nginx reverse proxy and Cloudflare Pages
Troubleshooting
Docker permission denied
Port 8091 already in use
Solution: Check what’s using the port:docker-compose.yml:
Container keeps restarting
Solution: Check the logs for errors:- Missing
.envfile or invalidCF_SECRET_KEY - Corrupted data in
./pb_data(delete and restart for fresh install) - Insufficient disk space (
df -hto check)