Docs

What PocketHost Adds to Your Instance

PocketHost runs the PocketBase version you choose, unmodified. To make it work well on PocketHost, it adds a few small files and settings when your instance starts. This page lists all of them.

Hooks and migrations

These files are added to your instance each time it starts. They’re read-only and don’t appear in your own files, so you won’t see them over the CLI or SFTP. They work on every PocketBase version PocketHost runs.

FileWhat it does
pb_hooks/_ph_admin_sync.pb.jsAdmin Sync. When it’s on, keeps your instance’s admin login the same as your PocketHost login. When it’s off, it does nothing.
pb_hooks/_ph_backup.pb.jsAdds the backup route, /api/ph/backup, for scheduled backups. It only answers PocketHost’s webhooks for your instance. Anyone else gets Unauthorized.
pb_hooks/_ph_lib.jsShared code for the hooks above.
pb_migrations/1699198734_pockethost_defaults.jsRuns once. Replaces PocketBase’s placeholder settings with your instance’s own: app name Acme becomes your instance name, the app URL becomes your instance URL, and the email sender becomes your instance name at <instance>@pockethost.io.
pb_migrations/1794167719_pockethost_app_url.jsRuns once. Sets the app URL on instances that still had PocketBase’s http://localhost:8090 placeholder, so links in verification and password reset emails work.

The migrations only replace PocketBase’s exact placeholder values. A setting you changed yourself is never touched. Like any migration, each one runs once and is recorded in PocketBase’s migration history.

Avoid giving your own files these names. PocketHost’s file takes the place of yours.

Environment variables

Your hooks can read these with $os.getenv() or process.env, along with your secrets.

VariableValue
PH_APP_NAMEYour instance name.
PH_INSTANCE_URLYour instance URL, such as https://myapp.pockethost.io.
PH_APEX_DOMAINpockethost.io.
PH_BACKUP_TOKENThe token the backup route checks. PocketHost’s webhooks send it for you.
ADMIN_SYNCPresent only when Admin Sync is on. Holds your login details for Admin Sync, with the password already hashed.
DEVtrue when Dev Mode is on (PocketBase 0.20.1 and newer), otherwise false.

PocketHost sets these after your secrets, so a secret with one of these names is replaced.

How PocketBase starts

Your instance starts with:

pocketbase serve --http 0.0.0.0:8090

PocketHost adds only two flags, and only when you turn on the matching feature:

You can’t pass other flags. Flags like --dir or --http would break how PocketHost keeps instances separate.

That’s everything

Apart from the admin login Admin Sync keeps up to date and the placeholder settings above, PocketHost doesn’t change your collections, records or settings. Two maintenance jobs, each documented on its own page, also touch your instance’s files:

  • Auto Vacuum compacts your database files while your instance is idle. Your data stays the same.
  • Older backups move to cold storage, leaving a .txt file with a download link in their place.