A backend URL shortener built with Spring Boot, PostgreSQL, Redis, and Docker.
Allows users to:
- Convert long URLs into short codes
- Redirect short URLs to original destinations
- Track number of clicks per URL
- Persist data in a relational database
- Prepare for caching with Redis
- Java 17
- Spring Boot
- Spring Web (REST API)
- Spring Data JPA
- PostgreSQL
- Redis
- Docker
- Maven
The project follows a layered architecture:
-
Controller Layer
- Handles HTTP requests and responses
- Maps API endpoints
-
Service Layer
- Contains business logic
- Handles URL generation and click tracking
-
Repository Layer
- Interfaces with PostgreSQL using Spring Data JPA
-
Entity Layer
- Represents database tables
-
DTO Layer
- Handles request and response objects
- Request
{ "url": "https://example.com" }
-Response
{ "originalUrl": "https://example.com", "shortCode": "abc123", "shortUrl": "http://localhost:8080/abc123" }