Back to articles
Technology Insight

Build Your Own Short-Link and Bio Page System (Like Linktree) with Node.js on a VPS

May 18, 2026

Introduction: The Rise of the Digital Business Card

In today's interconnected digital landscape, professionals, creators, and businesses need a central hub to direct their audience. Social media bios are restrictive, and email signatures are often overlooked. This need gave birth to the link-in-bio phenomenon, popularized by platforms like Linktree. However, relying on a third-party service means ceding control over your data, branding, and functionality. What if you could build your own?

This guide walks you through constructing a self-hosted, Node.js-based short-link and bio page system on your own Virtual Private Server (VPS). You'll gain a fully customizable platform that shortens URLs, presents a beautiful link dashboard, and provides analytics—all under your domain and control.

Why Build Your Own System?

Before diving into code, let's examine the compelling advantages of a self-hosted solution.

  • Complete Brand Control: Match the design exactly to your website or personal brand without template limitations.
  • Data Ownership & Privacy: All click analytics and user data reside on your server, not a third-party's database.
  • Cost-Effective at Scale: While a VPS has a monthly cost, it becomes significantly cheaper than premium SaaS subscriptions if you manage multiple profiles or high traffic.
  • Enhanced Functionality: Integrate directly with your other tools, add custom fields, or implement unique features like password-protected links.
  • Professional Appeal: A custom domain (e.g., links.yourname.com) projects technical competence and attention to detail.

System Architecture & Technology Stack

Our application will follow a clean, modular architecture suitable for a VPS environment.

Core Components

Backend API (Node.js & Express): Handles all business logic—creating short codes, redirecting users, and serving the bio page data. We'll use Express for its simplicity and robust middleware ecosystem.

Database (PostgreSQL): Stores the mapping between short codes and destination URLs, user profiles, and link configurations. PostgreSQL offers reliability and powerful querying for future analytics features.

Frontend (Server-Side Rendered EJS): For simplicity and fast initial loads, we'll use EJS templates to render the bio page. The admin dashboard could be a separate, simple HTML/JS interface or expand into a full SPA later.

Web Server (Nginx): Acts as a reverse proxy in front of our Node.js app, handling SSL/TLS termination, static file serving, and improving performance and security.

Technology Stack Summary

  • Runtime: Node.js (LTS version)
  • Web Framework: Express.js
  • Database: PostgreSQL with node-postgres (pg) driver
  • Template Engine: EJS
  • Process Manager: PM2 (for keeping the app running)
  • Web Server: Nginx
  • Version Control: Git

Step-by-Step Implementation Guide

1. Setting Up the Project Foundation

Initialize a new Node.js project and install core dependencies.

Pro Tip: Always start by creating a detailed package.json and a .gitignore file to exclude node_modules and environment files.

Your core dependencies will include express, pg, ejs, and dotenv for environment configuration. Use nanoid or a similar library to generate cryptographically strong, URL-friendly short codes, which is superior to incremental IDs for both security and usability.

2. Designing the Database Schema

A simple, effective schema requires two main tables.

The links table stores each short link:
Columns: id (primary key), short_code (unique index), destination_url, title, clicks (default 0), created_at.

The profiles table configures the bio page:
Columns: id, username (unique, for routing), display_name, bio, avatar_url, theme.

A relational design allows for future expansion, such as user authentication, link categorization, or scheduled links.

3. Building the Core API Endpoints

The Express application needs three critical sets of routes.

  1. Redirection Endpoint (GET /:code): This is the heart of the system. It looks up the short_code, increments the click counter, and issues a 302 redirect to the destination_url. Implement a 404 page for invalid codes.
  2. Bio Page Endpoint (GET /:username): Fetches the profile and its associated active links, then renders an EJS template to display them as a beautiful, clickable dashboard.
  3. Admin API (Protected): A set of endpoints (e.g., POST /api/links, PUT /api/profile) to manage data. Initially, you can protect these with a simple API key middleware stored in an environment variable.

4. Creating the User Interface

The bio page template (profile.ejs) should be clean, responsive, and focused. Use CSS Grid or Flexbox to arrange links. Each link should display the title and optionally an icon. The template pulls in the display_name, bio, and avatar_url from the profile data. Remember to set proper rel="noopener noreferrer" attributes on links opening in a new tab for security.

5. Deployment on a VPS

This is where your system becomes live. The process involves:

  • Server Provisioning: Spin up a VPS (Ubuntu 22.04 LTS is a stable choice) from a provider like DigitalOcean, Linode, or AWS Lightsail.
  • Initial Setup: Secure your server: create a non-root user, configure a firewall (UFW), and set up SSH key authentication.
  • Installing Dependencies: Install Node.js, PostgreSQL, Nginx, and Git on the server.
  • Database Configuration: Create a PostgreSQL user and database for your app, then run your schema SQL.
  • Application Deployment: Clone your Git repository. Install npm dependencies. Create a .env file with your database connection string and secret keys. Use PM2 to daemonize your Node.js app: pm2 start server.js --name "link-bio".
  • Nginx Configuration: Set up a server block that proxies requests to your Node.js app's port (e.g., 3000). Obtain a free SSL certificate from Let's Encrypt using Certbot to enable HTTPS.
  • Domain Configuration: Point your desired domain or subdomain (e.g., links.yourdomain.com) to your VPS's IP address via DNS A record.

Advanced Features & Enhancements

Once the basic system is operational, consider these enhancements to increase its value.

Analytics Dashboard

Extend the links table to log individual clicks with a timestamp, IP hash (for privacy), and user-agent. This allows you to build charts showing traffic over time, top-performing links, and referral sources.

Customization API

Allow users to customize their bio page theme via the admin API—changing background colors, fonts, and button styles. Store these preferences in a JSONB field in the profiles table for flexibility.

Link Scheduling & Expiration

Add active_from and expires_at timestamp columns to the links table. Your redirection logic should then check these dates before redirecting, allowing for time-sensitive campaign links.

QR Code Generation

Automatically generate a QR code for each short link. Use a library like qr-image to create an on-the-fly PNG or SVG endpoint (e.g., GET /:code/qr), useful for print materials.

Maintenance, Security, and Scaling Considerations

Running your own service comes with responsibilities.

Security: Keep your OS and software updated. Use environment variables for all secrets. Implement rate limiting on the redirection endpoint to prevent abuse. Sanitize all user input to prevent SQL injection and XSS attacks—EJS escapes by default, which helps. Consider adding a simple authentication layer for the admin API beyond a single key.

Backups: Automate regular backups of your PostgreSQL database. Your VPS provider may offer snapshot functionality for the entire server disk.

Monitoring: Use PM2's built-in monitoring or a tool like pm2-logrotate to manage application logs. Set up basic uptime monitoring (e.g., with UptimeRobot) to be alerted if your service goes down.

Scaling: The architecture is horizontally scalable. If traffic grows, you can separate the read-heavy redirection endpoint from the admin API, introduce a caching layer (like Redis) for popular links, or use a CDN for static assets.

Conclusion: Taking Ownership of Your Digital Hub

Building your own short-link and bio page system is more than a technical exercise; it's an investment in your digital autonomy. You move from being a tenant on someone else's platform to the owner of a critical piece of your online infrastructure. The Node.js and VPS stack provides a perfect balance of power, simplicity, and cost-effectiveness.

This project offers a solid foundation that you can adapt, extend, and scale according to your unique needs. Whether for personal branding, a client project, or a startup idea, the skills you gain—full-stack JavaScript development, database design, server administration, and deployment—are invaluable in the modern developer's toolkit. Start building today, and own your corner of the internet.