A self-hosted web application designed to capture readings from my Xiaomi Mi Scale S400, save them in a database, and allow me to access the history from the web app and view the data graphically.
- MongoDB Database: Stores weight and body fat percentage readings with timestamps
- Data Visualization: Beautiful charts showing weight and body fat trends over time using Recharts
- Docker Support: Easy deployment with Docker and Docker Compose
- Modern UI: Built with Next.js 16 and Tailwind CSS with dark mode support
- Responsive Design: Works on desktop and mobile devices
- Frontend: Next.js 16, React 19, TypeScript, Tailwind CSS
- Charts: Recharts (React charting library)
- Database: MongoDB
- Containerization: Docker, Docker Compose
- Node.js 22 or later
- MongoDB (local or Docker)
- npm
-
Clone the repository:
git clone https://github.com/bytevictor/byteFit.git cd byteFit -
Install dependencies:
npm install
-
Create a
.envfile based on.env.example:cp .env.example .env
-
Start MongoDB (if running locally):
mongod
-
Start the development server:
npm run dev
-
Open http://localhost:3000 in your browser.
-
Build and start the containers:
docker-compose up -d
-
The application will be available at http://localhost:3000
-
MongoDB will be accessible at
localhost:27017 -
Sample data is automatically loaded on first startup. The
mongo-init/init-data.jsscript creates 31 sample readings (past 30 days) when the MongoDB container initializes for the first time.To reset the sample data, remove the MongoDB volume and restart:
docker-compose down -v docker-compose up -d
Readings are stored in MongoDB with the following schema:
{
_id: ObjectId,
date: Date, // Timestamp of the reading
weight: number, // Weight in kilograms
bodyFatPercentage: number // Body fat percentage
}You can add readings directly to MongoDB using the MongoDB shell or a client like MongoDB Compass:
use bytefit
db.readings.insertOne({
date: new Date(),
weight: 75.5,
bodyFatPercentage: 18.2
})Returns all readings sorted by date.
Response:
[
{
"_id": "...",
"date": "2024-01-15T10:30:00.000Z",
"weight": 75.5,
"bodyFatPercentage": 18.2
}
]| Variable | Description | Default |
|---|---|---|
MONGODB_URI |
MongoDB connection string | mongodb://localhost:27017 |
MONGODB_DB |
Database name | bytefit |
This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.