sree22 downloadsRemote backups and version restoration to PocketBase REST API backed by an sqlite database.
Backup plugin for storing Obsidian notes in PocketBase (SQLite database)
Versioned remote backups and restoration for Obsidian notes using the PocketBase API and its embedded SQLite database.
Automatic vault events - modification, renames, and deletions - are mirrored to the remote instance. For modifications, each entry stores a content-derived snapshot or diff that links the current version to its predecessor. Historical versions can be viewed in the right sidebar of a note.
The left sidebar provides a plugin ribbon icon with with three actions for the active note:
The plugin settings tab provides vault-wide actions:
Manual Installation:
Download the three files main.js, manifest.json and styles.css from the latest release and copy into .obsidian/plugins/obpb-backup/.
Open "Settings" > "Community plugins" in Obsidian and click the small reload button to the right of the title "Installed plugins".
You need to enter the base url to the pocketbase instance. And set the email/password of a user from Pocketbase. If you haven't configured Pocketbase yet, follw the instrauctions from the below pocketbase sections, and come back with the email and password of a created user.
Open "Community plugins" > "OBPB Backup".
Download the source code from https://github.com/sukum/OBPB-Backup/archive/refs/heads/master.zip. Unzip it, and find the folder named pocketbase in OBPB-Backup-master/pocketbase. We will use it next to setup the pocketbase database schema.
Option A: PocketBase already installed
If pocketbase is already installed and configured, you just need to upload the schema and create a user.
To upload the schema
pocketbase/pb_schema.json from the above downloaded zip file.Create a user from "Collections" > "users". Note the email and password of the created user, as we need to use it in the obsidian plugin settings tab.
Since pocketbase allows a user to be registered via API by default, remember to lock it down. Not needed for the plugin to work though.
Option B: Standalone binary
https://github.com/pocketbase/pocketbase
Download the PocketBase binary for your operating system from pocketbase.io or GitHub releases, unzip it, and place the pocketbase executable into a directory on your PATH.
https://pocketbase.io/docs/going-to-production/
Pocketbase documentation on setting it up. It provides instructions on creating a systemd service, setting up a reverse proxy using nginx/caddy, a Dockerfile to assemble a docker image.
Follow the below instructions to initialize pocketbase for this plugin.
Create the initial pocketbase directory structure. Note that the user under whom you intend pocketbase to be run needs to have write permissions for this directory.
mkdir ./pocketbase
# mkdir /opt/pocketbase # or any dir you prefer
cd pocketbase
Copy pb_migrations from the downloaded OBPB-Backup-master/pocketbase directory to this directory.
# Assuming you unzipped the latest release to home
cp -Rf ~/OBPB-Backup-master/pocketbase/pb_migrations .
Create the directory where pocketbase will store its internal sqlite database files.
mkdir pb_data
Set a pocketbase user to be automatically created by pocketbase on migration.
This user details need to be later added to the obsidian plugin in its settings tab under "Server account", to connect the plugin to this pocketbase instance.
User auth passed as environment variables for the migration script. Change them to your own.
export POCKETBASE_USER_EMAIL="[email protected]"
# Password should be at least 8 chars long or it will fail
export POCKETBASE_USER_PASSWORD="testpassword"
Create the superuser
To login to Pocketbase web UI, you will need a superuser. The above normal user cannot login to the web UI. A superuser is not necessarily needed for this plugin's working as long as the migration of the schema and the user creation is successful.
Pocketbase upsert sub-command will create a new record or update the password if it is already present.
Remember to change the email and password (atleast 8 chars) before running below command.
pocketbase superuser upsert "[email protected]" "AdminPassword" --dir ./pb_data
Starting pocketbase
Local access (Pocketbase and Obsidian on the same computer)
pocketbase serve --http 127.0.0.1:8090 --migrationsDir ./pb_migrations --dir ./pb_data
Pocketbase Web UI: http://127.0.0.1:8090/_/
Obsidian plugin settings url: http://127.0.0.1:8090
Remote access
pocketbase serve --http 0.0.0.0:8090 --migrationsDir ./pb_migrations --dir ./pb_data
Pocketbase Web UI - http://IP-Address:8090/_/
URL to be provided in the obsidian plugin settings - http://IP-Address:8090
Option B: Docker or Podman
Pocketbase does not provide an official image for docker/podman.
There is a third party image available from the github repo adrianmusante/docker-pocketbase. Docker image: https://hub.docker.com/r/adrianmusante/pocketbase
The rest of the instructions are for using this docker image.
Schema migration
Copy the folder pocketbase/pb_migrations to a local folder. Mount it to docker/podman as --volume ./pb_migrations:/pocketbase/migrations for pocketbase to automatically migrate the schema.
User auth passed as environment variables for the migration script. Change them to your own.
export POCKETBASE_USER_EMAIL="[email protected]"
# Password should be at least 8 chars long or it will fail
export POCKETBASE_USER_PASSWORD="testpassword"
Public registration is enabled to the world in pocketbase by default. The migration 002_auth_users_create_locked.js disables public registration. Otherwise anyone with access to the Pocketbase URL can create a user and read/write to the API.
podman run -d \
--name pocketbase \
-p 8090:8090 \
--user "$(id -u):$(id -g)" \
--userns=keep-id \
--env [email protected] \
--env POCKETBASE_ADMIN_PASSWORD=password \
--env [email protected] \
--env POCKETBASE_USER_PASSWORD=yourpassword \
--volume ./pb_migrations:/pocketbase/migrations:Z \
--volume ./pb_data:/pocketbase/data:Z \
docker.io/adrianmusante/pocketbase:0.40
docker run -d \
--name pocketbase \
-p 8090:8090 \
--user "$(id -u):$(id -g)" \
--env [email protected] \
--env POCKETBASE_ADMIN_PASSWORD=password \
--env [email protected] \
--env POCKETBASE_USER_PASSWORD=yourpassword \
--volume ./pb_migrations:/pocketbase/migrations \
--volume ./pb_data:/pocketbase/data \
docker.io/adrianmusante/pocketbase:0.40
Explained above Connect Obsidian to Pocketbase
npm install
npm run build
Copies of manifest.json, main.js and styles.css from the root folder should be placed in your-vault-path/.obsidian/plugins/obpb-backup/.
If you face errors during the installation, you can reach out via IRC to me at [email protected].
AI (Gemini and ChatGPT) has been used in developing the plugin. The tests have largely been built using AI.
Released under the MIT License.