Skip to content

theresasogunle/shortlink

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ”— ShortLink - URL Shortener Service

A full-stack URL shortening service built with Java Spring Boot. This project demonstrates backend development skills including REST API design, database management, and cloud deployment.

πŸš€ Live Demo

API Base URL: https://shortlink-nmca.onrender.com

⚠️ Note: Hosted on Render's free tier - first request may take ~30 seconds (cold start).

πŸ“‹ Features

  • βœ‚οΈ Shorten long URLs to 6-character codes
  • πŸ”„ Automatic redirect from short links to original URLs
  • πŸ“Š Click tracking and analytics
  • βœ… URL validation
  • πŸ—„οΈ PostgreSQL database for persistent storage

πŸ› οΈ Tech Stack

Backend:

  • Java 21
  • Spring Boot 3.4.x
  • Spring Data JPA
  • PostgreSQL
  • Maven
  • Lombok

Deployment:

  • Docker
  • Render (PostgreSQL + Web Service)

πŸ“‘ API Endpoints

Shorten a URL

POST /api/shorten
Content-Type: application/json

{
  "url": "https://example.com"
}

Response:
{
  "id": 1,
  "originalUrl": "https://example.com",
  "shortCode": "aB3xY9",
  "shortUrl": "https://your-app.onrender.com/aB3xY9",
  "createdAt": "2025-11-27T10:30:00",
  "clickCount": 0
}

Redirect to Original URL

GET /{shortCode}
Redirects to the original URL and increments click count.

Get URL Statistics

GET /api/stats/{shortCode}

Returns analytics including click count and creation date.

πŸƒ Running Locally

Prerequisites

- Java 21
- Maven

πŸ“ License

MIT License - feel free to use this project for learning!

About

Url Shortener

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published