A lightweight self-hosted URL shortener built with Express and Firebase Realtime Database.
English | 繁體中文
URLShortener solves two practical needs in one service:
- Create short links quickly on the home page
- Manage links later in a dashboard (search, copy, delete, and view clicks)
- Create short URLs:
POST /new,POST /new/ - URL validation: only accepts
http://andhttps:// - Unique short code generation with collision checks
- Redirect by short code:
GET /:shortURL - Click counting on each redirect
- Dashboard page:
GET /dashboard - Management APIs:
- List URLs:
GET /api/urls - Delete URL:
DELETE /api/urls/:shortURL
- List URLs:
- Copy env file:
cp .env.example .env- Fill Firebase settings in
.env - Install dependencies:
npm installDevelopment:
npm run devProduction:
npm run startDefault URL: http://localhost:3000
- Home:
GET / - Dashboard:
GET /dashboard
Create:
POST /new{
"originalURL": "https://example.com/article/123"
}{
"shortURL": "abc123xyz0"
}List:
GET /api/urlsDelete:
DELETE /api/urls/:shortURL- Node.js
- Express
- Firebase Realtime Database
- Nano ID
