DotLink is a minimal URL shortener that allows the creation of shortened links with optional custom aliases. Anyone can access shortened links, and the API also provides statistics such as click counts and original URLs.
Live Demo
https://dotlink-url-shortener.vercel.appgit clone https://github.com/Aarondoran/Node-URL-shortener.git
cd Node-URL-shortener
npm install
PORT=3030
DATABASE_URL=postgresql://YOUR_USERNAME:YOUR_PASSWORD@YOUR_HOST/YOUR_DATABASE
CREATE TABLE urls (
id SERIAL PRIMARY KEY,
short_id VARCHAR(255) NOT NULL,
original_url TEXT NOT NULL,
clicks INTEGER DEFAULT 0,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
node server.js
POST /api/shorten
{
"originalUrl": "https://example.com",
"customAlias": "myalias"
}
GET /:short_id
GET /check/:id