A production-style URL shortener with click analytics.
- Create short links (
POST /api/v1/links) withX-API-Keyheader - Redirect (
GET /r/{code}) recording timestamp, IP hash (peppered), user-agent, referrer - Stats summary (
GET /api/v1/links/{code}/stats) - Pagination & search (
GET /api/v1/links?query=&page=&size=) - Swagger UI at
/swagger-ui/index.html
./mvnw spring-boot:run
# or
mvn spring-boot:runDev profile is active by default (H2 in-memory).
docker compose up --build# Create
curl -s -X POST http://localhost:8080/api/v1/links -H "Content-Type: application/json" -H "X-API-Key: dev-key" -d '{"targetUrl":"https://example.org","customCode":"hello","createdBy":"manal"}'
# Redirect
curl -i http://localhost:8080/r/hello
# Stats
curl -s http://localhost:8080/api/v1/links/hello/statsmvn -q -DskipTests package
mvn testA minimal GitHub Actions workflow runs mvn -B -ntp -q -DskipTests verify on pushes & PRs.