A full-stack link tracking and analytics platform built on Cloudflare infrastructure. Track link clicks, analyze geographic distribution, and manage dynamic link routing with real-time analytics.
- Link Management: Create, edit, and organize trackable links
- Geographic Routing: Route users to different destinations based on their location
- Real-time Analytics: Track clicks, monitor performance, and analyze user behavior
- Interactive Dashboard: Visual maps, charts, and tables for comprehensive analytics
- Authentication: Secure user authentication with Better Auth (Google OAuth)
- Real-time Updates: WebSocket connections for live click tracking
This is a monorepo built with modern technologies and deployed on Cloudflare:
- React 19 with TypeScript
- TanStack Router for routing
- TanStack Query for data fetching
- Tailwind CSS with Radix UI components
- React Simple Maps for geographic visualizations
- Socket.io for real-time updates
- Vite for build tooling
- Cloudflare Workers as serverless functions
- Hono web framework for API routing
- D1 Database for data persistence
- Durable Objects for stateful operations
- Queue Handlers for background processing
- Workflows for complex business logic
- AI integration with Cloudflare AI
βββ apps/
β βββ user-application/ # React frontend
β β βββ src/
β β β βββ components/ # UI components
β β β βββ routes/ # App routes & pages
β β β βββ hooks/ # Custom React hooks
β β β βββ lib/ # Utility libraries
β β β βββ styles/ # CSS and styling
β β β βββ utils/ # Helper functions
β β βββ worker/ # Cloudflare Worker for tRPC
β βββ data-service/ # Backend API service
β βββ src/
β βββ durable-objects/ # Cloudflare Durable Objects
β βββ helpers/ # Utility functions
β βββ hono/ # Hono app configuration
β βββ queue-handlers/ # Background job processing
β βββ workflows/ # Business logic workflows
βββ packages/
β βββ data-ops/ # Shared data operations
β βββ db/ # Database schemas & queries
β βββ better-auth/ # Authentication configuration
β βββ zod/ # Schema validation
βββ pnpm-workspace.yaml # Workspace configuration
- Node.js 18+
- pnpm
- Cloudflare account (for deployment)
# Install dependencies
pnpm installEnvironment variables are documented in .env.example. Copy the indicated sections into:
packages/data-ops/.envβ Drizzle / D1 migrationsapps/user-application/.envβ Vite (VITE_BASE_HOST)apps/user-application/.dev.varsβ local Worker secrets forpnpm dev
# Start the frontend development server
pnpm dev-frontend
# Start the backend data service
pnpm dev-data-service
# Build packages
pnpm build-packageThe frontend will be available at http://localhost:3000
Root Level:
pnpm dev-frontend- Start frontend development server on port 3000pnpm dev-data-service- Start backend service with Wrangler remote bindingspnpm build-package- Build shared data-ops packagepnpm stage:deploy-frontend- Deploy frontend to staging environmentpnpm prod:deploy-frontend- Deploy frontend to production environment
Frontend (user-application):
pnpm dev- Development server with Vitepnpm build- Build for stagingpnpm prod:build- Build for productionpnpm test- Run Vitest testspnpm stage:deploy- Deploy to stagingpnpm prod:deploy- Deploy to production
Backend (data-service):
pnpm dev- Development with Wrangler remote bindingspnpm test- Run Vitest tests with Workers poolpnpm stage:deploy- Deploy to staging environmentpnpm prod:deploy- Deploy to production environment
Data Operations (packages/data-ops):
pnpm build- Build TypeScript to dist/pnpm migrate- Run database migrationspnpm generate- Generate Drizzle schemaspnpm studio- Launch Drizzle Studio
- Create trackable short links
- Edit link names and destinations
- Support for default and geographic-specific destinations
- Link performance analytics
- Route users based on their country/location
- Configure different destinations per geographic region
- Visual geographic analytics with interactive maps
- Real-time click tracking
- Geographic distribution maps
- Top countries and cities analysis
- Link performance metrics
- Problematic links identification
- WebSocket integration for live click updates
- Real-time dashboard updates
- Live geographic click visualization
The project is configured for deployment on Cloudflare with staging and production environments:
# Deploy frontend to staging
pnpm stage:deploy-frontend
# Deploy backend to staging
cd apps/data-service
pnpm stage:deploy# Deploy frontend to production
pnpm prod:deploy-frontend
# Deploy backend to production
cd apps/data-service
pnpm prod:deployThe project uses Cloudflare Workers with environment-specific configurations in apps/*/wrangler.jsonc:
- Staging:
stage - Production:
production
Update bindings (D1 IDs, KV, queues, routes, service names) for your Cloudflare account, then use Wrangler secrets for OAuth and APP_SECRET. See .env.example for variable names and deploy order (data-service before user-application).
# Run tests for user application
cd apps/user-application
pnpm test
# Run tests for data service
cd apps/data-service
pnpm test- Authentication handled by Better Auth
- Type-safe APIs with tRPC and Zod validation
- Secure environment variable management
- Metrics Cards: Overview of key performance indicators
- Active Areas Map: Visual representation of click locations
- Regional Analysis: Country and city-based click distribution
- Link Performance: Individual link analytics and troubleshooting
- Real-time Monitoring: Live click tracking and updates
- React 19 with TypeScript for modern UI development
- TanStack Router for file-based routing with type safety
- TanStack Query for efficient data fetching and caching
- Tailwind CSS v4 with Radix UI components for styling
- Framer Motion for smooth animations
- React Simple Maps for geographic data visualization
- Socket.io Client for real-time updates
- Vite for fast development and building
- Cloudflare Workers for serverless edge computing
- Hono lightweight web framework for Workers
- Cloudflare D1 SQLite database at the edge
- Drizzle ORM for type-safe database operations
- Cloudflare Durable Objects for stateful operations
- Cloudflare Queues for background job processing
- Cloudflare Workflows for complex business logic
- Cloudflare AI for AI-powered features
- TypeScript for end-to-end type safety
- Better Auth for authentication
- Zod for runtime schema validation
- pnpm Workspaces for monorepo management
- Vitest for unit and integration testing
- Wrangler for Cloudflare deployment and development
ISC License New