A high-performance URL shortener service built with .NET 8, featuring user authentication, caching, and containerized deployment. Designed to demonstrate full-stack development skills and system design capabilities.
- URL Shortening: Convert long URLs into short, shareable links
- URL Redirection: Fast redirect service with sub-millisecond response times
- Custom Short Codes: Option to create personalized short URLs (will be implemented on version 2)
- URL Expiration: Set time-based expiration for links (will be implemented on version 2)
- User Authentication: JWT-based authentication. system
- Track Click: Monitor total and per URL click counts
- User Dashboard: Manage personal URLs and view statistics (will be implemented on version 2)
- Rate Limiting: Prevent abuse with configurable rate limits (optional)
- Multi-layer Caching: Redis + In-memory caching for optimal performance
- Database Optimization: Indexed queries and efficient data models
- Containerized: Docker and Docker Compose setup
- Health Checks: Monitoring endpoints for deployment
- Structured Logging: Comprehensive logging with Serilog
- API Documentation: OpenAPI/Swagger integration
- Backend: ASP.NET Core 8 Web API
- Database: PostgreSQL with Entity Framework Core
- Caching: Redis + In-Memory caching
- Authentication: JWT tokens with ASP.NET Core Identity
- Containerization: Docker & Docker Compose
- Documentation: Swagger/OpenAPI
- Testing: xUnit, Moq, TestContainers
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β Load Balancer β β Web API β β Redis β
β βββββΆβ (.NET Core) βββββΆβ (Cache) β
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β
βΌ
βββββββββββββββββββ
β PostgreSQL β
β (Database) β
βββββββββββββββββββ
- PostgreSQL over NoSQL: Chosen for ACID compliance, rapid development, and excellent .NET integration
- Base62 Encoding: Using auto-incrementing IDs with Base62 encoding to avoid hash collisions
- Read-Optimized: Architecture optimized for 100:1 read-to-write ratio typical of URL shorteners
- Caching Strategy: Cache-aside pattern with Redis for hot URLs and in-memory cache for ultra-fast access
- .NET 8 SDK
- Docker & Docker Compose
- PostgreSQL (or use Docker)
- Redis (or use Docker)
# Clone the repository
git clone https://github.com/liadraz/URLite.git
cd URLite
# Start all services
docker-compose up -d
# The API will be available at http://localhost:8080
# Swagger documentation at http://localhost:8080/swagger
# Restore dependencies
dotnet restore
# Update database
dotnet ef database update
# Run the application
dotnet run --project src/URLite.Api
# Run tests
dotnet test
POST /api/urls
Content-Type: application/json
Authorization: Bearer {jwt-token}
{
"originalUrl": "https://example.com/very-long-url",
"customCode": "my-link", // optional
"expiresAt": "2024-12-31T23:59:59Z" // optional
}
GET /{shortCode}
# Redirects to original URL
GET /api/urls/{shortCode}/analytics
Authorization: Bearer {jwt-token}
POST /api/auth/register
Content-Type: application/json
{
"email": "[email protected]",
"password": "SecurePassword123!",
"confirmPassword": "SecurePassword123!"
}
POST /api/auth/login
Content-Type: application/json
{
"email": "[email protected]",
"password": "SecurePassword123!"
}
# Run all tests
dotnet test
# Run with coverage
dotnet test --collect:"XPlat Code Coverage"
# Run integration tests
dotnet test --filter Category=Integration
- Unit Tests: Core business logic and services
- Integration Tests: API endpoints with TestContainers
- Performance Tests: Load testing for redirect endpoints
Metric | Target | Achieved |
---|---|---|
URL Creation | < 100ms | ~45ms |
URL Redirect | < 10ms | ~3ms (cached) |
Concurrent Users | 1000+ | TBD |
URLs Stored | 10M+ | TBD |
# Database
DATABASE_URL=postgresql://user:password@localhost:5432/tinyurl
# Redis
REDIS_CONNECTION_STRING=localhost:6379
# JWT
JWT_SECRET_KEY=your-super-secret-key
JWT_EXPIRY_HOURS=24
# Rate Limiting
RATE_LIMIT_REQUESTS=100
RATE_LIMIT_WINDOW_MINUTES=1
# Build production image
docker build -t urlite-api .
# Run with production compose
docker-compose -f docker-compose.prod.yml up -d
- Azure: Container Apps or App Service
- AWS: ECS or Elastic Beanstalk
- GCP: Cloud Run or GKE
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
β If you found this project helpful, please give it a star on GitHub!
URLiet - Scalable URL shortener (Personal Project, 2023) Stack: .NET, PostgreSQL, Redis, Docker, JWT, xUnit Clean Architecture + DDD service with caching, analytics, and comprehensive testing.