Skip to content

montasim/shrnkly-url-shortener

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

146 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

shrnkly

Shrnkly is a modern, feature-rich URL management platform that combines URL shortening, text sharing, and QR code generation in one beautiful interface. Built with Next.js 16, React 19, and TypeScript.

Wakatime coding time badge GitHub release GitHub last commit GitHub commit activity GitHub contributors GitHub repo file count GitHub repo size GitHub license

CONTENTS:

  1. Features
  2. Usage Limits
  3. Tech Stack
  4. Prerequisites
  5. Setup
  6. Running the Application
  7. Docker Support
  8. Environment Variables
  9. Project Structure
  10. Hosting
  11. API Documentation
  12. Contributing
  13. Contributors
  14. License
  15. Contact

✨ Features

🔗 URL Shortener

  • Create short, memorable links instantly
  • Custom slug/alias support
  • Real-time click analytics and traffic insights
  • Geographic tracking (country, region, city)
  • Device, browser, and referrer analytics
  • Link expiration settings
  • QR code generation for each short link
  • Password protection (premium feature)

📝 Text Sharing

  • Share code snippets, notes, and documents securely
  • Syntax highlighting for 100+ programming languages
  • Password protection for sensitive content
  • Auto-expiration with customizable timelines
  • View count limits
  • Markdown support
  • Private and public sharing options
  • View analytics and access logs

📱 QR Code Generator

  • Generate QR codes for URLs, text, WiFi, contacts, and more
  • Real-time preview with full customization
  • Multiple output formats (PNG, SVG)
  • Color customization and branding options
  • Error correction levels (L, M, Q, H)
  • 100% client-side generation (privacy-focused)
  • Works offline
  • No registration required

🔐 Authentication & Security

  • Google OAuth 2.0 integration
  • Email/password authentication
  • Password reset via email
  • Cloudflare Turnstile protection (bot prevention)
  • JWT-based session management
  • Bcrypt password hashing
  • Rate limiting and abuse prevention

📊 Dashboard

  • Comprehensive link management interface
  • Real-time analytics and statistics
  • Traffic overview with interactive charts
  • Top-performing links/shares
  • Geographic distribution maps
  • Recent activity logs
  • Bulk operations support

🌍 Internationalization

Support for 9 languages:

  • 🇺🇸 English
  • 🇩🇪 German (Deutsch)
  • 🇫🇷 French (Français)
  • 🇪🇸 Spanish (Español)
  • 🇨🇳 Chinese (简体中文)
  • 🇵🇰 Urdu (اردو)
  • 🇮🇳 Hindi (हिन्दी)
  • 🇧🇩 Bengali (বাংলা)
  • 🇸🇦 Arabic (العربية)

⚖️ Usage Limits

Shrnkly offers different usage limits based on your account status. Here's a comprehensive breakdown:

🔗 URL Shortener Limits

Feature Guest (No Account) Registered User Premium
URL Creation Limit 10 URLs 20 URLs Unlimited
Custom Slugs ✅ Yes ✅ Yes ✅ Yes
Analytics ✅ Basic ✅ Full ✅ Full + Export
QR Codes ✅ Yes ✅ Yes ✅ Yes + Custom
Link Expiration ❌ No ⚠️ Limited ✅ Full Control
Password Protection ❌ No ❌ No ✅ Yes
API Access ❌ No ⚠️ Rate Limited ✅ Full Access
Priority Support ❌ No ❌ No ✅ Yes

📝 Text Sharing Limits

Feature Guest (No Account) Registered User Premium
Text Share Creation 10 shares 20 shares Unlimited
Max Content Length 100 KB 100 KB 500 KB
Max View Limit 1000 views 1000 views 10,000 views
Default Expiry 30 days 30 days Custom
Password Protection ✅ Yes ✅ Yes ✅ Yes
Syntax Highlighting ✅ 100+ languages ✅ 100+ languages ✅ 100+ languages
Analytics ❌ No ✅ Basic ✅ Advanced
Custom Slugs ✅ Yes ✅ Yes ✅ Yes
Auto-Expiration ✅ Yes ✅ Yes ✅ Advanced Rules

📱 QR Code Generator

All features are completely FREE with NO limits:

  • ✅ Unlimited QR code generation
  • ✅ All types (URL, Text, WiFi, vCard, SMS, Email)
  • ✅ Full customization (colors, size, error correction)
  • ✅ Multiple formats (PNG, SVG)
  • ✅ No registration required
  • ✅ 100% client-side (privacy-focused)

📊 Understanding Account Tiers

Guest (No Account)

Perfect for trying out Shrnkly. No registration required, but limited to 10 creations per feature.

Best for: Quick, one-time use

Registered User (Free)

Create an account for free to get double the limits and access to analytics dashboard.

