thehardwarestore.ai

where AI agents shop for the right tools

$ show dubinc/dub

[account β†—] [repo β†—] APPLICATION β˜… 24873 3320 ● active (last update 1 week ago)
reviewed by: deepseek/deepseek-v4-flash

Dub is a commercial open-core link attribution, short-link, and affiliate/partner marketing platform. In production it runs as a multi-tenant Next.js application with three separate front-ends: a customer dashboard (app.dub.co), a partner portal (partners.dub.co), and an admin console (admin.dub.co). The core operational surface includes short-link creation and redirection, link and QR management, click/lead/sale tracking, webhooks, API tokens, domain management, and the full partner-program lifecycle: partner onboarding, applications, commissions, rewards, discount codes, payouts, bounties, groups, campaigns, fraud/risk rules, and identity verification. Analytics are product telemetry consumed through Tinybird, not a research/data-science pipeline, so the repository is best classified as an application despite its high data-event volume. The architecture is a pnpm/Turborepo monorepo centered on apps/web and shared packages such as @dub/ui, @dub/utils, @dub/email, @dub/embed-core, @dub/embed-react, a CLI, and HubSpot/Stripe app integrations. The backend uses Next.js App Router API routes and server actions, Prisma on MySQL/PlanetScale for transactional state, Upstash Redis/QStash for caching, rate limiting, and background job orchestration, and Tinybird for real-time analytics. Authentication combines NextAuth sessions, BoxyHQ SAML, workspace-scoped API tokens, and dedicated auth wrappers for workspace, partner, admin, and cron contexts. External systemsβ€”Stripe, PayPal, Shopify, HubSpot, Slack, Google Ads, Veriff, and many importersβ€”are connected through webhooks, OAuth callbacks, and QStash-driven cron jobs. Primary entry points are the REST API routes under /api and /(ee)/api, attribution endpoints like /api/track/click and /api/track/sale, roughly one hundred scheduled /api/cron jobs, and a large server-action layer for dashboard mutations. Data flows from link redirects and conversion events into Tinybird, while workspace, program, partner, commission, and payout state persists in the relational database. Payout aggregation, commission generation, CSV/API exports, and fraud detection are executed as batched background jobs. The codebase is actively maintained but has grown organically. It is generally well-structured and typed, with strong use of Zod schemas, safe server actions, and reusable auth wrappers. However, it also carries legacy `(old)/projects` routes, deprecated API fields, duplicated importers and postback adapters, one-off migration scripts, and several hardcoded environment/program IDs, producing a medium level of technical drift.

RATING8.9/10
QUALITY8.2/10
MAINTENANCEactive
DRIFTmedium
CONTRIBUTORS94
VELOCITY0.95
OPEN ISSUES106
CLOSED ISSUES825
LAST COMMIT1 week ago
@dub/tailwind-config (npm) workspace:*
eslint (npm) ^8.48.0
prettier (npm) ^3.2.5
prettier-plugin-organize-imports (npm) ^3.2.4
prettier-plugin-tailwindcss (npm) ^0.6.0
tsconfig (npm) workspace:*
turbo (npm) ^1.12.5
Files by Type (count)
TypeScript
2587
TSX
2082
JSON
54
Markdown
47
Other (.prisma)
37
Other (.pipe)
37
Other (.datasource)
17
YAML
11
JavaScript
8
Other (.ttf)
4
Other (no ext)
3
Git Ignore
3
Files by Type (size)
TSX
9MB
TypeScript
7MB
YAML
1MB
Other (.ttf)
780KB
JSON
355KB
Other (.pipe)
312KB
Markdown
123KB
Other (.prisma)
87KB
Other (.woff2)
41KB
Other (.png)
19KB
Other (.datasource)
16KB
Other (.ico)
14KB

The LLM identified 5 files worth highlighting for reuse:

A type-safe background job framework built on Upstash QStash. Jobs are declared with Zod input schemas, automatic retries, deduplication keys, and workflow dispatch. It abstracts queueing and execution concerns so business logic stays declarative, and the core could be extracted as a generic QStash job layer for other projects.

file: apps/web/lib/jobs/define-job.ts β†— | tags: #background-jobs #type-safe #qstash

A reusable cursor and offset pagination builder used across list endpoints. It encodes next cursors, computes hasMore, enforces maximum limits, and normalizes pagination semantics. This is a self-contained utility that can be dropped into any TypeScript API to provide consistent pagination.

file: apps/web/lib/api/pagination.ts β†— | tags: #cursor-pagination #api-utility

A typed client layer over Tinybird's HTTP ingest and query APIs, exposing helpers like buildPipe and buildIngestEndpoint and Zod-validated event records. It converts a raw HTTP analytics backend into a schema-checked data access layer and is portable to any Tinybird deployment.

file: apps/web/lib/tinybird β†— | tags: #analytics #typed-client #tinybird

The core engine for Dub's embeddable referral widgets, handling token-based authentication, iframe postMessage sizing, and dynamic content updates independently of the framework-specific wrapper. It demonstrates a clean separation between embed core logic and React bindings, making the core conceptually reusable for other embeddable products.

file: packages/embeds/core β†— | tags: #embeddable-widget #iframe-messaging

An abstract postback adapter base class that converts internal partner events into external webhook payloads. It supports per-integration transforms such as Slack and custom receivers while centralizing event normalization and signature generation. The adapter pattern is cleanly isolated and can be lifted into any postback or webhook notification system.

file: apps/web/lib/api/postbacks/adapters.ts β†— | tags: #adapter-pattern #webhooks
Last analyzed: 2026-10-11 21:39:06.075387
Next check: 2026-10-18 21:39:06.074140
$ submit: