A modern, high-performance URL shortener built for internal use. Developed with Next.js, Cloudflare Workers, D1, and R2.
- Shorten URLs: Generate short links with random or custom slugs.
- QR Codes: Auto-generated QR codes for every link.
- Analytics: Track clicks, geolocation, and device types.
- Authentication: Secure login via Email/Password or GitHub.
- Link Management: Dashboard to view, edit, and delete links.
- Security: Password protection and password-protected links.
- API: Public API for programmatic link creation.
- Bulk Operations: Bulk upload via CSV.
- Custom Domains: (Coming Soon) Support for branded domains.
- Framework: Next.js (App Router)
- Runtime: Cloudflare Workers (via OpenNext)
- Database: Cloudflare D1 (SQLite)
- Storage: Cloudflare R2 (Assets), KV (Rate Limiting)
- ORM: Drizzle ORM
- Auth: Better Auth
- Styling: Tailwind CSS v4 + Shadcn UI
- Node.js 20+
- Cloudflare Account
- Wrangler CLI (
npm i -g wrangler)
-
Install Dependencies:
npm install
-
Setup Environment: Copy
.env.exampleto.env(if provided) or set the following variables:BETTER_AUTH_SECRET=your_secret BETTER_AUTH_URL=http://localhost:3000 NEXT_PUBLIC_APP_URL=http://localhost:3000 NEXT_PUBLIC_SHORT_DOMAIN=short.link
-
Run Migrations (Local):
npm run db:migrate:local
-
Start Development Server:
npm run dev
-
Deploy to Cloudflare:
npm run deploy
-
Run Migrations (Production):
npm run db:migrate:prod
The API allows you to programmatically shorten URLs.
Base URL: https://<your-domain>/api/v1
Include your API Key in the Authorization header:
Authorization: Bearer <your_api_key>
You can generate an API key from the Settings page in the dashboard.
POST /shorten
Body (JSON):
{
"url": "https://example.com/very/long/url",
"slug": "custom-alias", // Optional
"expiresAt": "2025-12-31T23:59:59Z", // Optional
"password": "secret-password" // Optional
}Response (200 OK):
{
"shortUrl": "https://short.link/custom-alias",
"slug": "custom-alias",
"qrCode": "data:image/svg+xml;base64,..."
}Silakan baca Panduan Kontribusi untuk detail tentang alur kerja pengembangan kami.
- Fork the repository.
- Create a feature branch.
- Commit your changes.
- Open a Pull Request.
Untuk panduan deployment dan operasional, silakan lihat Runbook Operasional.
MIT