/go-shortener-url

This repository is a case study based on the book system design interview. Its implementation is based on building an api for url shortening using golang and redis

Primary LanguageGo

Motivation

The motivation behind this project is to learn more about system design and how to build a scalable system. The book system design interview is a great resource to learn about system design and this project is based on the case study of building a url shortener.

Table of Contents

Requirements

  • Docker
  • Docker Compose
  • Golang

How to run

  1. Clone the repository
  2. Run docker-compose up to start the redis server
  3. Run go run main.go to start the server
  4. Run go test ./... to run the tests

API

POST /shorten

Request body:

{
    "url": "https://www.google.com"
}

Response body:

{
    "shortened_url": "http://localhost:8080/1"
}

GET /:id

Response body:

{
    "url": "https://www.google.com"
}

Architecture

Architecture

References