A comprehensive backend API for a fitness and nutrition tracking application, built with NestJS and TypeScript.
- User authentication with JWT
- Food database with search by name and barcode
- Meal logging with portion control
- Exercise tracking with calorie burn calculations
- Goal setting for calories and macronutrients
- Weight progress tracking
- AI-powered food analysis from images and text descriptions
- NestJS with TypeScript
- MySql with Prisma ORM
- JWT authentication
- Swagger API documentation
- Node.js (v14 or later)
- Mysql database
- Clone the repository
- Install dependencies:
npm install-
Set up the environment variables in
.envfile -
Initialize the database:
npx prisma migrate dev- Start the development server:
npm run start:devOnce the server is running, you can access the Swagger API documentation at:
http://localhost:3000/api/docs
The API uses JWT authentication. To access protected endpoints:
- Register a new user at
/api/auth/register - Login at
/api/auth/loginto get an access token - Include the token in the Authorization header as:
Authorization: Bearer YOUR_ACCESS_TOKEN
The database schema includes tables for:
- Users
- Foods
- Meals and MealItems
- Exercises
- Goals
- WeightLogs