Skip to content

Spring Boot URL shortener with PostgreSQL (JPA), Flyway migrations, validation, error handling, click analytics, and OpenAPI docs.

Notifications You must be signed in to change notification settings

nourassili/URLshortner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

URL Shortener (Spring Boot)

Run locally

  1. Start Postgres: docker-compose up -d
  2. Run the app: mvn spring-boot:run
  3. Swagger UI: http://localhost:8080/swagger-ui/index.html

Core Endpoints

  • POST /api/v1/urls → create short URL
  • GET /r/{code} → HTTP 302 redirect to long URL
  • GET /api/v1/urls/{code} → details + analytics
  • GET /api/v1/urls/{code}/clicks → paged click events

Example

curl -X POST http://localhost:8080/api/v1/urls   -H 'Content-Type: application/json'   -d '{"longUrl":"https://www.blackrock.com/aladdin/", "expiresAt":"2026-01-01T00:00:00Z"}'

About

Spring Boot URL shortener with PostgreSQL (JPA), Flyway migrations, validation, error handling, click analytics, and OpenAPI docs.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages