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.
- 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
git clone https://github.com/kautilyadevaraj/FitnessTracker
cd project-repo
npm install
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.
Ensure Supabase PostgreSQL is correctly set up and linked to Prisma ORM.
npx prisma generate
npx prisma migrate dev --name init
npx prisma studio
This opens a database GUI to manage users, accounts, and sessions.
npm run dev
Your app will be available at http://localhost:3000
.
- 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 data should be stored in Supabase PostgreSQL.
- CRUD operations should work without errors.
- Ensure Row-Level Security (RLS) prevents unauthorized access.
- Test session persistence across page reloads.
If you face issues, check:
- Server Logs:
npm run dev
- API Logs:
Visit/api/auth/session
to inspect authentication. - Database Logs:
npx prisma studio
- Fork the repository & clone it locally.
- Create a new branch:
git checkout -b feature-branch
- Commit changes with meaningful messages:
git commit -m "Added XYZ feature"
- Push to GitHub and create a Pull Request (PR).
This project is open-source and available under the MIT License.
- 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!