Implementing URL shortening with Go and Redis as cache with Rate Limiting

URL-Redis

Implementing URL shortening with Go and Redis as cache with Rate Limiting.

In this project I have tried to implement on of daily task used in any marketing or sales domain organisation which is URL Shortning using Go, Redis, Docker, Docker-compose. The backend is designed and developed in Golang while Redis is used as cache DB. I wanted to implement Rate limiting so i have also applied rate limiting to restrict the user for it and over burdening the server. I have wraped the application in Docker and using Docker compose the make a dev/prod ready containerised application.

The API Specs are below for raising the POST request
URL       string       json:"url"
CustomShort   string       json:"short"
Expiry      time.Duration   json:"expiry"

The response we will be getting in the below format(JSON)
URL         string      json:"url"
CustomShort      string      json:"short"
Expiry         time.Duration   json:"expiry"
XRateRemaining   int         json:"rate_limit"
XRateLimitReset    time.Duration   json:"rate_limit_reset"

For rate limiting, this logic applies to allow only 10 request per 30 min we can change it as per our requirement and the response shows how much time is left in resetting the request limiter.

Similar Resources

Go URL shortener

Golang Short URL To build the short link engine by Go. Development Environment: Ubuntu 20.04 Go 1.17.1 Requirement Console app, receive “URL” from any

Nov 4, 2021

This is a small API that provides basic REST endpoints to shorten a URL

This is a small API that provides basic REST endpoints to shorten a URL

This is a small API that provides basic REST endpoints to shorten a URL, get information about the URL, update the URL, and get statistics on most accessed URLs.

Nov 16, 2021

Url shortner service for golang

url-shortner-service Endpoints added 1.Health endpoint - to check if server is running or not http://localhost:8080/health HTTP method: GET 2.URL shor

Nov 21, 2021

A simple URL shortener application.

url-shortener A simple URL shortener application. Features The service supports 2 data stores (in-memory and PostgreSQL). The -db parameter is used to

Dec 9, 2021

Yandex practicum go url shortener service

go-musthave-shortener-tpl Шаблон репозитория для практического трека «Go в веб-р

Feb 26, 2022

Url Shortener Api For Golang

Url Shortener Api Using Go Endpoints Get and redirect to long url GET: "/:id" Cr

May 29, 2022

Simple URL shortener written in Golang

Alviss Introduction Simple URL shortener project, written in Golang. Setup and r

Aug 25, 2022

Urlshorter - A restful url shorter for golang

To who that review this code: I try my best to dockerize files and project but I

Dec 31, 2021

A sample url shortener app to test Keploy integration capabilities

A sample url shortener app to test Keploy integration capabilities

Example URL Shortener A sample url shortener app to test Keploy integration capabilities Installation git clone https://github.com/keploy/example-url-

Oct 22, 2022
Shortener - URL shortener with golang (Link shortening service)
Shortener - URL shortener with golang (Link shortening service)

URL shortener (Сервис сокращения размеров ссылки) Запуск приложения осуществляет

Feb 1, 2022
a url shortener made using go and redis

__ | |--.--.--.----.-----. .-----.-----. | <| | | _|-- __|__| _ | _ | |__|__|_____|__| |_____|__|___

Dec 10, 2020
The source code for workshop Scalable architecture using Redis as backend database using Golang + Redis

The source code for workshop Scalable architecture using Redis as backend database using Golang + Redis

Sep 23, 2022
Colonies is a generic framework for implementing next-generation distributed applications and systems
Colonies is a generic framework for implementing next-generation distributed applications and systems

Colonies is a generic framework for implementing next-generation distributed applications and systems. It can be used as a building block for grid computing or edge computing, e.g. implement a meta operating system or cloud-of-cloud platform that combines many execution environments into a new virtual computing environment that can be controlled using an single unified API.

Nov 14, 2022
A Golang package implementing the fastCDC chunking algorithm

go-fastcdc go-fastcdc is a Golang package implementing the fastCDC chunking algorithm. This is a work in progress. chunkerOpts := fastcdc.ChunkerO

May 26, 2022
A URL shortener using http://is.gd/ and the Go programming language (http://golang.org/)

goisgd A simple command line URL shortener using http://is.gd/. Getting the Code go get github.com/NickPresta/GoURLShortener Usage Import this librar

Apr 6, 2022
A barebones URL Shortener implementation in Go using Gin and MySQL. Also features a basic frontend.

URL Shortener in Go This is a barebones URL Shortener implementation in Go using the Gin web framework and MySQL. Also features a basic frontend. Loca

Dec 22, 2021
A simple demo written in Golang to shorten URL and redirect

url-shortener A simple demo written in Golang to shorten URL and redirect . ├── go.mod ├── go.sum ├── handler │ └── handlers.go ├── main.go ├── shor

Jun 5, 2022
urlsh is URL shortener application built on Go language.
urlsh is URL shortener application built on Go language.

GOlang URL shortener service with UI, API, Cache, Hits Counter and forwarder using postgres and redis in backend, bulma in frontend

Dec 11, 2022
longurl is a self-hosted short url service.

longurl Introduction longurl is a self-hosted short url service. Try It Out curl -H "Content-Type:application/json" -X POST --data '{"url": "https://g

Oct 24, 2022