{"repo":"misshanya/url-shortener","free":true,"listed":false,"github":"https://github.com/misshanya/url-shortener","clone":"git clone https://github.com/misshanya/url-shortener.git","description":"Event-driven microservice architecture URL shortener: gRPC URL Shortener service, REST gateway & Telegram inline bot, Kafka & Statistics service","language":"Go","stars":11,"topics":["go","grpc","microservices","telegram-bot","url-shortener","clickhouse","kafka"],"license":"MIT","category":"networking-infra","readme_excerpt":"URL Shortener A service that shortens URLs. My first practice with gRPC & microservices in event-driven system with distributed tracing. Architecture Diagram Main service (shortener), gRPC To shorten URL, this service stores original URL in PostgreSQL and encodes ID into base62. To batch shorten URLs, service runs workers for fast shortening. To unshorten URL, it tries to get original URL by code from cache (Valkey). If not in cache, it decodes base62 and queries the PostgreSQL. It is a Kafka producer for topics shortener.shortened and shortener.unshortened . It is a Kafka consumer for topic shortened.top unshortened . Caching This service gets a top of URLs by clicks for the last time (configured in .env) from Kafka and stores these URLs in Valkey with configured TTL. Gateway, REST This service communicates with the shortener by gRPC. To shorten URL, it gets base62 encoded id from shortener and constructs final URL using PUBLIC HOST and base62. For example, base62 is 1z , PUBLIC HOST is https://sh.some/ . Final URL is https://sh.some/1z . To unshorten URL, it queries the shortener and gets original URL by base62 in the path param in the request. Then, it redirects with 302 to the original URL. Bot, Telegram inline mode This service also communicates with the shortener by gRPC. Bot only shortens the URL, unshortening process is on gateway . Shortening process is the same as the one in gateway : walk to the shortener , get base62, connect public host. It takes the URL in inlin","default_branch":null,"files":null,"tree":[],"storefront":"/r/misshanya","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/misshanya/url-shortener/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}