TinyLink is a 100% open-source alternative to commercial URL shortening services, designed for individuals and organizations who value:
- Full Data Ownership: Your links, analytics, and user data stay on your servers, not in the cloud
- Enhanced Privacy: No third-party tracking or data collection from your shortened links
- Security First: Reduce phishing risks by having a trusted, self-hosted domain for all your shortened URLs
- No Vendor Lock-in: Freedom from subscription fees or unexpected service shutdowns
- Customization Freedom: Modify and extend the codebase to fit your exact requirements
- Unlimited Usage: Create as many shortened links as your infrastructure can handle
- Fast URL Shortening - Create shortened URLs in seconds
- Custom Short Codes - Choose your own memorable short codes
- Click Analytics - Track the performance of your links
- Secure Authentication - Protect your links with user accounts
- Modern UI - Beautiful, responsive interface using Tailwind CSS
- Self-Hosted - Full control over your link data and privacy
# Clone the repo
git clone https://github.com/lx-0/tiny-link.git
cd tinylink
# Install dependencies
npm install
# Setup environment variables
cp .env.development.sample .env.development
# Start the development server
npm run dev
# Clone the repo
git clone https://github.com/lx-0/tiny-link.git
cd tinylink
# Copy environment variables for development
cp .env.development.sample .env.development
# Start the development environment
docker compose -f docker-compose.dev.yml up
# Clone the repo
git clone https://github.com/lx-0/tiny-link.git
cd tinylink
# Copy and edit production environment variables
cp .env.production.sample .env.production
# Edit .env.production with your secure settings
# Start the production environment
docker compose up -d
Visit http://localhost:5000
in your browser.
- Node.js 18+
- PostgreSQL 15+
- Modern web browser
- Docker
- Docker Compose
- Frontend: React, TypeScript, Tailwind CSS, Shadcn UI
- Backend: Express.js, Node.js, TypeScript
- Database: PostgreSQL with Drizzle ORM
- Authentication: Supabase Auth
- State Management: TanStack Query (React Query)
- Create short URLs with either auto-generated or custom codes
- Manage and organize your shortened links in one place
- Simple API for programmatic URL creation and management
Track clicks, referrers, and geographical data for your links with our built-in analytics:
- Total clicks over time
- Conversion rates
- Peak traffic times
- Device & browser statistics
Create and manage user accounts with different permission levels:
- Regular users can create and manage their own links
- Admin users can view and manage all links in the system
- Set custom expiration dates for links
TinyLink can be configured via environment variables:
# Supabase and database connection
SUPABASE_DATABASE_URL=postgres://user:password@localhost:5432/tinylink
DB_SCHEMA=tinylink
# Supabase authentication
VITE_SUPABASE_URL=your_supabase_url
VITE_SUPABASE_ANON_KEY=your_supabase_anon_key
# Application settings
NODE_ENV=development
Sample configuration files are provided:
.env.development.sample
- Template for development configuration.env.production.sample
- Template for production configuration
Two Docker Compose configurations are provided:
-
Development (
docker-compose.dev.yml
):- Hot-reloading enabled
- Source code is mounted as volumes
- PostgreSQL database with exposed port
- Uses
.env.development
for configuration - Automatic database schema initialization
-
Production (
docker-compose.yml
):- Optimized build with minimized dependencies
- Database ports not exposed to the internet
- Uses
.env.production
for configuration - Automatic container restarts
- Database initialization service for first-time setup
To run the development version:
# Copy the sample environment file first
cp .env.development.sample .env.development
# Edit the environment variables as needed
nano .env.development
# Start the services
docker-compose -f docker-compose.dev.yml up
For production:
cp .env.production.sample .env.production
nano .env.production
docker-compose up -d
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
As an open-source, self-hosted solution, TinyLink offers significant advantages:
- No Data Mining: Your link data isn't being harvested for advertising or analytics
- Enhanced Trust: Users can trust links from your organization's domain instead of third-party services
- Custom Security Policies: Implement your own security requirements without limitations
- Compliance Friendly: Keep sensitive links within your regulatory boundaries (GDPR, HIPAA, etc.)
- Transparency: The entire codebase is open for security review, with no hidden tracking or backdoors
- Audit Control: Full access to server logs and analytics data for security monitoring
TinyLink makes it easy to migrate from paid services:
- Export links from your current service (most provide CSV export)
- Import links using our API or bulk import tool
- Update DNS to point your domain to your TinyLink instance
- Enjoy freedom from subscription fees and privacy concerns
- This project was created in collaboration with AI assistance
- Icons provided by Lucide React
- UI Components by shadcn/ui
- Special thanks to the Drizzle ORM team for their amazing database tools