|
1 | | -# Short |
2 | | - |
3 | | -## Prerequisites |
4 | | - |
5 | | -Installed: |
6 | | -- npm |
7 | | -- go |
8 | | -- templ |
9 | | -- air |
10 | | - |
11 | | -## Install dependencies |
12 | | - |
| 1 | +# Short - URL Shortener Service |
| 2 | + |
| 3 | +A modern, efficient URL shortener service built with Go and featuring a clean web interface. This application allows users to create short, memorable links from long URLs while providing analytics and tracking capabilities. |
| 4 | + |
| 5 | +## Features |
| 6 | + |
| 7 | +- **URL Shortening**: Convert long URLs into short, manageable links |
| 8 | +- **Analytics Tracking**: Monitor link usage with detailed analytics including: |
| 9 | + - Visitor country (using Cloudflare headers) |
| 10 | + - Referrer tracking |
| 11 | + - IP address logging |
| 12 | + - Timestamp tracking |
| 13 | +- **Performance Optimized**: |
| 14 | + - LRU caching for frequently accessed URLs |
| 15 | + - Efficient database queries |
| 16 | + - Fast redirect handling |
| 17 | +- **Security Features**: |
| 18 | + - Admin authentication system |
| 19 | + - Secure token handling |
| 20 | + - Environment-based configuration |
| 21 | + |
| 22 | +## Technical Stack |
| 23 | + |
| 24 | +- **Backend**: Go (Golang) |
| 25 | +- **Database**: SQL database for persistent storage |
| 26 | +- **Caching**: HashiCorp's LRU cache for performance optimization |
| 27 | +- **Infrastructure**: Docker support for easy deployment |
| 28 | +- **Development**: Hot-reload support with Air |
| 29 | + |
| 30 | +## Getting Started |
| 31 | + |
| 32 | +1. Clone the repository |
| 33 | +2. Copy `example.env` to `.env` and configure your environment variables |
| 34 | +3. Run the application: |
| 35 | + ```bash |
| 36 | + go run cmd/short/main.go |
| 37 | + ``` |
| 38 | + |
| 39 | +## Development |
| 40 | + |
| 41 | +The project uses Air for hot-reloading during development. Start the development server with: |
13 | 42 | ```bash |
14 | | -go install github.com/a-h/templ/cmd/templ@latest |
| 43 | +air |
15 | 44 | ``` |
16 | 45 |
|
17 | | -```bash |
18 | | -go install github.com/air-verse/air@latest |
19 | | -``` |
| 46 | +## Building |
20 | 47 |
|
| 48 | +Build the application using Docker: |
21 | 49 | ```bash |
22 | | -npm install |
| 50 | +docker build -t short . |
23 | 51 | ``` |
24 | 52 |
|
25 | | -## Run |
| 53 | +## License |
26 | 54 |
|
27 | | -```bash |
28 | | -air |
29 | | -``` |
| 55 | +This project is open source and available under the MIT License. |
0 commit comments