https://github.com/buemura/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.
https://github.com/buemura/url-shortener
golang postgresql redis templ
Last synced: 3 months ago
JSON representation
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.
- Host: GitHub
- URL: https://github.com/buemura/url-shortener
- Owner: buemura
- License: mit
- Created: 2024-08-15T03:03:29.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2024-08-17T00:43:59.000Z (almost 2 years ago)
- Last Synced: 2025-02-28T07:59:36.450Z (over 1 year ago)
- Topics: golang, postgresql, redis, templ
- Language: Go
- Homepage:
- Size: 240 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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
1. Install dependencies:
```bash
go mod tidy
```
2. Set up environment variables:
Create a `.env` file from `.env.exampl` and replace the values with your secrets
```bash
cp .env.example .env
```
3. Set up docker container
```bash
docker-compose up -d
```
4. Run the app
```bash
go run cmd/main.go
```
5. 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.