https://github.com/cyrus-nodejs/foodpal-api
FoodPal Nodejs Express API
https://github.com/cyrus-nodejs/foodpal-api
Last synced: 3 months ago
JSON representation
FoodPal Nodejs Express API
- Host: GitHub
- URL: https://github.com/cyrus-nodejs/foodpal-api
- Owner: cyrus-nodejs
- Created: 2026-02-11T00:14:58.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2026-02-11T00:41:33.000Z (4 months ago)
- Last Synced: 2026-02-11T04:01:03.000Z (4 months ago)
- Language: TypeScript
- Homepage:
- Size: 124 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ๐ฒ FoodPal Backend
**FoodPal** is an intelligent cooking companion that blends **AI recipe recommendations**, **community engagement**, and **personalized nutrition** โ tailored for the modern African kitchen ๐ณ๐ฌ.
This backend powers all API endpoints, authentication, gamification, and real-time cook-along sessions.
---
## ๐ Features
### ๐ค Authentication & Users
- Email/password + Google OAuth login
- JWT-based authentication
- User profiles with dietary preferences, cooking habits & cultural background
### ๐ง AI-Powered Recipe Recommendations
- Personalized "For You" feed using OpenAI embeddings
- Smart search & filtering (diet, culture, skill level)
### ๐ง๐พโ๐ณ Cook-Along (Live)
- WebSocket-powered **live cook-along chat + timer**
- Users can join cooking sessions and message in real time
### ๐ฑ Meal Planning
- AI-generated weekly meal plans
- Smart substitutions for allergies and budget
### ๐ Community
- Share recipes, like, comment, and discuss
- Social-style interaction among food lovers
### ๐ฅ Nutrition
- Ingredient-based nutrition breakdown
- Calorie and macro tracking
### ๐
Gamification (New!)
- Cooking streaks tracking
- Achievement badges (`"Budget Chef"`, `"Zero-Waste Pro"`, etc.)
- Weekly cooking challenges (e.g., *โ5 Meals Under โฆ2000โ*)
---
## ๐งฉ Tech Stack
| Category | Tech |
|-----------|------|
| **Runtime** | Node.js (TypeScript) |
| **Framework** | Express.js |
| **Database** | MongoDB + Mongoose |
| **Auth** | JWT + Google OAuth2 |
| **AI Integration** | FastAPI | Transformers
| **Real-Time** | Socket.io |
| **Cache/Scaling (optional)** | Redis |
| **Docs** | Swagger (OpenAPI 3.0) |
---
## ๐๏ธ Folder Structure
```
backend/
โโโ controllers/
โ โโโ authController.ts
โ โโโ userController.ts
โ โโโ mealPlanController.ts
โ โโโ communityController.ts
โ โโโ cookAlongController.ts
โ โโโ nutritionController.ts
โ โโโ gamificationController.ts
โ
โโโ models/
โ โโโ user.ts
โ โโโ userPreference.ts
โ โโโ recipe.ts
โ โโโ communityPost.ts
โ โโโ mealPlan.ts
โ โโโ gamification/
โ โโโ streak.ts
โ โโโ badge.ts
โ โโโ challenge.ts
โ
โโโ routes/
โ โโโ authRoutes.ts
โ โโโ userRoutes.ts
โ โโโ mealPlanRoutes.ts
โ โโโ communityRoutes.ts
โ โโโ cookAlongRoutes.ts
โ โโโ nutritionRoutes.ts
โ โโโ gamificationRoutes.ts
โ
โโโ middleware/
โ โโโ authMiddleware.ts
โ
โโโ utils/
โ โโโ sendEmail.ts
โ โโโ embedding.ts
โ
โโโ config/
โ โโโ db.ts
โ
โโโ swagger.json
โโโ app.ts
โโโ server.ts
```
---
## โ๏ธ Environment Variables
Create a `.env` file in your project root:
```bash
PORT=5000
MONGO_URI=mongodb+srv://:@cluster.mongodb.net/yourdb
JWT_SECRET=
JWT_EXPIRES=7d
OPENAI_API_KEY=
GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=
REDIS_URL=
FRONTEND_URL=http://localhost:3000
```
# 1๏ธโฃ Clone the repo
git clone https://github.com//FoodPal-backend.git
cd FoodPal-backend
# 2๏ธโฃ Install dependencies
npm install
# 3๏ธโฃ Run development server
npm run dev
# 4๏ธโฃ For production
npm run build
npm start
๐งช API Documentation
Swagger UI is available at:
It includes:
/api/auth โ Login, Register, Google Auth
/api/users โ Profile management
/api/mealplans โ AI meal planner
/api/community โ Posts, likes, comments
/api/cookalong โ Live cooking chat
/api/nutrition โ Nutrition facts
/api/gamification โ Streaks, badges, challenges
๐งก Credits
Built with love by the FoodPal Team โ inspiring creativity and connection through food.
๐ โCook smarter, not harder.โ
๐ License
This project is licensed under the MIT License.
MIT ยฉ 2025 FoodPal