Skip to content

psaia/dwarf

 
 

Repository files navigation

Dwarf

A performant URL shortener written in Go using a Redis as a store while exposing an interface for others. Uses gRPC for communication for high throughput.

How it works

GET /{short-hash}

This will result in a 301 redirect or a 404 not found.

Creating new shortened URL's via gRPC

service Dwarf {
	rpc Create(CreateRequest) returns (CreateResponse) {}
}

message CreateRequest {
	repeated string urls = 1;
}

message CreateResponse {
	repeated string urls = 2;
}

Your response will return a set of shortened urls in the same order:

{
  "urls": ["http://sh.ort/Mp", "http://sh.ort/uJ"]
}

A way to interface with this is by using this node client.

Development

Redis Store

Spin up an instance of redis with:

docker run -p "6379:6379" --rm --name dwarf-redis redis:4-alpine

Testing

go test github.com/LevInteractive/dwarf/ -v

Note that the tests relies on a running redis instance.

About

Just another O(1) URL shortener service. Go + Redis + gRPC.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 94.4%
  • Shell 3.1%
  • Dockerfile 2.5%