Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rimo02/go-bitly
url-shortener made using golang
https://github.com/rimo02/go-bitly
cache gin-gonic golang microservices mongodb rate-limiting url-shortener
Last synced: 15 days ago
JSON representation
url-shortener made using golang
- Host: GitHub
- URL: https://github.com/rimo02/go-bitly
- Owner: rimo02
- Created: 2024-10-12T14:03:10.000Z (about 1 month ago)
- Default Branch: main
- Last Pushed: 2024-11-03T06:33:08.000Z (16 days ago)
- Last Synced: 2024-11-03T07:20:39.053Z (16 days ago)
- Topics: cache, gin-gonic, golang, microservices, mongodb, rate-limiting, url-shortener
- Language: Go
- Homepage:
- Size: 21.1 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# URL Shortener
A simple URL shortener service built with Go, Gin, MongoDB, and rate limiting. This service allows users to shorten URLs, track the number of clicks, set custom expiration times, and limit requests based on IP addresses.
## Features
- URL Shortening: Converts long URLs into shorter, more manageable URLs.
- Custom Expiration: Users can specify expiration times for their URLs in days, hours, and minutes.
- Rate Limiting: Limits the number of requests from a single IP to prevent abuse. Individual users are allowed upto maximum of 100 requests per hour.
- Analytics: Tracks how many times each shortened URL has been clicked.
MongoDB Integration: Stores shortened URLs, expiration times, and hit counts in MongoDB.
- Added functionality for in-memory caching using Redis that stores the most frequently accessed urls for faster retrieval.### Usage Example
Copy paste this code in your terminal
```
docker-compose up --build
`````` bash
curl -X POST http://localhost:8080/shorten \
-H "Content-Type: application/json" \
-d '{
"lurl": "https://example.com",
"days": 1,
"hours": 12
}'
```You should get a sample shortened url as `http://localhost:8000/abc123`