A modern URL shortening service built with Node.js and Express.
- 🔗 Quick URL shortening
- 🎯 Custom aliases
- 🔒 Password protection
- ⏰ Expiration dates
- 📱 QR code generation
- 👀 URL preview
- Backend: Node.js, Express
- Database: SQLite3
- Frontend: EJS, Bootstrap 5
- Icons: Font Awesome
- Notifications: SweetAlert2
- Node.js (v14 or higher)
- npm or yarn
- Clone the repository
- Install dependencies using npm install
- Copy .env.example to .env and update the values
- Start the server using npm start
- For development, use npm run dev
POST /shorten
Request Body:
{
"url": "https://example.com/long-url",
"customSlug": "custom-name", // Optional
"password": "secretpass", // Optional
"expiresIn": "7:days" // Optional
}Response:
{
"shortUrl": "https://srl.ink/abc123",
"qrCode": "data:image/png;base64,..."
}Base URL:
GET /{shortId}
Query Parameters:
| Parameter | Type | Description |
|---|---|---|
preview |
boolean |
Show preview page instead of direct redirect |
password |
string |
Required for password-protected URLs |
Examples:
GET /abc123 # Direct redirect
GET /abc123?preview=true # Show preview page
GET /abc123?password=123 # Access protected URL
PORT=1986 BASE_URL=https://srl.ink
- Fork the project
- Create your feature branch
- Commit your changes
- Push to the branch
- Open a Pull Request
Distributed under the MIT License. See LICENSE for more information.
Kha Dang - @khadnhdev
Made with ❤️ by [Kha Dang]