Benefits:

  • 20 URL creations
  • 20 text shares
  • Full analytics dashboard
  • Link management interface
  • Save and organize your links

Best for: Regular users, small projects

Premium (Subscription)

Unlock unlimited creations and advanced features for power users and businesses.

Benefits:

  • Unlimited URLs and text shares
  • Password protection for links
  • Custom expiration rules
  • Priority support
  • API access
  • Advanced analytics with export
  • Custom branding options

Best for: Businesses, marketers, developers, high-volume users

🔄 What Happens When You Reach Limits?

  • Guests: You'll be prompted to create an account to continue
  • Registered Users: You can delete old links to create new ones, or upgrade to Premium
  • Premium: No limits! Create as many as you need

💡 Tips to Manage Limits

  1. Delete unused links - Remove old or unused links to free up space
  2. Use custom slugs - Make links memorable and reusable
  3. Set expiration dates - Auto-delete temporary links
  4. Upgrade to Premium - For unlimited access and advanced features

🛠 Tech Stack

Category Technology
Framework Next.js 16.1.6 (App Router)
Language TypeScript 5.8+
UI Library React 19.1.0
Styling Tailwind CSS 4.1+
Components Radix UI, shadcn/ui
Animations Framer Motion
Database MongoDB (via Prisma ORM)
Caching Redis (ioredis)
Authentication Google OAuth, JWT, bcrypt
Validation Zod, React Hook Form
HTTP Client Axios
i18n next-intl
Charts Recharts
QR Codes qrcode
Email Nodemailer
Security Cloudflare Turnstile
Cron Jobs node-cron
Testing Jest, ts-jest
Code Quality Prettier, ESLint, Commitlint
Secrets Infisical

📋 Prerequisites

Before you begin, ensure you have the following installed:

  1. Node.js v20.x or higher
  2. PNPM v10.x or higher
  3. MongoDB (local or cloud instance like MongoDB Atlas)
  4. Redis (optional, for caching)

🚀 Setup

1. Clone the Repository

git clone https://github.com/montasim/shrnkly.git
cd shrnkly

2. Install Dependencies

pnpm install

3. Environment Configuration

Create a .env file in the root directory (copy from .env.example):

cp .env.example .env

Configure the following environment variables:

Project Configuration

NEXT_PUBLIC_PROJECT_NAME=Shrnkly
NEXT_PUBLIC_CONTACT_EMAIL=your-email@example.com
NEXT_PUBLIC_LINKEDIN_URL=https://linkedin.com/in/yourprofile
NEXT_PUBLIC_GITHUB_URL=https://github.com/yourusername

Database

DATABASE_URL=mongodb+srv://username:password@cluster.mongodb.net/dbname

Authentication

JWT_ACCESS_TOKEN_SECRET=your-secret-key
JWT_ACCESS_TOKEN_EXPIRATION_IN_MINUTES=60
JWT_REFRESH_TOKEN_SECRET=your-refresh-secret
JWT_REFRESH_TOKEN_EXPIRATION_IN_MINUTES=84000

Google OAuth (Optional)

GOOGLE_OAUTH_GOOGLE_CLIENT_ID=your-client-id
GOOGLE_OAUTH_GOOGLE_CLIENT_SECRET=your-client-secret
GOOGLE_OAUTH_GOOGLE_REDIRECT_URI=https://yourdomain.com/api/v1/auth/google/callback

Cloudflare Turnstile

NEXT_PUBLIC_CF_TURNSTILE_SITE_KEY=your-site-key
CF_TURNSTILE_SECRET_KEY=your-secret-key

Email (for password reset)

MAILER_SERVICE=Gmail
MAILER_USER=your-email@gmail.com
MAILER_PASS=your-app-password

See .env.example for the complete list of variables.

4. Generate Prisma Client

pnpm prisma:generate

5. Run Database Migrations

pnpm prisma migrate dev

🏃 Running the Application

Development Mode

pnpm dev

The application will start at http://localhost:3000

Production Build

pnpm build
pnpm start

Code Quality

# Check formatting
pnpm prettier:check

# Fix formatting
pnpm prettier:fix

# Run linter
pnpm lint

# Run tests
pnpm test
pnpm test:watch

🐳 Docker Support

Build and Run Development

# Build Docker Compose services
pnpm docker:build-dev

# Run services
pnpm docker:run-dev

# Stop services
pnpm docker:stop-dev

# Rebuild services
pnpm docker:rebuild-dev

Docker Compose Configuration

The project includes a docker-compose.yml with:

  • Next.js application
  • MongoDB
  • Redis (optional)

📝 Environment Variables

