xbsapi: An Alternative xBrowserSync API that supports SQLite, PostgreSQL and MySQL
xbsapi is an alternative xBrowserSync API built in Go, that supports SQLite, PostgreSQL and MySQL and can easily be deployed as a single binary on Linux, OpenBSD, FreeBSD, Dragonfly, NetBSD, Windows and even as a Google Cloud Function and AWS Lambda Function!
While I keep most of my bookmarks publicly available on this site, so that I can look them up anywhere, anytime, I still have to deal with a handful of bookmarks to private infrastructure, financial services and such that I’d rather not share. Keeping those in sync is quite tiring, so I decided to give xBrowserSync a try. Unfortunately the API service is a Node.js project that requires a MongoDB, making it relatively cumbersome to self-host. Hence I decided to basically rebuild their backend with something that’s a lot more lightweight.
xbsapi is a single binary drop-in replacement for the xBrowserSync API service that supports SQLite3, PostgreSQL and MySQL.
Deploying xbsapi is fairly easy: Either build it from source or download one of the readily built binaries. Alternatively you can also use one of the Docker images, which btw is not only available for 386 and amd64, but also armv6, armv7 and arm64.
xbsapi does not necessarily require a configuration, as the defaults are pretty
sane, yet it’s possible to configure the service using ENV variables or a TOML
config file. I recommend reverse proxying the service with some HTTP
server/proxy, e.g. relayd
:
table <xbsapi-default-host> { 127.0.0.1 }
http protocol xbsapi-https {
match request header append "X-Real-IP" value "$REMOTE_ADDR"
match request header append "Host" value "$HOST"
match request header append "X-Forwarded-For" value "$REMOTE_ADDR"
match request header append "X-Forwarded-By" value "$SERVER_ADDR:$SERVER_PORT"
match request path "/*" forward to <xbsapi-default-host>
tcp { nodelay, sack, backlog 128 }
tls keypair your.domain.com
tls { no tlsv1.0, ciphers HIGH }
}
relay xbsapi-https-relay {
listen on egress port 443 tls
protocol xbsapi-https
forward to <xbsapi-default-host> port 8000
}
If you do so make sure to limit xbsapi to only bind to 127.0.0.1
:
[Server]
BindIP = "127.0.0.1"
From that point on everything else is fairly similar to the regular setup of xBrowserSync clients. However, one small difference is the URL:
When running xbsapi instead of the official xBrowserSync server, you have to add
/api/v1
to the sync URL, e.g.:
https://your.domain.com/api/v1
Other than that sync behaviour will be identical to the official implementation.
If you’re using xBrowserSync already or are currently looking for a way to sync browser bookmarks across multiple devices, xbsapi might be for you! Find more information and documentation on GitHub.
Happy syncing!
PS: Check this as well as this if you’re curious to know how I usually access my bookmarks that are stored in Markdown format.
Enjoyed this? Support me via Monero, Bitcoin, Lightning, or Ethereum! More info.