[Open Source] Shorten hyperlinks to build a high-performance short URL service platform that can be deployed quickly
![[Open Source] Shorten hyperlinks to build a high-performance short URL service platform that can be deployed quickly](https://yy123.ink/api/img/1782607045427-0itrbz.jpg)
1. Project Overview
u - Short URL Platform
Short, shorter, shortest! As short as possible. Shorten your hyperlinks.
Designed to build a high-performance short URL service platform that can be deployed quickly
2. Open Source License
Licensed under GPL-3.0
3. Screenshots
Web Interface Screenshots

4. Feature Overview
What Can It Do?
We have all used short links to some extent. A short link is a shorter URL generated from a longer original URL. Visiting the short link redirects users to the corresponding original URL. The benefits include:
- More attractive URLs;
- Easier to save and share;
- Short links save characters when publishing content on websites with character limits.
I only shorten your hyperlinks, making them short and sweet. No... not you, just your URLs.
System Overview:
- A short URL platform implemented using Spring Boot and Redis
Current Features
- Supports creating short URLs through both web and API interfaces
- Supports resolving short URLs through the API
Planned Features
- Will support dynamic configuration and management through a web console
- Add monitoring features
- Support a wider range of API operations
- ...
5. Tech Stack
Using the API
Access Key Id (AK) identifies the user, while Secret Access Key (SK) is the key used by the user to encrypt authentication strings and by cloud service providers to verify those strings.
- You must first obtain authorization for your AK and SK before accessing the API. Of course, you can disable this authentication requirement in your own system.
- Simply comment out the following code in com.github.niu.u.config.WebConfig to disable authentication.
// Add an API permission interceptor to intercept all API requests
registry.addInterceptor(apiAccessInterceptor).addPathPatterns("/api/v1/**");
The default AK and SK settings are configured in the com.github.niu.u.init.BootInit class. This feature will be further improved in future versions. Stay tuned!
- If you use AK and SK authentication, you need to add the following values to the request headers or request parameters:
"ak" :"your_ak" "sk" :"your_sk"
- API Usage Example (Generate Short URL)
post [http://127.0.0.1:8080/api/v1/generate?ak=ak_123&sk=sk_123
type](http://127.0.0.1:8080/api/v1/generate?ak=ak_123\&sk=sk_123
type) application/json
body {
\"url\":\"[https://www.baidu.com/s?wd=a&rsv_spt=1&rsv_iqid=0xd1a6a2e5000e2bc1&issp=1&f=8&rsv_bp=1&rsv_idx=2&ie=utf-8&tn=baiduhome_pg&rsv_enter=1&rsv_dl=tb&rsv_sug3=1&rsv_sug2=0&rsv_btype=i&inputT=509&rsv_sug4=509\](https://www.baidu.com/s?wd=a\&rsv_spt=1\&rsv_iqid=0xd1a6a2e5000e2bc1\&issp=1\&f=8\&rsv_bp=1\&rsv_idx=2\&ie=utf-8\&tn=baiduhome_pg\&rsv_enter=1\&rsv_dl=tb\&rsv_sug3=1\&rsv_sug2=0\&rsv_btype=i\&inputT=509\&rsv_sug4=509\\)",
\"valid\":14400
}
Parameter Description: url is the long URL to be submitted
valid is the validity period (in seconds). The default is four hours. It can be omitted. Use -1 for permanent validity.
respone {\"code\": 1,
\"success\": true,
\"msg\": \"ok\",
\"data\": {
\"orgUrl\": \"[https://www.baidu.com/s?wd=a&rsv_spt=1&rsv_iqid=0xd1a6a2e5000e2bc1&issp=1&f=8&rsv_bp=1&rsv_idx=2&ie=utf-8&tn=baiduhome_pg&rsv_enter=1&rsv_dl=tb&rsv_sug3=1&rsv_sug2=0&rsv_btype=i&inputT=509&rsv_sug4=509\](https://www.baidu.com/s?wd=a\&rsv_spt=1\&rsv_iqid=0xd1a6a2e5000e2bc1\&issp=1\&f=8\&rsv_bp=1\&rsv_idx=2\&ie=utf-8\&tn=baiduhome_pg\&rsv_enter=1\&rsv_dl=tb\&rsv_sug3=1\&rsv_sug2=0\&rsv_btype=i\&inputT=509\&rsv_sug4=509\\)",
\"shortUrl\": \"[http://127.0.0.1:8080/u/ff185ccd0439f762\](http://127.0.0.1:8080/u/ff185ccd0439f762\\)",
\"shortTarget\": \"ff185ccd0439f762\",
\"validTime\": 14400
}
}
Core Dependencies
Dependency
Version
Spring Boot
2.3.6.RELEASE
Spring Boot Redis
2.3.6.RELEASE
layui
2.5.7
Environment Requirements
- Java 1.8.0_211
- Maven 3.6.3
- Redis 3.x
Modify application.yml
spring:
redis:
database: 1
host: 127.0.0.1
port: 6379
# password:
short_url:
server: [http://127.0.0.1:8080](http://127.0.0.1:8080) #This is the short URL server address