Deploy PocketBase - an open source backend in 1 file - on DigitalOcean App Platform.
PocketBase is an open source Go backend that includes:
- Embedded database (SQLite) with realtime subscriptions
- Built-in files and users management
- Convenient Admin dashboard UI
- Simple REST-ish API
Click the button above to deploy PocketBase to DigitalOcean App Platform in one click.
Once deployed, you need to use PocketBase to build applications. Here's how:
Important: The admin UI is not accessible until you create a superuser via the console.
To create your first admin account:
-
In your DigitalOcean dashboard:
- Go to Apps
- Click on your PocketBase app
- Click on your service component (e.g., "pocketbase")
- Click the Console tab
- Click Run command
-
Run this command in the console:
./pocketbase superuser create your-email@example.com your-password
-
After creating the superuser, access the admin UI at:
https://your-app-url.ondigitalocean.app/_/
We've built a complete working example to show you how to use PocketBase:
# Download the example
curl -O https://raw.githubusercontent.com/AppPlatform-Templates/pocketbase-appplatform/main/examples/todo-app.html
# Update the PocketBase URL in the file (line 169)
# Then open in browser
open todo-app.htmlFeatures demonstrated:
- User authentication (sign up, login)
- CRUD operations (create, read, update, delete)
- Realtime updates
- User-specific data
Follow our comprehensive guide:
📖 Complete Usage Guide: USING_POCKETBASE.md
This guide includes:
- Step-by-step setup instructions
- Creating collections (database tables)
- Setting up security rules
- Building a complete Todo app
- User authentication
- Realtime subscriptions
- File uploads
- Code examples (HTML, React)
Download and run ready-to-use example applications.
This deployment uses:
- Service Component: PocketBase Go application
- Instance Size: apps-s-1vcpu-1gb (1 vCPU, 1GB RAM) - $12/month
- Region: NYC (customizable to any DO region)
- Database: SQLite (ephemeral) - see production notes below
- PocketBase Version: v0.31.0 (pinned for stability)
This deployment is pinned to PocketBase v0.31.0 for stable, predictable builds.
- ✅ Stable builds: Won't break if the master branch has issues
- ✅ Predictable: Same version every time
- ✅ Tested: Version 0.31.0 is a stable release
To upgrade to a newer version of PocketBase:
-
Update the Dockerfile:
ARG POCKETBASE_VERSION=v0.32.0 # Change to desired version -
Or override via build args in
.do/app.yaml:build_command: docker build --build-arg POCKETBASE_VERSION=v0.32.0 -t $IMAGE_NAME .
-
Redeploy your app
Check PocketBase releases for available versions.
- Admin UI at
/admin - REST API at
/api - Realtime subscriptions
- File uploads and management
- User authentication and authorization
- JavaScript hooks support (via jsvm plugin)
- Click the "Deploy to DO" button above
- Sign in to your DigitalOcean account
- Review the configuration
- Click "Deploy"
- Wait for the build to complete (~5-10 minutes)
- Access your PocketBase instance at the provided URL
- Fork this repository
- Go to DigitalOcean App Platform
- Click "Create App"
- Select your forked repository
- App Platform will auto-detect the Dockerfile
- Review and deploy
# Install doctl if you haven't
# https://docs.digitalocean.com/reference/doctl/how-to/install/
# Create app from spec
doctl apps create --spec .do/app.yaml
# Or update existing app
doctl apps update YOUR_APP_ID --spec .do/app.yamlThe following environment variables can be configured:
| Variable | Default | Description |
|---|---|---|
PB_LOG_LEVEL |
info |
Log level: debug, info, warn, error |
You can add more environment variables in the App Platform dashboard or in the .do/app.yaml file.
To use a custom domain:
- Go to your app in the DigitalOcean control panel
- Navigate to "Settings" → "Domains"
- Add your custom domain
- Update your DNS records as instructed
Once deployed, you can access:
- Admin UI:
https://your-app-url.ondigitalocean.app/_/ - API:
https://your-app-url.ondigitalocean.app/api/ - Health Check:
https://your-app-url.ondigitalocean.app/api/health
- Create your admin account via the App Platform Console (see "Create Your Admin Account" section above)
- Navigate to the Admin UI at
/_/ - Start creating collections and configuring your backend
- Storage: Ephemeral SQLite database
- Location:
/app/pb_data/data.db - Limit: 2GiB total ephemeral storage
- Warning:
⚠️ Data is lost on each deployment
This setup is ideal for:
- Testing and experimentation
- Development environments
- Demos and proof-of-concepts
For production use with persistent data, you have two options:
Litestream provides continuous replication of your SQLite database to DigitalOcean Spaces. This template includes built-in Litestream support:
- Automatic backups: Continuously replicates your database to object storage
- Disaster recovery: Automatically restores from backup on container restart
- Easy setup: Just configure environment variables (see Production Setup section below)
Note: PocketBase only supports SQLite databases. It does not support PostgreSQL or other database engines.
DigitalOcean App Platform will support persistent volumes via NFS will likely be available in early 2026. Once available, you can mount persistent storage for the SQLite database directly.
See PRODUCTION.md for detailed Litestream setup and production hardening steps.
Litestream is a streaming replication tool for SQLite databases. It continuously backs up your database to object storage (DigitalOcean Spaces) and can automatically restore it on container restart.
- Automatic Backups: Continuous replication to DigitalOcean Spaces
- Disaster Recovery: Auto-restore database when container restarts
- Cost-Effective: ~$5/month for Spaces vs $15/month for managed database
- Zero Downtime: Replication happens in the background
- SQLite Performance: Keep using fast local SQLite with cloud backup
Step 1: Create a DigitalOcean Space
- Go to DigitalOcean Spaces
- Click Create a Space
- Choose a region (e.g.,
nyc3) - Name your space (e.g.,
my-pocketbase-backups) - Click Create a Space
Step 2: Generate API Keys
- Go to API Tokens
- Scroll to Spaces access keys
- Click Generate New Key
- Name it (e.g.,
pocketbase-litestream) - Save the Access Key and Secret Key (you'll need these)
Step 3: Configure Environment Variables
In your App Platform dashboard:
-
Go to your PocketBase app
-
Click Settings → App-Level Environment Variables
-
Add these three variables:
Key Value Type LITESTREAM_ACCESS_KEY_IDYour Spaces access key Secret LITESTREAM_SECRET_ACCESS_KEYYour Spaces secret key Secret REPLICA_URLs3://YOUR-SPACE-NAME.REGION.digitaloceanspaces.com/pocketbase-dbRegular Replace:
YOUR-SPACE-NAMEwith your actual space nameREGIONwith your space region (e.g.,nyc3)
-
Click Save and redeploy your app
That's it! Your database is now being backed up continuously to DigitalOcean Spaces.
Check your app logs to confirm Litestream is working:
doctl apps logs YOUR_APP_ID --type runYou should see:
✓ Litestream environment variables detected
Starting PocketBase with Litestream replication...
You can also check your Space in the DO dashboard - you should see backup files appearing.
Litestream automatically restores your database when the container starts. If your database is lost (e.g., after redeployment), Litestream will:
- Detect the missing database
- Restore it from the latest backup in Spaces
- Start PocketBase with your data intact
No manual intervention required!
- Spaces Storage: $5/month for 250 GB + 1 TB transfer
- Typical Usage: < 1 GB for most PocketBase databases
- Total: ~$5/month for production-grade backups
Backups not working?
- Check environment variables are set correctly
- Verify your Spaces access key has write permissions
- Check logs for Litestream errors:
doctl apps logs YOUR_APP_ID --type run
Database not restoring?
- Ensure
REPLICA_URLmatches your Space name and region - Check that backup files exist in your Space
- Look for restoration logs on container startup
For more details, see PRODUCTION.md and the Litestream documentation.
Upgrade to larger instance sizes:
apps-s-2vcpu-4gb- 2 vCPU, 4GB RAM - $24/monthapps-s-4vcpu-8gb- 4 vCPU, 8GB RAM - $48/month
For dedicated CPU instances, enable autoscaling:
instance_count: 1
autoscaling:
min_instance_count: 1
max_instance_count: 5
metrics:
cpu:
percent: 80App Platform provides built-in monitoring:
- Metrics: CPU, memory, request rate in the "Insights" tab
- Logs: Real-time logs in the "Logs" tab
- Alerts: Configure alerts in the "Settings" tab
Check the build logs in the App Platform console. Common issues:
- Go version mismatch (requires Go 1.23+)
- Build timeout (increase in app spec if needed)
Check the runtime logs:
- Verify the port is set to 8080
- Ensure health check endpoint is accessible
- Check environment variables are set correctly
PocketBase uses SQLite:
- Remember data is ephemeral without Litestream backups
- Check you're not exceeding 2GiB local storage
- If using Litestream, verify environment variables are set correctly
- Check Litestream logs for replication errors
- Monitor CPU/memory usage in Insights
- Consider upgrading instance size
- Check Litestream replication is not causing bottlenecks
- Service: $12/month (apps-s-1vcpu-1gb)
- Total: ~$12/month
- Service: $12/month (apps-s-1vcpu-1gb)
- DigitalOcean Spaces: $5/month (250 GB storage + 1 TB transfer)
- Total: ~$17/month
- Ephemeral Storage: Only 2GiB, wiped on each deployment. Must use litestream for streaming backup to DigitalOcean Spaces
- No Persistent Volumes: Until early 2026 NFS support
- No SSH Access: App Platform is a managed PaaS
- Build Timeout: 1 hour maximum
- Region: Must choose from available App Platform regions
For PocketBase-specific issues:
For App Platform issues:
PocketBase is licensed under the MIT License.