Laravel backend API for tracking ice baths. Powers the React frontend app.
Web repo: https://github.com/Wiltzsu/avantotracker-web
- Website: https://www.avantotracker.com
- API: https://api.avantotracker.com
- Copy
.env.exampleto.envand setAPP_KEY(php artisan key:generate). - For local dev, SQLite is the default (
DB_CONNECTION=sqlite). - Run migrations:
php artisan migrate - Start the server:
php artisan serve - Run tests:
php artisan test
Production uses MySQL credentials from the server .env only. Do not commit secrets.
- Base URL:
https://api.avantotracker.com - Health check:
GET / - Authentication: Bearer token (Sanctum), prefix
avt_
POST /api/login- rate limited after failed attempts (5/min per email+IP)POST /api/logout- requires authGET /api/me- requires auth
Public registration is disabled. Create users on the server with php artisan tinker when needed.
All routes below require auth:sanctum.
GET /api/v1/avanto- list current user's avantos (paginated)POST /api/v1/avanto- createGET /api/v1/avanto/{avanto}- show (404 for other users' records)PUT/PATCH /api/v1/avanto/{avanto}- updateDELETE /api/v1/avanto/{avanto}- destroyGET /api/v1/stats- aggregated stats (?range=all|month|6months|year, optionalstart_date/end_date)GET /api/v1/dashboard- monthly snapshot, streaks, recent avantos, highlightsGET /api/v1/records- personal records (coldest, longest, swear words, mood swing)GET /api/v1/avanto/export- CSV export (same filters as list)GET /api/v1/avanto- supportslocation,start_date,end_date,saunafiltersPOST/DELETE /api/v1/avanto/{avanto}/selfie- optional photo upload
- CORS is restricted to configured frontend origins (
CORS_ALLOWED_ORIGINS). - Login replaces existing API tokens on success.
user_idcannot be set via create/update requests.- CI runs
composer auditand PHPUnit on push/PR.
- Laravel API
- Laravel Sanctum (token auth)
- Eloquent ORM, migrations