Linkding: Self Hosted Bookmark Manager

📆 · ⏳ 5 min read · ·

Introduction

Often when we are browsing the internet we come across some interesting articles or websites that we want to make sure we remember when we actually need them.

For a long time, I have been saving these links in my browser bookmarks on Firefox. But searching through those bookmarks is not very easy and I often forget that I have saved something there.

That’s when I started exploring about some self hosted bookmark managers. I came across a few of them and decided to try Linkding ↗️ and today I am going to share with you how I am using it and how you can setup it for yourself.

Linkding

From their homepage

🗃️

linkding is a bookmark manager that you can host yourself. It’s designed be to be minimal, fast, and easy to set up using Docker.

And boy, how true it is. I am currently running it as a Podman container with a SQLite database and it was indeed very fast and easy to setup.

The UI is very clean, they have an amazing browser extension (with shortcuts) and since its made with Django, we get a back office to manage the data and configs at much granular level if required.

Setup

As I have mentioned above, I am using Podman container and have a compose.yml file that I use to start the container which is pretty straightforward.

version: '3'
services:
linkding:
container_name: linkding
image: sissbruecker/linkding:latest
ports:
- 9090:9090
volumes:
- ./data:/etc/linkding/data
env_file:
- .env
restart: unless-stopped

And the .env file looks like this:

Terminal window
LD_SUPERUSER_NAME=myusername
LD_SUPERUSER_PASSWORD=mypassword

Once the container is up and running, you can access the UI at http://localhost:9090 and login with the credentials you have set in the .env file.

You have your self hosted version of Linkding up and running. Now you can start adding your bookmarks.

Linkding Goodies

But wait! This is not the end. I mentioned in the start about what good are the bookmarks if you are not able to find them when you actually need them.

Well, first of all the search within the UI is pretty good. But what if there was some way where I could pull results from my bookmarks when I search on Google or any other search engine. That would be amazing, right?

Well, thanks to Fivefold ↗️ for creating linkding-injector ↗️ which just does that. Also shoutout to u/Ankleson ↗️ for sharing about it on Reddit ↗️.

With linkding-injector the setup is perfect now and its much easier and helpful to search through my bookmarks.

There’s more! Well Akash, its great, but I am heavy mobile user as well and often come across some interesting links on my phone. What about that? I don’t want to keep logging in to the UI on my phone to add the links.

Well, Linkding have a solution for that as well which is to use HTTP Shortcuts. You can install the HTTP Shortcuts app from Playstore ↗️ or F-Droid ↗️.

Once installed, click on the three dots on the top right corner and click on Import / Export option. From there select the Import from URL option and enter the following URL:

https://raw.githubusercontent.com/sissbruecker/linkding/master/docs/linkding_shortcut.json

Now go back to main screen and again click on the three dots and now select the Variables option and update the linkding_instance and linkding_api_key for your self hosted instance.

And that’s it! Now you can add links to your Linkding instance from your phone as well, just click on share and select HTTP Shortcuts and then select Linkding and it will ask for tags, you can add some tags or choose the Untagged option and it will add the link to your Linkding instance.

This just completes the whole loop for me where I can add links from my phone, my laptop and then have them available to me when I try to search for anything on Google or any other search engine.

Backups

Well for using such a great app, It would make me really sad if I lose data due to some reason. Hence, backups are very important. I will share my backup strategy in this section.

So I have a simple script that I run every 3 days to backup the data and configs of Linkding. This abides with the suggested backup strategy ↗️ mentioned by the author of Linkding as well.

#! /bin/bash
DATETIME=$(date +%d-%m-%Y-%T)
CONTAINER_NAME=linkding
BACKUP_FILE=backup-$DATETIME.sqlite3
BACKUP_DIR=~/backups/linkding
# create backups directory if it does not exist
mkdir -p $BACKUP_DIR
# create sqlite backup
podman exec -it $CONTAINER_NAME python manage.py backup $BACKUP_FILE
# copy the backup file to the backup directory
podman cp $CONTAINER_NAME:/etc/linkding/$BACKUP_FILE $BACKUP_DIR/$BACKUP_FILE
# To delete files older than 30 days
find $BACKUP_DIR/* -mtime +30 -exec rm {} \;

Here you will notice that I am using podman to run the commands. This is because I am using Podman to run the container. If you are using Docker, you can replace podman with docker and it should work fine.

We are also cleaning up old backups that are older than 30 days but feel free to update or remove that block if you don’t want to do that.

To restore the backup, just copy the backup file to the data folder of your new installation and rename it to db.sqlite3 and restart the container and you should be good to go.

I have hooked this up with a cronjob to run every week and it backs up the data and sync it to cloud storage.

You can setup a cron job by running the following command:

Terminal window
crontab -e

And then add the following line to the file:

Terminal window
0 0 * * * /path/to/backup/script.sh

This will run the script every day at 12:00 AM. Make sure the script is executable by running chmod +x /path/to/backup/script.sh.

Conclusion

I have been using Linkding for a while now and I am very happy with it. I also use a tool called linkding-injector to enhance my experience with it.

The post is not a detailed guide on how to setup Linkding but more of a quick overview of how I am using it and how you can use it too.

If you have any questions or suggestions, feel free to reach out to me on Twitter ↗️ / Reddit ↗️.

See you in another one! 👋

You may also like

  • Jellyfin + arr stack — Self-hosted media streaming in my Homelab

    Since ages, I have been collecting lots of movies, TV shows, and music. Ever since I got into self hosting, I have been looking for a way to stream my media collection to my devices. Jellyfin is the perfect solution for this.

  • Syncing made easy with Syncthing

    Syncthing is one of those tools which have made my life easier. It is a decentralized file synchronization tool which is open source and free to use. Learn how to set it up and use it.

  • Tailscale — Accessing Homelab services outside my network

    Tailscale is another service that I use in my homelab setup to access my services outside my network. It's a VPN service that makes it easy to access your devices, services, and networks securely.