A modern URL shortener with analytics built as a monorepo using Next.js and NestJS.
LinkLens/
├── apps/
│ ├── api/ # NestJS backend API
│ └── web/ # Next.js frontend
├── packages/
│ └── shared/ # Shared types and utilities
├── package.json # Root package.json with workspace config
└── README.md
- Node.js 18+
- npm 9+
- PostgreSQL database
git clone <your-repo-url>
cd LinkLens
npm install# Copy environment template
cp .env.example .env
# Edit .env with your database credentials and JWT secret# Generate Prisma client and run migrations
npm run db:generate
npm run db:migrate# Start all services
npm run dev:all
# Or start individually
npm run dev:api # API on http://localhost:3001
npm run dev:web # Web on http://localhost:3000npm run dev- Start all apps in development modenpm run dev:all- Start API and Web concurrentlynpm run build- Build all appsnpm run test- Run tests in all workspacesnpm run lint- Lint all workspacesnpm run clean- Clean all build outputs
npm run dev:api- Start API in development modenpm run build:api- Build API for productionnpm run start:api- Start API in production modenpm run db:generate- Generate Prisma clientnpm run db:migrate- Run database migrationsnpm run db:seed- Seed database with sample data
npm run dev:web- Start web app in development modenpm run build:web- Build web app for productionnpm run start:web- Start web app in production mode
- Framework: NestJS
- Database: PostgreSQL with Prisma ORM
- Authentication: JWT with Passport
- Validation: Class Validator & Class Transformer
- Documentation: Swagger/OpenAPI
- Analytics: Custom tracking with geolocation
- Framework: Next.js 14 with App Router
- Styling: Tailwind CSS
- State Management: TanStack Query (React Query)
- Forms: React Hook Form with Zod validation
- UI Components: Custom components with Tailwind
- Language: TypeScript
- Validation: Zod schemas
- Linting: ESLint + Prettier
- Package Manager: npm workspaces
Built with ❤️ using the power of monorepos!
- 📊 Charts: Chart.js
- ✅ Shorten any URL
- 🔁 Custom aliases (
/my-brand-link) - 📆 Expiry date for links
- 📈 Track:
- Click counts
- Location by IP
- Browser & OS info
- 📊 Admin dashboard with:
- Realtime stats
- Top-performing links
- Daily click trends
- 👤 Authenticated user support (optional)
| Layer | Tech |
|---|---|
| Frontend | Next.js, Tailwind CSS |
| Backend | NestJS |
| Database | MongoDB or PostgreSQL |
| Charts | Chart.js |
| Geolocation | IPinfo / GeoLite2 |
| Device Info | UA Parser |
- Node.js 18+
- MongoDB or PostgreSQL
- Redis (optional for caching)
- IPInfo or MaxMind API key (optional)
# Clone the repo
git clone https://github.com/AnantaPodder/linklens.git
cd linklens
# Install backend
cd server
npm install
# Install frontend
cd ../client
npm install