01The problem
Running affiliate content at scale needs publishing, link tracking and commission reporting tied together.
02What I did
Architected a Turborepo monorepo: a NestJS + Prisma API (tenants, offers, affiliate links, click events, commissions, content), a static Next.js blog, an authenticated dashboard, and a redirect service for tracked links, all sharing one package of types.
03The architecture
PlatformHub is an early-stage platform, and this is mostly a story about its design. It is a TypeScript monorepo: a NestJS API, a Next.js dashboard with Clerk sign-in, a statically exported blog, and a Cloudflare Worker for links.
Every table is scoped by tenant from the start. Today there is one tenant, but it can become a multi-tenant product without rewriting the schema. The data model covers offers, affiliate links, clicks, commissions and content across nine niches, ten affiliate networks and five channels.
04Fast redirects
Affiliate links have to be instant. Each short link is looked up in Cloudflare KV at the edge and redirected straight away, so a click never waits on the database. The click itself (country, browser) is logged in the background after the visitor has already moved on.
05The outcome
One codebase covers publishing, tracking and reporting, ready to host several sites as separate tenants.
06Tools & skills
- TypeScript
- NestJS
- Next.js
- Prisma
- Monorepo Architecture
- Multi-tenancy




