As someone who constantly finds interesting links online, I wanted a simple, personal tool to organize them. In my search, I didn't find any simple selfhosted services that covered my needs and were not full of features I dont want. So, I decided to build my own Bookmark Manager using Node.js with the help of @Leunsel.
I wanted the application to be lightweight, easy to run locally, and the database easy to backup and migrate to other instances. That is why I chose sqlite3 for the database.
The plan for the database was having categories, optional subcategories and, of course, the links. This structure allows unlimited nesting of categories:
CREATE TABLE categories (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT,
parent_id INTEGER
);
CREATE TABLE links (
id INTEGER PRIMARY KEY AUTOINCREMENT,
url TEXT,
title TEXT,
favicon TEXT,
category_id INTEGER,
created_at TEXT DEFAULT (datetime('now')),
visits INTEGER DEFAULT 0
);
One of my favorite features is automatic metadata fetching. When adding a link, the application:
- Fetches the page HTML using node-fetch.
- Uses Cheerio to extract the <title> and favicon.
- Stores them in the DB under the right category.
With Express, I set up RESTful routes for the core functionality:
- Viewing categories (/, /category/:id).
- Searching (/search).
- Adding and deleting links and categories.
- Redirecting to links while counting visits (/link/:id/go).
This means, we can also look up statistics for the individual links. We are able to see when they were added to the DB, and how often they have been clicked on.
This is the project structure (content of node_modules cut out.):
$ tree Bookmarks/
.
├── docker-compose.yml
├── Dockerfile
├── LICENSE
├── node_modules
├── package.json
├── package-lock.json
├── server.js
└── views
├── category.ejs
├── index.ejs
└── search.ejs
The database is automatically created on first start of the application (in a subfolder: "./data/db.sqlite").
Manual Installation & Backup
- Install NodeJS & NPM:
sudo curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash - && sudo apt install nodejs -y
- Navigate to the Bookmarks directory:
cd Bookmarks/
- Install dependencies:
sudo npm install
- Start the server:
node server.js
- The server will run on port 3000.
- Set up autostart using a systemd service file (optional).
[Unit]
Description=Personal Bookmark Manager (Node.js)
After=network.target
[Service]
User=YOUR_USERNAME
WorkingDirectory=/path/to/Bookmarks
ExecStart=/usr/bin/node server.js
Restart=always
StandardOutput=journal
StandardError=journal
Environment=NODE_ENV=production
[Install]
WantedBy=multi-user.target
You can easily backup the database by saving "db.sqlite".
What the application looks like:


You can view the source code here: GitHub. Note, that this is not where development happens, it is just a mirror, to make the source code publicly available.