This project visualizes visitor data on an interactive world map using Leaflet.js. Visitor IPs are captured, geolocated using the ipinfo.io API, and displayed as markers on the map along with their city, country, and coordinates.
- block /static/ access from 443 connecting clients
- lockdown api endpoints
- modify ports etc for env or docker file
- Captures visitor IP addresses.
- Geolocates visitors to determine their city, country, and coordinates.
- Displays visitors as pins on an interactive world map.
- Backend: Go (Golang)
- Database: SQLite
- Frontend: HTML, CSS, Leaflet.js
- IP Geolocation: ipinfo.io
- Containerization: Docker, Docker Compose
- Web Server: Nginx (optional for production)
- Go 1.23 or higher
- Docker and Docker Compose (optional)
- SQLite
- An ipinfo.io API token for IP geolocation.
- clone
touch .env
- append
IPINFO_TOKEN=<your-ipinfo-io-token>
to .env export GO_MAP_PORT=<port>
make build port=<port>
make run
ormake run-beta
Method: GET
Description: Returns a list of all visitors, including their IP address, city, country, latitude, and longitude.
Response Example:
[
{
"IP": "2602:79:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx",
"Latitude": 39.9524,
"Longitude": -75.1636,
"City": "Philadelphia",
"Country": "US"
},
{
"IP": "185.195.xxx.xxx",
"Latitude": 51.5085,
"Longitude": -0.1257,
"City": "London",
"Country": "GB"
}
]
Method: GET
Description: Returns the number of unique visitors.
Response Example:
{
"unique_visitors": 5
}
**Description:**Provides a breakdown of unique and returning visitors. Method: GET
Response Example: Returns a JSON object:
{
"unique_visitors": 42,
"returning_visitors": 10
}
**Description:**Provides the number of visitors grouped by date for trend analysis. Method: GET
Response Example: Returns a JSON object:
{
"dates": ["2024-11-17", "2024-11-18", "2024-11-19"],
"visitor_counts": [15, 20, 30]
}