The Nautilus Tracker Backend API is a server-side solution designed to provide easy access to GPS tracking data stored in a MySQL database. Built using PHP, it exposes endpoints to retrieve GPS data, query available years, and upload new data via CSV.
All endpoints live under /api/.
Health-check endpoint. No authentication required.
Response:
{ "message": "Hello, Nautilus!" }Returns GPS track data for a given date range as a GeoJSON Feature. Requires an API key.
Query parameters:
| Parameter | Required | Description |
|---|---|---|
start |
yes | Start datetime (YYYY-MM-DD HH:MM:SS) |
end |
yes | End datetime (YYYY-MM-DD HH:MM:SS) |
Example request:
GET /api/track?start=2023-09-01+00:00:00&end=2023-09-30+23:59:59
Example response:
{
"type": "Feature",
"properties": {},
"geometry": {
"type": "LineString",
"coordinates": [
[52.666, -2.474],
[52.667, -2.475]
]
}
}Returns a list of all years present in the database. Requires an API key.
Example response:
{ "years": [2022, 2023, 2024] }Uploads a CSV file and stores its rows in the database. A browser form is served on GET.
Request: multipart/form-data with a csv_file field containing a .csv file.
CSV format: each row must have at least three fields — datetime, latitude, longitude:
DD/MM/YYYY HH:MM:SS, latitude, longitude
01/09/2023 00:35:55, 52.66646, -2.4749416
The track and years endpoints require an API_KEY header. The key is configured via the API_KEY environment variable (see Configuration below).
- PHP 8 or higher
- Composer 2.8 or higher
- Docker 28 or higher
composer install
docker-compose up -dThe .env file is generated automatically by the GitHub Actions deployment workflow on every push to master. It is not committed to the repository — the local .env is a sample only.
The workflow reads the following GitHub Actions secrets (Settings → Secrets and variables → Actions) and writes them into a fresh .env before uploading to the remote server via FTP:
| Secret name | .env key |
Purpose |
|---|---|---|
DB_HOST |
DB_HOST |
Database server IP / hostname |
DB_USERNAME |
DB_USERNAME |
Database username |
DB_PASSWORD |
DB_PASSWORD |
Database password |
DB_NAME |
DB_NAME |
Database name |
DB_TABLE |
DB_TABLE |
Table name |
API_KEY |
API_KEY |
API authentication key |
FTP_SERVER_DEV |
(FTP host) | Remote server for deployment |
FTP_USER |
(FTP user) | FTP username |
FTP_PASSWORD |
(FTP password) | FTP password |
FTP_FOLDER |
(FTP remote path) | Remote directory to deploy into |
Important: any manual edits to the
.envon the remote server will be overwritten on the next push tomaster. To make a permanent change, update the corresponding GitHub secret and push.