Skip to content

hetk987/Shortr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

19 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Shortr - Modern URL Shortener

Demo Video Architecture Live Demo

A production-ready URL shortener built with modern full-stack technologies, demonstrating microservices architecture, containerization, and responsive web design.

πŸ› οΈ Tech Stack

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

✨ Key Features

πŸ”— 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

πŸš€ Quick Start

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.sh

That's it! The application will build and start automatically.

🌐 Access Points

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

πŸ“Έ Demo

Shortr Demo

πŸ—οΈ Architecture

                    🌐 Nginx Reverse Proxy
        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
        β”‚         Port 80 β”‚ Port 3005             β”‚
        β”‚      (Redirects) β”‚ (Frontend UI)        β”‚
        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                    β”‚              β”‚
            β”Œβ”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
            β”‚   Backend    β”‚  β”‚   Frontend     β”‚
            β”‚  Express.js  β”‚  β”‚    Next.js     β”‚
            β”‚   Port 8080  β”‚  β”‚   Port 3000    β”‚
            β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                    β”‚
            β”Œβ”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”
            β”‚   Database   β”‚
            β”‚    SQLite    β”‚
            β”‚  + Prisma    β”‚
            β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Container Architecture

  • 🐳 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

Request Flow

  1. Short URL (/abc123) β†’ Nginx β†’ Backend β†’ Database β†’ Redirect
  2. Frontend (/) β†’ Nginx β†’ Next.js β†’ API calls β†’ Backend
  3. API calls (/api/*) β†’ Nginx β†’ Backend β†’ Database β†’ Response

πŸ› οΈ API Documentation

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}

Example API Usage

# 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/github

πŸ“ Project Structure

Shortr/
β”œβ”€β”€ 🎨 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

🎯 Development Highlights

Frontend Excellence

  • βœ… 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

Backend Robustness

  • βœ… RESTful API design
  • βœ… Database migrations with Prisma
  • βœ… Input validation and sanitization
  • βœ… Error handling with proper HTTP codes
  • βœ… Performance optimization (WAL mode)

DevOps Best Practices

  • βœ… Multi-stage Docker builds for optimization
  • βœ… Health checks for service monitoring
  • βœ… Environment configuration management
  • βœ… Single-command deployment
  • βœ… Nginx optimization for production

πŸ† Why This Project Stands Out

🎯 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

πŸš€ Deployment Options

Local Development

./start-shortr.sh

Production Deployment

  • 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

πŸ”§ Configuration

Environment Variables

# Backend
NODE_ENV=production
DATABASE_URL=file:/app/prisma/dev.db
PORT=8080

# Frontend
NEXT_PUBLIC_API_URL=http://backend:8080

πŸ“ž Contact & Questions

Built with ❀️ by Het Koradia

  • πŸ“§ Email: het.koradia.1@gmail.com
  • πŸ’Ό LinkedIn: linkedin.com/in/het-koradia
  • πŸ™ GitHub: github.com/hetk987

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors