A powerful, self-hosted URL shortener with advanced analytics and privacy-first design
Transform long, unwieldy URLs into short, memorable links while maintaining complete control over your data. Perfect for businesses, marketers, and privacy-conscious users who need more than basic link shortening.
Unlike commercial URL shorteners, your data stays on your server. No third-party tracking, no data selling, complete privacy.
Free yourself from expensive SaaS subscriptions:
- No monthly or annual fees
- No link/click limits or quotas
- One-time infrastructure investment
- Scale without increasing costs
- Predictable operational expenses
Track every click with detailed insights:
- Real-time click tracking
- Geographic location data
- Device and browser analytics
- Referrer tracking
- UTM campaign monitoring
Fully customizable branding:
- Custom domain support
- Branded password pages
- Personalized logos and colors
- Your brand, your way
- Password-protected URLs
- Expiration dates for temporary links
- Rate limiting to prevent abuse
- Cloudflare Turnstile integration
- Role-based access control (ADMIN/USER)
- RESTful API with comprehensive documentation
- API key management for integrations
- Two-factor authentication (2FA)
- Bulk URL management
- QR code generation
- Multi-language support (English, Traditional Chinese)
β¨ Smart Link Management
- Custom slugs or auto-generated short codes
- Dynamic slug length based on usage
- Link expiration and scheduling
- Status control (ACTIVE/INACTIVE)
π Powerful Analytics
- Click statistics dashboard
- Time-series analysis
- Geographic distribution
- Device and platform breakdown
- UTM parameter tracking
π Flexible Authentication
- JWT-based user authentication
- API key support for server integrations
- Two-factor authentication
- Session management
π― Marketing Tools
- Password protection for sensitive links
- UTM parameter builder
- QR code generation
- Brand customization
β‘ High Performance
- Optional Redis caching for fast redirects
- PostgreSQL for reliable data storage
- Optimized for scale
The fastest way to get started is deploying to Railway with a single click:
This will automatically:
- β Deploy frontend and backend services
- β Provision PostgreSQL and Redis databases
- β Configure environment variables
Important:
β οΈ Custom domains must be configured manually in Railway settings- π Change the default admin password immediately after deployment
Redis is completely optional with automatic graceful degradation. The system works perfectly without Redis.
When Redis is available, these features use it for better performance:
- URL Query Cache - Faster redirects (300ms β 10-20ms)
- Token Blacklist - Shared across multiple instances (logout sync)
- Rate Limiting - Accurate throttling across instances
If REDIS_HOST
is not set, the system automatically uses fallback mechanisms:
Feature | Without Redis | Impact |
---|---|---|
URL Cache | Disabled (direct DB queries) | Slower redirects, higher DB load |
Token Blacklist | In-memory Map | Works in single instance only |
Rate Limiting | In-memory Map | Works in single instance only |
System Status: Fully functional, just slower for high traffic.
Perfect for:
- Personal use or small team tools
- Development/testing environments
- Budget-constrained early stage
- Single-instance deployments
Metrics:
- Traffic: < 10,000 clicks/day (~0.12 QPS)
- Peak concurrency: < 10 requests/second
Benefits:
- β Lower infrastructure costs (~$5-10/month)
- β Simpler maintenance (one less service)
- β No Redis configuration needed
Recommended for:
- Marketing campaigns with traffic spikes
- Frequent analytics page views
- Popular URLs (20% URLs = 80% traffic)
- Multi-instance deployments
Metrics:
- Traffic: > 50,000 clicks/day (~0.6 QPS)
- Peak concurrency: > 20 requests/second
Performance boost:
- Redirect time: 300ms β 10-20ms
- Database load: -70% to -90%
- Can handle 10-100x traffic
- Logout syncs across all instances
Cost: ~$15-25/month (5-10x performance improvement)
Essential for:
- SaaS products or high-traffic services
- Multi-instance production deployments
- Services requiring guaranteed rate limiting
Metrics:
- Traffic: > 1,000,000 clicks/day (~12 QPS)
- Peak concurrency: > 100 requests/second
Risk without Redis:
- Database becomes bottleneck
- Degraded user experience
- Rate limiting per instance (not global)
Monitor these metrics:
- DB query time > 200ms β Consider Redis
- Redirect response > 500ms β Need optimization
- Same URL queried > 10 times/hour β Cache helps
- Multiple instances β Need Redis for sync
Option A: Without Redis (Simple & Cheap)
- Don't add Redis service
- Don't set
REDIS_HOST
environment variable - System uses automatic fallback
- Cost: ~$5-10/month
Option B: With Redis (Performance)
- Add Redis service in Railway
- Environment variables auto-configured:
REDIS_HOST=${{Redis.RAILWAY_PRIVATE_DOMAIN}} REDIS_PORT=${{Redis.REDISPORT}} REDIS_PASSWORD=${{Redis.REDISPASSWORD}}
- System automatically detects and uses Redis
- Cost: ~$15-25/month
Switch anytime: Add or remove Redis without code changes. The system automatically adapts.
- Node.js 18+
- PostgreSQL 14+
- Redis 6+ (optional, for caching)
- Clone the repository
git clone https://github.com/supra126/open-short-url.git
cd open-short-url
- Install dependencies
yarn install
- Configure environment
# Backend
cp apps/backend/.env.example apps/backend/.env.local
# Edit apps/backend/.env.local with your database credentials
# Frontend
cp apps/frontend/.env.example apps/frontend/.env.local
# Edit apps/frontend/.env.local with your API URL
# Optional: Set NEXT_PUBLIC_LOCALE=zh-TW for Traditional Chinese (default: en)
- Setup database
cd apps/backend
yarn prisma:migrate
yarn prisma:seed
- Start development servers
# From project root
yarn dev
Visit:
- Frontend: http://localhost:4100
- Backend API: http://localhost:4101
- API Documentation: http://localhost:4101/api
Default credentials: admin@example.com
/ admin123
- Create branded short links for marketing campaigns
- Track campaign performance with detailed analytics
- Password-protect confidential links
- Maintain brand consistency across channels
- Self-hosted solution with full API access
- Integrate with existing systems via REST API
- Customize and extend functionality
- No vendor lock-in
- Complete data ownership
- No third-party tracking
- GDPR compliant
- Open source transparency
- Backend: NestJS, Prisma, PostgreSQL, Redis (optional)
- Frontend: Next.js 15, React 19, TypeScript, Tailwind CSS
- Security: JWT, bcrypt, Cloudflare Turnstile
- Analytics: Real-time click tracking with geographic data
- Webhook support for events
- Link bundles/collections
- Dark mode
- Audit logs
This project is licensed under the MIT License - see the LICENSE file for details.
- π Issue Tracker
- π¬ Discussions