FreeCodeCamp Backend Certification

URL Shortener Microservice

Transform long URLs into short, shareable links instantly. Fast, simple, and reliable URL shortening service.

Shorten Your URL

Paste your long URL below

Recent Shortened URLs

No URLs shortened yet

API Documentation

POST /api/shorturl

Submit a URL to be shortened. Send the URL in the request body.

Request Body:
{ "url": "https://www.google.com" }
Success Response:
{
  "original_url": "https://www.google.com",
  "short_url": 1
}
Error Response:
{ "error": "invalid url" }
GET /api/shorturl/:id

Visit a shortened URL to be redirected to the original URL.

Example:
GET /api/shorturl/1

→ Redirects to: https://www.google.com

Valid URL Formats

https://www.example.com
http://example.com/path
https://sub.domain.org
ftp://files.com
www.example.com
not-a-valid-url