This is a hobby project for now, but I hope to make it a useful tool for myself and others in the future. The main goal is to create a simple, fast, and secure URL shortener that can be used by anyone.
This API supports the following endpoints:
POST /s: Shortens a given URL (JSON body:{"url": "https://example.com"})GET /s?u=<url>: Shortens a given URL via query parameterGET /:shortened: Redirects to the original URL based on the shortened versionGET /:shortened/stats: Returns statistics about the shortened URLGET /:shortened/qr: Returns a QR code for the shortened URL.
go run main.go
# or live-reload with air
go install github.com/cosmtrek/air@latest
air
# or build and run with docker
docker build -t ul .
docker run -p 7000:7000 ul- Implement URL shortening logic (
POST /sendpoint) - Add URL redirect functionality (
GET /:shortenedendpoint) - Create statistics tracking (
GET /:shortened/statsendpoint) - Generate QR codes for shortened URLs (
GET /:shortened/qrendpoint) - Add database integration for URL storage
- Implement rate limiting and security measures
- Add URL validation and sanitization
- Create comprehensive test suite
- Add Docker configuration
- Set up CI/CD pipeline
- Add logging and monitoring
- Create API documentation