Dub is a modern, open-source platform designed for marketing teams that need to track the performance of short links, measure conversion funnels, and run affiliate programs with precision. It solves the fragmentation problem in link management by unifying short link creation, real-time analytics, and partner payouts into a single, scalable system. Used by companies like Twilio, Buffer, and Framer, Dub replaces legacy tools like Bitly with a powerful, customizable alternative.
Built with Next.js, TypeScript, and Tailwind CSS, Dub leverages Prisma for database operations, Upstash for Redis caching, Tinybird for analytics, and PlanetScale for scalable MySQL-compatible databases. It supports self-hosting with full control over data and integrates with Vercel for deployment, Stripe for payments, and BoxyHQ for enterprise SSO/SAML authentication.
What You Get
- Branded Short Links - Create custom short domains (e.g., acme.link) with support for custom previews, password protection, and domain verification via A/CNAME records.
- Advanced Link Features - Includes device/geo-targeting, A/B testing, deep links, link cloaking, link expiration, and UTM parameter builder for granular campaign tracking.
- Real-Time Conversion Analytics - Track user journeys from click to sale with visual attribution maps showing sources, locations, devices, and conversion paths.
- Affiliate Program Management - Built-in platform to create, manage, and pay out affiliates with automated revenue tracking and payout calculations.
- QR Code Generation - Automatically generate branded QR codes for every short link with customizable logos, colors, and designs.
- Role-Based Access Control - Manage team permissions and access levels for short links, analytics, and affiliate programs with granular controls.
- Custom Domains & DNS Integration - Connect and verify custom domains with step-by-step DNS configuration guidance for A and CNAME records.
- Webhooks & Integrations - Trigger external actions via webhooks on link clicks, conversions, or affiliate payouts for CRM or marketing tool syncs.
Common Use Cases
- Running a paid affiliate program - An e-commerce brand uses Dub to track which partners drive sales, automate commission payouts, and generate branded short links for social media campaigns.
- Tracking multi-channel marketing campaigns - A SaaS company uses Dub to attribute signups and conversions across Google Ads, email, and social media using UTM parameters and real-time analytics.
- Managing enterprise link campaigns - A marketing team at Twilio uses Dub to create branded short links for product demos, enforce access controls, and monitor performance across global regions.
- Building a referral program for users - A startup uses Dub to turn customers into affiliates by generating unique referral links with built-in tracking and automated payout rules.
Under The Hood
Architecture
- Monorepo structure organized into distinct workspaces for frontend, UI components, utilities, and data access, enabling clear separation of concerns and modular development
- Dependency injection via workspace references ensures consistent versioning and encapsulation of core services like Prisma and email systems
- Clean layering isolates database logic within a dedicated Prisma package, while frontend applications consume typed clients to maintain separation between data and business logic
- Centralized configuration for Tailwind CSS and TypeScript eliminates duplication and enforces design and type consistency across the codebase
- Turbo-powered build pipelines with explicit dependencies ensure deterministic, parallelized builds and modular deployment of shared packages
Tech Stack
- Next.js 15 with React 19 and TypeScript form the foundation, leveraging App Router and server components for optimized rendering
- pnpm and Turbo manage the monorepo, enabling efficient package resolution and parallelized test/build workflows
- Prisma ORM with PlanScale Database and NextAuth provide type-safe data access and secure authentication
- AI capabilities are integrated via @ai-sdk/anthropic and @mendable/firecrawl-js for LLM interactions and web data extraction
- Tailwind CSS with shared configuration and Prettier ensure visual and formatting consistency
- Axiom provides full-stack observability with seamless Next.js integration for comprehensive logging and telemetry
Code Quality
- Extensive end-to-end and integration tests with Zod validation ensure API contract integrity and robust data handling
- Comprehensive test coverage spans critical domains like webhooks, analytics, and redirect logic, with structured assertions for reliability
- Custom test harnesses promote DRY principles and consistent test environment setup
- Clear naming conventions and defensive programming practices enhance maintainability and readability
- HTTP status codes and structured responses ensure predictable error handling, though custom error classes could improve debugging depth
What Makes It Unique
- Domain aliasing system with atomic DNS and Vercel integration enables seamless link management without external dependencies
- Built-in E2E test endpoints with workspace isolation allow safe automation of critical workflows without production risk
- Asynchronous domain deletion queue with transactional cleanup maintains data consistency across distributed systems
- Unified API routing via file-based dynamic exports reduces boilerplate and scales maintainably
- Client-side paste parsing for short links reduces user friction while preserving security boundaries
- Administrative actions like link banning are implemented as stateful UI components with embedded API logic, unifying UX and backend safety