URL Shortener
A simple URL shortener application built with Golang, Postgres, and Redis. This app takes a long URL provided by a user and returns a shortened version. The shortened URLs can be stored and retrieved efficiently using Redis for quick lookups and Postgres for persistence.
Architecture diagram
Features- Shorten long URLs
- Store and retrieve URLs using Postgres and Redis
- Redirect users to the original URL when the shortened link is accessed
Tech Stack-Backend: Golang
-Database: Postgres (for persistence) -Cache: Redis (for fast lookups)
Setup
- Install dependencies:
go mod tidy
- Set up environment variables:
Create a
.env
file from .env.exampl
and replace the values with your secrets
cp .env.example .env
- Set up docker container
docker-compose up -d
- Run the app
go run cmd/main.go
- Open browser at
http://localhost:8080
Contributing
Contributions are welcome! Please open an issue or submit a pull request.
License
This project is licensed under the MIT License.