A lightweight personal weight logging app with a FastAPI backend and a plain-HTML/JS frontend. Records are stored in a local JSON file — no database setup required.
It maybe combined with esp32 later.
- Log weight entries with date and time (auto-filled to now if left blank)
- View all records in a searchable table with high/low badges
- Summary stats: latest, highest, and lowest weight at a glance
- Delete any entry by index
- Single-file frontend served directly by the API server
.
├── server.py # FastAPI app — REST API + static file serving
├── main.py # Standalone CLI helper for reading/writing records
├── index.html # Frontend UI (served at http://localhost:8000)
├── data.json # Persistent record store (auto-created on first write)
└── requirements.txt # Python dependencies
- Python 3.8+
- pip
pip install -r requirements.txtuvicorn server:app --reloadThen open http://localhost:8000 in your browser.
The API documentation (auto-generated by FastAPI) is available at http://localhost:8000/docs.
| Method | Endpoint | Description |
|---|---|---|
GET |
/records |
Return all weight records |
POST |
/records |
Add a new record |
DELETE |
/records/{index} |
Delete a record by its index |
{
"date": "17.05.2025",
"time": "08:30",
"weight": 75.5
}date— formatdd.mm.yyyy; leave empty ("") to use today's datetime— formathh:mm; leave empty ("") to use the current timeweight— positive number (in kg)
Records are stored in data.json as a plain JSON array:
[
{
"date": "17.05.2025",
"time": "08:30",
"weight": 75.5
}
]You can edit this file directly if needed.
main.py provides a simple command-line interface for adding records without starting the server:
python main.pyIt will print all existing records, then prompt you to enter a new weight.
- CORS is open (
allow_origins=["*"]), which is fine for local use. Restrict this before any public deployment. - There is no authentication. This app is intended for personal, local use only.
- Deleting a record shifts the indices of all subsequent records, so always fetch the current list before deleting by index.