Variable Description Default
NEXT_PUBLIC_PROJECT_NAME Project/brand name Shrnkly
NEXT_PUBLIC_CONTACT_EMAIL Contact email -
NEXT_PUBLIC_LINKEDIN_URL LinkedIn profile URL -
NEXT_PUBLIC_GITHUB_URL GitHub URL -
DATABASE_URL MongoDB connection string -
JWT_ACCESS_TOKEN_SECRET JWT access token secret -
JWT_ACCESS_TOKEN_EXPIRATION_IN_MINUTES Access token expiry 60
JWT_REFRESH_TOKEN_SECRET JWT refresh token secret -
JWT_REFRESH_TOKEN_EXPIRATION_IN_MINUTES Refresh token expiry 84000
NEXT_PUBLIC_CF_TURNSTILE_SITE_KEY Cloudflare Turnstile site key -
CF_TURNSTILE_SECRET_KEY Cloudflare Turnstile secret -
MAILER_SERVICE Email service Gmail
MAILER_USER Email address -
MAILER_PASS Email password/app password -
TEXT_SHARE_MAX_CONTENT_LENGTH_KB Max text share size 100
TEXT_SHARE_DEFAULT_EXPIRY_DAYS Default expiry days 30

See .env.example for all available options.


📁 Project Structure

shrnkly/
├── app/                        # Next.js App Router
│   ├── [locale]/              # Internationalized routes
│   │   ├── (home)/           # Public pages
│   │   ├── dashboard/        # User dashboard
│   │   └── layout.tsx        # Locale layout
│   ├── api/                   # API routes
│   └── layout.tsx            # Root layout
├── components/                # React components
│   ├── dashboard/            # Dashboard components
│   ├── footer/               # Footer components
│   ├── navbar/               # Navigation components
│   ├── qr/                   # QR code components
│   └── ui/                   # UI components (shadcn)
├── configuration/             # App configuration
├── constants/                 # Constants and configs
├── context/                   # React contexts
├── i18n/                      # Internationalization
├── lib/                       # Utilities and helpers
│   ├── generated/            # Generated code (Prisma)
│   └── actions/              # Server actions
├── messages/                  # Translation files
├── prisma/                    # Prisma schema and migrations
├── public/                    # Static assets
├── schemas/                   # Zod validation schemas
├── scripts/                   # Utility scripts
├── services/                  # Business logic services
├── types/                     # TypeScript types
└── utils/                     # Utility functions

🌐 Hosting

Deploy to Vercel

Deploy to Vercel

Vercel Setup Guide
  1. Go to vercel.com and sign in with GitHub
  2. Fork this repository
  3. In Vercel dashboard, click "Add New Project"
  4. Import your forked repository
  5. Configure environment variables (copy from .env.example)
  6. Click Deploy

Self-Hosting

  1. Clone the repository
  2. Install dependencies: pnpm install
  3. Configure environment variables
  4. Build: pnpm build
  5. Start: pnpm start

Or use Docker:

docker-compose up -d

📚 API Documentation

API endpoints are available under /api/v1/:

Authentication

  • POST /api/v1/auth/signup - Create account
  • POST /api/v1/auth/login - Login
  • POST /api/v1/auth/logout - Logout
  • POST /api/v1/auth/forgot-password - Request password reset
  • POST /api/v1/auth/reset-password - Reset password
  • GET /api/v1/auth/me - Get current user

URLs

  • POST /api/v1/urls - Create short URL
  • GET /api/v1/urls - List user's URLs
  • GET /api/v1/urls/:shortKey - Get URL details
  • DELETE /api/v1/urls/:shortKey - Delete URL
  • GET /api/v1/urls/qr-code/:shortKey - Get QR code

Text Shares

  • POST /api/v1/texts - Create text share
  • GET /api/v1/texts - List user's shares
  • GET /api/v1/texts/:shortKey - Get share content
  • GET /api/v1/texts/:shortKey/stats - Get share statistics
  • DELETE /api/v1/texts/:shortKey - Delete share

See the API documentation for detailed endpoint documentation.


🤝 Contributing

Contributions are always welcome! Please read the contribution guidelines first.

How to Contribute

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Commit your changes: git commit -m 'Add amazing feature'
  4. Push to the branch: git push origin feature/amazing-feature
  5. Open a Pull Request

Development Workflow

  • Follow the Conventional Commits specification
  • Run tests before submitting PR: pnpm test
  • Ensure code is formatted: pnpm prettier:check
  • Update documentation as needed

👥 Contributors

contributors


📄 License

This project is licensed under the MIT License - see the LICENSE file for details.


📬 Contact

linkedin github stackoverflow website email facebook x


Made with ❤️ by montasim

About

Modern URL management platform with URL shortening, text sharing, and QR code generation. Built with Next.js 16, React 19, TypeScript, Tailwind CSS, Prisma & MongoDB. Features analytics, Google OAuth, password protection, custom slugs, syntax highlighting for 100+ languages, and 9 language support. Open-source Bitly alternative.

Topics

Resources

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages