UrlShortener is a quick, open-source project for shortening URL, you can easily host your own URL shortener service with it, similar to TinyURL.com and 百度短网址, plus basic statistics over the data.
- Development based on Spring Boot and Redis.
- Support for building docker image by a maven plugin named dockerfile-maven-plugin.
- Support for configuring blacklist for long URL via domains.
- Providing REST APIs for shortening a URL and get the original URL.
- Providing extended REST APIs for data statistics, such as the most top N visited short URLs.
The minimum requirements to run the quick start are:
- JDK 1.8 or above
- Git
- Maven 3.5.3 or above
- Redis server
- Docker Engine
- A Java IDE like IntelliJ IDEA (optional)
- Clone
$ git clone https://github.com/rupertw/url-shortener.git $ cd url-shortener
- Modifiy application.properties, blacklist
#默认8080端口 #server.port=80 #域名 url.shortener.service.host=http://www.me #SnowFlake snowflake.datacenterId=1 snowflake.machineId=1 #Redis spring.redis.host=localhost spring.redis.port=6379 spring.redis.password=todo spring.redis.database=1 ...
#xxx.com yyy.com
- Build an image from the Dockerfile
$ mvn -DskipTests clean package -U $ mvn dockerfile:build
- Create a container layer over the new image, and then start it
$ docker run -p 80:8080 rupertw/url-shortener:1.0.0.RELEASE
- Test the REST APIs
http://127.0.0.1/swagger-ui.html
UrlShortener is released under the MIT License.