URL Shortener

2026-09


Tech Stack

For the frontend, I used simple HTML, CSS, and JavaScript, served directly by Go’s http.FileServer.

The backend is built with Go’s net/http package, with go-sqlite3 for the database. Everything runs inside a simple Docker container.


URL Shortener screenshot

Database

The data is stored in a SQLite database. Each link contains the target URL, its short code, the number of visits, and the creation date:

idtarget_urlurlvisitscreated_at
1https://example.coma2iD02026-09-18T08:30:42.872838+02:00
2https://imbouttu.buzznS3212026-09-18T10:30:14.225158+02:00

API


The API provides routes for fetching link statistics and all stored links.

For example:

http.HandleFunc("GET /link/stats/{url}", api.Stats)
http.HandleFunc("GET /links/all/", api.All)

These endpoints return the requested data as JSON. For example:
{
  "Id": 1,
  "Target_url": "https://example.com",
  "Url": "a2iD",
  "Visits": 0,
  "Created_at": "2026-09-18T08:30:42.872838+02:00"
}