A production-ready URL shortener built with modern full-stack technologies, demonstrating microservices architecture, containerization, and responsive web design.
Frontend:
- βοΈ React with TypeScript for type safety
- π¨ Next.js 15 for server-side rendering and optimization
- π Tailwind CSS for responsive, modern styling
- π§© shadcn/ui for accessible component library
Backend:
- π’ Node.js with Express.js for RESTful API
- ποΈ SQLite with Prisma ORM for type-safe database operations
- π Input validation and comprehensive error handling
- π Click tracking and analytics
DevOps & Infrastructure:
- π³ Docker containerization for easy deployment
- π Docker Compose for multi-service orchestration
- π Nginx reverse proxy for efficient request routing
π Custom Short Links - Create memorable, branded short URLs
π Analytics Dashboard - Track click counts and creation dates
β‘ Instant Redirects - Fast, reliable URL redirection
π± Mobile Responsive - Optimized for all device sizes
π‘οΈ Error Handling - Comprehensive validation and user feedback
Get the application running in under 30 seconds:
# Clone the repository
git clone https://github.com/hetk987/Shortr.git
cd Shortr
# Start all services with Docker
./start-shortr.shThat's it! The application will build and start automatically.
| Service | URL | Purpose |
|---|---|---|
| Frontend UI | http://localhost:3005 | Create and manage short links |
| Short URLs | http://localhost/`{alias}` | Redirect endpoint |
| API | http://localhost:3005/api | Backend API endpoints |
π Nginx Reverse Proxy
βββββββββββββββββββββββββββββββββββββββββββ
β Port 80 β Port 3005 β
β (Redirects) β (Frontend UI) β
βββββββββββββββββββββββββββββββββββββββββββ
β β
βββββββββΌβββββββ βββββΌβββββββββββββ
β Backend β β Frontend β
β Express.js β β Next.js β
β Port 8080 β β Port 3000 β
ββββββββββββββββ ββββββββββββββββββ
β
βββββββββΌβββββββ
β Database β
β SQLite β
β + Prisma β
ββββββββββββββββ
- π³ 3 Docker containers working in harmony
- π Nginx handles routing and serves as entry point
- β‘ Backend provides REST API with database operations
- π¨ Frontend delivers responsive React application
- Short URL (
/abc123) β Nginx β Backend β Database β Redirect - Frontend (
/) β Nginx β Next.js β API calls β Backend - API calls (
/api/*) β Nginx β Backend β Database β Response
| Method | Endpoint | Description | Request Body |
|---|---|---|---|
GET |
/ |
List all short links | - |
POST |
/ |
Create new short link | {alias, url} |
GET |
/:alias |
Redirect to target URL | - |
DELETE |
/:alias |
Delete short link | - |
PUT |
/ |
Update short link | {alias, url} |
# Create a short link
curl -X POST http://localhost:3005/api/ \
-H "Content-Type: application/json" \
-d '{"alias": "github", "url": "https://github.com"}'
# Get all links
curl http://localhost:3005/api/
# Test redirect
curl -I http://localhost/githubShortr/
βββ π¨ frontend/ # Next.js React application
β βββ src/app/ # App router pages
β βββ src/components/ # Reusable UI components
β βββ Dockerfile # Frontend container
β βββ package.json # Frontend dependencies
βββ β‘ backend/ # Express.js API server
β βββ src/index.js # Main server file
β βββ prisma/ # Database schema & migrations
β βββ lib/ # Prisma client
β βββ Dockerfile # Backend container
β βββ package.json # Backend dependencies
βββ π³ docker-compose.yml # Multi-service orchestration
βββ π nginx.conf # Reverse proxy configuration
βββ π start-shortr.sh # One-command startup script
βββ π README.md # Project documentation
- β TypeScript for compile-time safety
- β Responsive design with Tailwind CSS
- β Component architecture with shadcn/ui
- β Real-time updates and error handling
- β Accessibility following WCAG guidelines
- β RESTful API design
- β Database migrations with Prisma
- β Input validation and sanitization
- β Error handling with proper HTTP codes
- β Performance optimization (WAL mode)
- β Multi-stage Docker builds for optimization
- β Health checks for service monitoring
- β Environment configuration management
- β Single-command deployment
- β Nginx optimization for production
π― Production-Ready Code
- Clean, well-documented, and maintainable
- Follows industry best practices and conventions
- Comprehensive error handling and validation
π Modern Technology Stack
- Uses current versions of popular frameworks
- Demonstrates knowledge of containerization
- Shows understanding of microservices architecture
π οΈ Technical Problem Solving
- Efficient database design with click tracking
- Smart URL validation with protocol handling
- Optimized reverse proxy configuration
π± User Experience Focus
- Responsive design works on all devices
- Intuitive interface with real-time feedback
- Accessibility considerations built-in
./start-shortr.sh- Railway:
railway up(configure environment variables) - DigitalOcean: Use App Platform with Docker Compose
- AWS/GCP: Deploy containers to ECS/Cloud Run
- Self-hosted: Use any Docker-capable server
# Backend
NODE_ENV=production
DATABASE_URL=file:/app/prisma/dev.db
PORT=8080
# Frontend
NEXT_PUBLIC_API_URL=http://backend:8080Built with β€οΈ by Het Koradia
- π§ Email: het.koradia.1@gmail.com
- πΌ LinkedIn: linkedin.com/in/het-koradia
- π GitHub: github.com/hetk987
