Shorty
Lightning-fast URL shortener.
Install / Use
/learn @killcod3/ShortyREADME
Shorty - Lightning Fast URL Shortener
A high-performance, enterprise-grade URL shortening service built for speed, security, and global scalability. Powered by Cloudflare's edge network for lightning-fast redirects worldwide.
Production Demo
Live Demo: TAKEN DOWN DUE TO MISUSE
Redirect Domain: TAKEN DOWN DUE TO MISUSE
Note: Demo version retains shortened URLs for 7 days
Architecture Overview
Shorty uses a streamlined two-service architecture optimized for performance and cost:
- Next.js Application - Frontend and API endpoints for URL creation
- Cloudflare Worker - Ultra-fast edge redirects only
This design minimizes Cloudflare Worker costs while maximizing redirect performance through edge caching.
Why Choose Shorty?
For Enterprises & High-Traffic Applications
Shorty is designed for organizations that demand:
- Sub-50ms redirects globally through Cloudflare's 200+ edge locations
- Enterprise-grade security with reCAPTCHA protection and URL validation
- Zero downtime with distributed edge architecture
- Cost-optimized infrastructure with minimal worker usage
- Clean, professional interface suitable for internal tools and customer-facing applications
Key Features
Performance First
- Dedicated edge workers for redirects only
- Intelligent caching with 1-hour edge cache
- Sub-50ms response times worldwide
- Optimized worker bundle (< 2KB)
Security & Reliability
- reCAPTCHA v2 spam protection
- URL validation and sanitization
- Automatic TTL management (7 days)
- HTTPS enforcement with security headers
Developer Experience
- Modern TypeScript stack throughout
- RESTful API built into Next.js
- Responsive web interface
- Environment-based configuration
Technology Stack
- Frontend & API: Next.js 15, TypeScript, Tailwind CSS, React
- Edge Redirects: Cloudflare Workers (JavaScript)
- Database: Cloudflare Workers KV
- Security: reCAPTCHA v2, URL validation, HTTPS enforcement
- Hosting: Vercel (Next.js) + Cloudflare Workers
Use Cases
Enterprise Applications
- Marketing campaign tracking
- Internal tool link management
- Customer communication optimization
- API endpoint abstraction
High-Volume Services
- Social media platforms
- Email marketing services
- Documentation systems
- Mobile application deep linking
Development Teams
- Staging environment management
- Feature flag distribution
- A/B testing infrastructure
- Development workflow optimization
Quick Start
Quick Start
Local Development
# Clone the repository
git clone https://github.com/killcod3/shorty.git
cd shorty
# Frontend setup (includes API routes)
cd frontend
npm install
npm run dev
# Worker setup (separate terminal)
cd ../worker
wrangler dev
Environment Variables
Frontend (.env.local):
# reCAPTCHA Configuration
NEXT_PUBLIC_RECAPTCHA_SITE_KEY=your_recaptcha_site_key
RECAPTCHA_SECRET_KEY=your_recaptcha_secret_key
# Cloudflare API Configuration
CLOUDFLARE_ACCOUNT_ID=your_account_id
CLOUDFLARE_API_TOKEN=your_api_token
CLOUDFLARE_KV_NAMESPACE_ID=your_kv_namespace_id
# Application URLs
DOMAIN=https://worker-redirect-domain.com
Worker (wrangler.toml):
name = "shorty-worker"
compatibility_date = "2024-05-10"
main = "index.js"
[[kv_namespaces]]
binding = "LINKS_KV"
id = "your_kv_namespace_id"
[env.production]
vars = { HOME_URL = "https://link-to-nextjs-app.com" }
API Reference
Shorten URL
POST /api/shorten
Content-Type: application/json
{
"url": "https://example.com/very-long-url",
"recaptchaToken": "recaptcha_response_token"
}
Response
{
"shortUrl": "https://go-shorty.url.com/abc123",
"originalUrl": "https://example.com/very-long-url",
"expiresIn": "7 days"
}
Health Check
GET /api/health
Deployment
Frontend (Next.js on Vercel)
cd frontend
vercel --prod
Worker (Cloudflare)
cd worker
wrangler deploy --env production
Development
Project Structure
shorty/
├── frontend/ # Next.js app with API routes
│ ├── src/app/api/ # API endpoints
│ ├── src/app/ # Pages and components
│ └── ...
├── worker/ # Cloudflare Worker for redirects
│ ├── index.js # Worker script
│ └── wrangler.toml # Worker configuration
└── README.md
Testing
# Test frontend and API
cd frontend
npm run test
Contributing
We welcome contributions from the community. Please read our contributing guidelines and submit pull requests for any improvements.
License
This project is open source and available under the MIT License.
Support
For enterprise support, custom deployments, or feature requests, please open an issue on GitHub or contact the development team.
Built for performance, optimized for cost, ready for production at any scale.
