Developed a URL shortener project with a primary focus on generating concise and short URLs. It includes implementation of Redis caching to optimize performance. Moreover, a rate-limiting feature has been integrated to enhance both security and scalability aspects of the system.
- Go
- Redis
- NGINX
- MongoDB
- Docker
- GitHub Actions
- AWS ECR
-
Expiry for Short URLs: Easily create short URLs with optional expiration dates. After the specified expiry, the short link becomes invalid. If no expiry is provided during link generation, a default expiry of 1 year is applied.
-
Efficient Caching and Database Integration: Store recently used short URLs in cache for rapid access. If a URL is absent from cache, the system seamlessly checks the MongoDB database. Cached URLs are returned and stored, while missing URLs trigger database queries, with results both stored in cache and returned to users.
-
Smart Cache Management: Employ the
maxmemory-policy allkeys-lfu
configuration for Redis caching. When memory reaches its limit, the system intelligently removes the least used URLs, ensuring space for frequently accessed ones and optimizing memory usage. -
Spam Protection with Nginx Rate Limiting: Bolster system integrity by implementing rate limiting through an Nginx reverse proxy. This safeguard prevents spam requests from generating random URLs, effectively reducing server load and maintaining overall performance.
-
Data Consistency: By periodically running the Database Purge API, We can guarantees that only valid and up-to-date short URLs remain accessible. This API is not accessible by user.
-
AWS ECR: Utilized GitHub Actions to automate the building and pushing of Docker images to AWS Elastic Container Registry (ECR) whenever code is pushed to the main branch, ensuring swift and accurate deployment with version-tagged images.
Running the project is straightforward. Follow these steps:
-
Ensure you have Docker installed on your system.
-
Open a terminal window and navigate to the project directory.
-
Run the following command to start the project using Docker Compose:
docker compose up
This command will set up and launch the required services, making your project accessible.
-
That's it! Your project is now up and running. Open your web browser and access the project using the provided URLs or endpoints.
Enjoy using the project!
Generate URL
- url : Add webpage url
- expiry: Add expiry time (in Hour)
AWS ECR