Skip to main content
PocketBase is a single executable file that you can deploy anywhere. This flexibility makes it suitable for various hosting environments, from traditional VPS servers to modern cloud platforms.

Deployment options

You can deploy PocketBase using several approaches:
  • Standalone binary: Download and run the PocketBase executable directly on your server
  • Docker container: Use containerization for consistent deployment across environments
  • Platform-as-a-Service: Deploy to platforms like Fly.io, Railway, or DigitalOcean App Platform
  • Traditional VPS: Run on virtual private servers from providers like AWS, Google Cloud, or DigitalOcean

System requirements

PocketBase has minimal system requirements:
  • Operating system: Linux, macOS, or Windows (restore functionality requires Unix-based systems)
  • Memory: As little as 256MB RAM for small applications
  • Storage: Depends on your data volume and backup strategy
  • Architecture: Supports amd64, arm64, and armv7
For production deployments, you should have at least 2x the size of your pb_data directory available as free disk space to safely perform backups.

Data directory structure

PocketBase stores all data in the pb_data directory:
Always back up the entire pb_data directory, not just the database files. The directory contains uploaded files and other critical data.

Running PocketBase

Start PocketBase with the serve command:
Common flags:
  • --http: Change the HTTP server address (default: 127.0.0.1:8090)
  • --dir: Specify a custom data directory (default: ./pb_data)
  • --publicDir: Set a custom public directory path
  • --hooksDir: Set a custom hooks directory path
  • --migrationsDir: Set a custom migrations directory path
Example with custom configuration:
Binding to 0.0.0.0 makes PocketBase accessible from external networks. Use 127.0.0.1 for local-only access.

Environment variables

PocketBase supports configuration through environment variables:
  • Encryption: Set the encryption key for sensitive settings
  • Data directory: Override the default data directory

Process management

For production deployments, use a process manager to ensure PocketBase runs continuously:

systemd (Linux)

Create a systemd service file at /etc/systemd/system/pocketbase.service:
Enable and start the service:

Docker

Create a Dockerfile:
Run with Docker:

Reverse proxy

In production, you should run PocketBase behind a reverse proxy like nginx or Caddy for:
  • SSL/TLS termination
  • Load balancing
  • Rate limiting
  • Static file serving

nginx example

Caddy example

Next steps

Going to production

Learn about production-specific configurations and best practices

Backups

Set up automated backups to protect your data

Migrations

Manage database schema changes with migrations