Skip to content

This project is a Next.js application that integrates Supabase, Prisma ORM, and NextAuth to provide authentication, user management, fitness tracking, and AI-powered diet and workout planning. Users can view predefined workouts or create their own. They can track their progress with an interactive dashboard.

Notifications You must be signed in to change notification settings

kautilyadevaraj/FitnessTracker

Repository files navigation

AI-Powered Personalized Fitness & Diet Planner

This project is a Next.js application that integrates Supabase, Prisma ORM, and NextAuth to provide authentication, user management, fitness tracking, and AI-powered diet planning.


Tech Stack

  • Frontend: Next.js (App Router), Tailwind CSS, ShadCN UI
  • Backend: Supabase (PostgreSQL), Prisma ORM
  • Authentication: Auth.js (Google, GitHub, LinkedIn, Discord, Credentials)
  • State Management: React Hook Form + Zod for validation

Setup Instructions

Clone the Repository

git clone https://github.com/kautilyadevaraj/FitnessTracker
cd project-repo

Install Dependencies

npm install

Set Up Environment Variables

Create a .env.local file in the root directory and add the following:

# OAuth Provider Credentials (Get from Google, GitHub, LinkedIn, Discord)
GOOGLE_CLIENT_ID=your-google-client-id
GOOGLE_CLIENT_SECRET=your-google-client-secret
GITHUB_CLIENT_ID=your-github-client-id
GITHUB_CLIENT_SECRET=your-github-client-secret
LINKEDIN_CLIENT_ID=your-linkedin-client-id
LINKEDIN_CLIENT_SECRET=your-linkedin-client-secret
DISCORD_CLIENT_ID=your-discord-client-id
DISCORD_CLIENT_SECRET=your-discord-client-secret

Create a .env file in the root directory and add the following:

DATABASE_URL="postgresql://postgres:{password}@db.laeifhkkahjbafs.supabase.co:5432/postgres"

Note: Keep these credentials private and do not commit them to GitHub.

Set Up Supabase & Prisma

Ensure Supabase PostgreSQL is correctly set up and linked to Prisma ORM.

Run Prisma Migrations

npx prisma generate
npx prisma migrate dev --name init

Open Prisma Studio (Optional, for testing)

npx prisma studio

This opens a database GUI to manage users, accounts, and sessions.


Running the Project

Start the Development Server

npm run dev

Your app will be available at http://localhost:3000.


Features to Test

Authentication

  • Sign up/login using:
    • Google, GitHub, LinkedIn, Discord
    • Email + Password (Credentials Provider)
  • Check if the same email across different providers links to a single user.

User Profile & Data Storage

  • User data should be stored in Supabase PostgreSQL.
  • CRUD operations should work without errors.

Security

  • Ensure Row-Level Security (RLS) prevents unauthorized access.
  • Test session persistence across page reloads.

Debugging & Logs

If you face issues, check:

  • Server Logs:
    npm run dev
  • API Logs:
    Visit /api/auth/session to inspect authentication.
  • Database Logs:
    npx prisma studio

Contribution Guidelines

  1. Fork the repository & clone it locally.
  2. Create a new branch:
    git checkout -b feature-branch
  3. Commit changes with meaningful messages:
    git commit -m "Added XYZ feature"
  4. Push to GitHub and create a Pull Request (PR).

License

This project is open-source and available under the MIT License.


Next Steps

  • Implement AI-powered fitness and diet plan suggestions.
  • Optimize database queries for performance.
  • Add more test cases for edge scenarios.

Happy coding! For any questions, reach out to the team!

About

This project is a Next.js application that integrates Supabase, Prisma ORM, and NextAuth to provide authentication, user management, fitness tracking, and AI-powered diet and workout planning. Users can view predefined workouts or create their own. They can track their progress with an interactive dashboard.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages