BE-FIT is a comprehensive fitness and wellness platform that combines social features, gamification, and personalized coaching to help users achieve their health goals. Built with Next.js, React, and PostgreSQL, BE-FIT offers a complete ecosystem for gym members, home workout enthusiasts, coaches, and business partners.
- Features
- Tech Stack
- Project Structure
- Installation
- Configuration
- Running the Application
- Agents & Automation
- API Endpoints
- Database Schema
- Contributing
- License
- ✅ Role-based access (User, Admin, Coach, Business)
- ✅ JWT Authentication with secure sessions
- ✅ Email verification & password reset
- ✅ Profile management with avatars
- ✅ Gym & Local Home Workout tracks
- ✅ Free & Paid membership tiers
- ✅ Admin approval workflow for new sign-ups
- ✅ Subscription status tracking
- ✅ AI-assisted calorie counter
- ✅ Daily water intake logging
- ✅ Points accumulation system
- ✅ Level progression with unlockable avatars
- ✅ Real-time leaderboard (segmented by track)
- ✅ Monthly champion recognition
- ✅ Gallery showcasing top performers
- ✅ Badges & achievements
- ✅ Feed posts (2/day for paid members)
- ✅ Status stories (24-hour visibility)
- ✅ Likes, follows, and engagement
- ✅ Cross-platform sharing (LinkedIn, Instagram, etc.)
- ✅ 4×10 minute call packages (500 PKR)
- ✅ Time slot management
- ✅ Booking & reminder system
- ✅ Call credit tracking
- ✅ Product promotion system
- ✅ Partner management
- ✅ Admin approval dashboard
- ✅ Fee status management
- ✅ Audit logging
- ✅ Firebase Cloud Messaging
- ✅ In-app notifications
- ✅ Email & SMS alerts
- ✅ Subscription reminders
- ✅ Daily workout & points reminders
| Category | Technology |
|---|---|
| Frontend | Next.js 16, React 19, TypeScript |
| Styling | Tailwind CSS v4 |
| Backend | Next.js API Routes, Node.js |
| Database | PostgreSQL with Prisma ORM |
| Authentication | JWT (jose library), bcryptjs |
| Nodemailer | |
| Hosting | Vercel-optimized |
befit/
├── app/
│ ├── api/ # API routes (REST & Next.js)
│ ├── about/ # About page
│ ├── features/ # Features showcase
│ ├── forgot-password/ # Password recovery
│ ├── login/ # User authentication
│ ├── pricing/ # Membership pricing
│ ├── programs/ # Program selection
│ ├── reset-password/ # Password reset
│ ├── signup/ # User registration
│ ├── verify-email/ # Email verification
│ ├── layout.tsx # Root layout
│ └── page.tsx # Home page
├── components/ # Reusable React components
├── lib/ # Utility functions & helpers
├── prisma/
│ ├── schema.prisma # Database schema
│ └── migrations/ # Database migrations
├── public/ # Static assets & favicon
├── AGENTS.md # Agent system documentation
├── .env.example # Environment template
├── next.config.ts # Next.js configuration
├── package.json # Dependencies
├── tailwind.config.ts # Tailwind CSS config
└── tsconfig.json # TypeScript configuration
- Node.js 18+ (recommended: 20+)
- npm, yarn, or pnpm
- PostgreSQL 15+
- Prisma CLI (installed as dev dependency)
-
Clone the repository:
git clone https://github.com/your-username/befit.git cd befit -
Install dependencies:
npm install # or yarn install # or pnpm install
-
Set up environment variables:
cp .env.example .env
Edit
.envwith your database URL and other secrets. -
Initialize the database:
npx prisma generate npx prisma db push # or for production npx prisma migrate dev -
Seed initial data (optional):
npx prisma db seed
Create a .env file in the project root:
# Database
DATABASE_URL="postgresql://user:password@localhost:5432/befit"
# JWT Secret
JWT_SECRET=your_super_strong_jwt_secret_here
# Email (Nodemailer)
EMAIL_USER=your_email@gmail.com
EMAIL_PASS=your_app_password
# Firebase (for notifications - optional)
FIREBASE_API_KEY=your_firebase_key
FIREBASE_AUTH_DOMAIN=your_project.firebaseapp.com
FIREBASE_PROJECT_ID=your_project_id
FIREBASE_STORAGE_BUCKET=your_bucket.app
FIREBASE_MESSAGING_SENDER_ID=your_sender_id
FIREBASE_APP_ID=your_app_id
# Stripe (for payments - optional)
STRIPE_SECRET_KEY=sk_test_your_key
STRIPE_WEBHOOK_SECRET=whsec_your_secret
# Next.js
NEXT_PUBLIC_APP_URL=http://localhost:3000- Install PostgreSQL on your system
- Create a new database:
CREATE DATABASE befit;
- Update the
DATABASE_URLin.env - Run Prisma migrations:
npx prisma migrate dev --name init
npm run dev
# or
yarn dev
# or
pnpm devOpen http://localhost:3000 in your browser.
The page will auto-update as you make changes to the code.
npm run build
npm startThe production server will start on port 3000 by default.
npm run lintBE-FIT implements a sophisticated agent system for automation. See AGENTS.md for complete details.
| Agent | Purpose | Trigger |
|---|---|---|
| AI Assistance | Caloric intake tracking & points | User logs food |
| Notification | Automated alerts | Event-based |
| Admin Approval | Registration review | User signs up |
| Points & Leveling | Points accumulation | Activity completed |
| Leaderboard | Rankings & standings | Points update |
| Gallery Curation | Champion recognition | End of month |
| Business Promotion | Product broadcast | Admin approval |
| Counselling Booking | Call scheduling | User requests |
| Feed & Social | Post/story management | User uploads |
| Fee Status | Membership tracking | Periodic check |
POST /api/auth/signup- User registrationPOST /api/auth/login- User loginPOST /api/auth/forgot-password- Password reset requestPOST /api/auth/reset-password- Reset passwordPOST /api/auth/verify-email- Email verification
GET /api/users/me- Current user profilePUT /api/users/me- Update profileGET /api/users/leaderboard- Get leaderboard
GET /api/programs- List available programsPOST /api/programs/enroll- Enroll in a programGET /api/programs/enrollments- User's enrollments
POST /api/food-logs- Log food/caloriesGET /api/food-logs- Get food logsPOST /api/water-logs- Log water intakeGET /api/water-logs- Get water logsGET /api/points- Get user points & level
POST /api/posts- Create a postGET /api/posts- Get feed postsPOST /api/posts/:id/like- Like a postPOST /api/stories- Create a storyGET /api/stories- Get active stories
GET /api/counselling/slots- Available time slotsPOST /api/counselling/book- Book a slotGET /api/counselling/bookings- User's bookings
GET /api/admin/approvals- Pending approvalsPOST /api/admin/approvals/:id/approve- Approve requestPOST /api/admin/approvals/:id/reject- Reject requestGET /api/admin/users- All usersGET /api/admin/promotions- Promotion requestsPOST /api/admin/gallery- Manage gallery
The database is built with PostgreSQL and Prisma ORM, featuring:
- Users - Core user accounts with roles & profiles
- Program Enrollments - Track & tier memberships
- Membership Subscriptions - Active periods & renewal
- Points System - Progress tracking & level tiers
- Food & Water Logs - Daily fitness tracking
- Leaderboard - Competitive rankings
- Gallery - Champion showcases
- Feed Posts & Stories - Social content
- Counselling - Booking & scheduling
- Promotions - Business partner campaigns
- Notifications - Multi-channel alerts
- Payments - Stripe transaction records
- Admin Logs - Audit trail
See prisma/schema.prisma for the complete schema.
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Follow TypeScript best practices
- Use Prisma for all database operations
- Implement proper error handling
- Maintain consistent code style
- Add tests for new features
- Update documentation as needed
Currently, the project uses manual testing. For automated testing:
# Run basic checks
npm run lint
# TypeScript type checking
npx tsc --noEmit- Import the project in Vercel
- Set up environment variables
- Configure PostgreSQL connection
- Deploy!
- Build the production bundle:
npm run build
- Start the production server:
npm start
- Use PM2 or similar for process management:
npm install -g pm2 pm2 start npm --name befit -- start pm2 save pm2 startup
- Core authentication system
- Program enrollment workflow
- Points & leveling system
- Social feed implementation
- Notification system
- Mobile app (React Native)
- Advanced analytics dashboard
- AI-powered workout recommendations
- Live class streaming
- Wearable device integration
- Documentation: AGENTS.md
- Issues: GitHub Issues
- Discussions: GitHub Discussions
This project is licensed under the MIT License - see the LICENSE file for details.
BE-FIT - Build your best self, one rep at a time.
Built with ❤️ using Next.js, React, and PostgreSQL