π A lightweight, privacy-conscious API for logging click events and redirecting users while avoiding permanent IP storage.
- Log incoming user clicks via a simple API
- Capture and log user agent and IP (configurable to hash/store it)
- Timestamped records in a MySQL database
- Lightweight redirect handler with tracking
- Built with Spring Boot
Logs a click or visit event.
Request Body:
{
"hashedIp": "hashed_ip_1",
"userAgent": "user_agent_1"
}Returns all logged entries.
Logs the visit and redirects to the given URL.
Example:
/r?to=https://google.com
- Java 21
- Spring Boot 3
- MySQL (configurable)
- Maven
-
Clone the repo
git clone https://github.com/biagioiorio/public-ip-logger-api.git
-
Configure your
application.propertieswith your DB credentials:spring.datasource.url=jdbc:mysql://localhost:3306/public_ip_logger spring.datasource.username=root spring.datasource.password=yourpassword spring.jpa.hibernate.ddl-auto=update
-
Run the application:
./mvnw spring-boot:run
- Redirect with logging
- IP + User-Agent logging
- Optional IP hashing
-
.envsupport for credentials - Access stats endpoint
This project is licensed under the GNU General Public License v3.0 β see the LICENSE file for details.