A simple URL Shortener built using:
ā
Shorten long URLs with a custom alias (optional)
ā
Fast and lightweight using Redis for storage
ā
Simple API with rate-limiting
ā
Fully containerized for easy deployment
To Change Your App's Domain During Development, Modify The .env File in ./api
Ensure you have Docker and Docker Compose installed.
To build and run the application, execute:
docker-compose up -d
This will:
http://localhost:5173.http://localhost:3000.To stop the application:
docker-compose down
āāā frontend/ # Svelte + Vite frontend
āāā backend/ # Go Fiber backend
āāā docker-compose.yml # Docker Compose config for the project
|āā db # Location Of Dockerfile Configuration For Redis
āāā README.md # This file
POST /api/shorten
{
"url": "https://example.com",
"short": "{ your own custom short }" // Its Optional, You Can Omit This
}
{
"url": "https://example.com",
"short": "http://localhost:3000/myalias",
"expiry": 3600,
"rate-limit": 9,
"rate-limit-reset": 60
}
GET /{short_url}
For local development:
cd frontend
npm install
npm run dev
cd backend
go mod tidy
go run main.go
docker run --name redis -p 6379:6379 -d redis
To deploy using Docker Compose:
docker-compose up -d --build
This will run the services in detached mode (-d).
This project is licensed under the MIT License.
I would like to acknowledge Akhil Sharma for the wonderful tutorial series on golang and redis.
Feel free to submit issues or PRs to improve this project!