An AI-powered meal planning platform focused on sustainability, nutrition tracking, and community sharing. Aligned with UN SDG 1 (No Poverty) and SDG 2 (Zero Hunger) goals.
AffordableMeals addresses the global challenge of accessing nutritious, affordable, and culturally appropriate meals. Many individuals struggle with poor diet quality due to limited nutrition awareness, rising food prices, and lack of tools to optimize local ingredients. The platform tackles food production's environmental impact and provides data-driven insights to align food choices with personal health goals, sustainability practices, and the broader goal of reducing hunger and malnutrition worldwide.
https://affordable-meals.vercel.app
- AI-Powered Suggestions: Based on dietary preferences, health conditions, budget, and automatic cultural preferences from user's origin/area
- Weekly/Monthly Planning: Automatic grocery list generation with regional optimization
- Recipe Optimization: Locally available ingredients specific to user's region
- Cultural Integration: Searchable Country (origin_region) and Locale/City (area_region) selectors for accurate cultural context
- Currency-Aware Budgeting: Multi-currency support with cost estimation in user's preferred currency
- Nutritional Analysis: Personalized recommendations based on weight, height, and health goals
- Carbon Footprint Calculation: Real-time environmental impact scoring for recipes and ingredients
- Comparative Analysis: Environmental comparison between meal options
- Monthly Reports: Sustainability progress tracking and improvement suggestions
- Ingredient Impact Database: Comprehensive sustainability factors for informed choices
- In‑App Community Share: One‑tap “In‑App Community” share option that posts directly to the community feed
- Quick Planning → Share: Shares created from Quick Planning now also create a community activity so they appear in feed/trending
- Copy Link UX: “Copy Link” instantly copies the recipe URL, closes the modal, and shows “Recipe link copied!”
- Social Media Integration: Share meal plans, recipes, and achievements on Facebook, X (Twitter), WhatsApp
- Achievement Badges: Milestone sharing to encourage community engagement
- Recipe Reviews: Community-driven rating and review system with social sharing capabilities
- Success Stories: Share cooking achievements and completed meals
- Simplified Input: Users describe meals in simple terms; AI handles complex nutritional calculations
- Daily Tracking: Calorie tracking with visual analytics and progress indicators
- AI Pattern Analysis: Eating habits and health correlations identification
- Weekly/Monthly Reports: Comprehensive nutrition pattern analysis and progress tracking
- Calorie Management: AI suggestions for portion control and alternatives when daily limits exceeded
- Deficiency Alerts: Nutrition progress reports with cultural meal suggestions
- Custom Link Sharing: Share to WhatsApp, Facebook, and X (Twitter) via direct URL patterns
- Rich Previews: Server-generated Open Graph images with bot detection
- Achievement Sharing: Celebrate milestones across social platforms
- In‑App Share: Post directly to the community feed without invoking the system share dialog
- Copy Link: One-click copy-to-clipboard with success toast
- Community Recipes Page (/community-recipes)
- “Shared by Community” grid showcasing recently shared recipes
- “Explore by Member” with activity-based stats (share counts, last shared)
- Member selection loads authored recipes for user-sourced members and shared recipes for activity-derived members
- Real name resolution from /auth/users and leaderboard when available
- Community Feed Filters (/community)
- Header chips to filter by activity type (All, Shared, Reviews)
- Quick “View recipe” actions and improved relative timestamps
- Top Members Card
- Minimal visual design with subtle shadows consistent with the feed
- Recipe Cards
- Footer actions (View Details, Rate) pinned to the bottom regardless of title length
- React 19 with TypeScript 5+
- Zustand 5 for state management
- Tailwind CSS 3 for styling
- Vite for build tooling
- Axios 1.12 for API communication
- Recharts 3 for data visualization
- Testing: Vitest 3 + React Testing Library
- Node.js 18+ with Express 5
- PostgreSQL with Drizzle ORM
- JWT Authentication with bcryptjs
- Security: Helmet 7, CORS, Rate Limiting
- Testing: Jest 29 + Supertest
- Process Management: PM2 for production
- Primary: Neon PostgreSQL (serverless, auto-scaling)
- AI Provider: OpenRouter with meta-llama and Groq API
- Image API: Pixabay for recipe imagery
- Country/Currency: RestCountries + CountriesNow APIs
- Frontend: Vercel with auto-deploy from GitHub
- Backend: Render with auto-deploy from GitHub
- Database: Neon PostgreSQL (external managed service)
- Monitoring: Built-in health checks and error handling
AffordableMeals/
├── backend/ # Node.js API
│ ├── src/
│ │ ├── app.js
│ │ ├── index.js
│ │ ├── config/
│ │ ├── controllers/
│ │ ├── db/
│ │ ├── middleware/
│ │ ├── routes/
│ │ ├── services/
│ │ └── utils/
│ ├── migrations/ # Database migrations
│ ├── scripts/ # Utility scripts (seeders, populators)
│ ├── docs/ # Backend service docs
│ ├── test/ # Jest + Supertest
│ └── package.json
├── frontend/ # React + TypeScript SPA
│ ├── src/
│ ├── public/
│ ├── api/
│ ├── vite.config.ts
│ ├── vitest.config.ts
│ └── package.json
├── Project_SRS.md
├── Project SRS.docx
└── README.md
/community– Community feed with activity filters and Top Members/community-recipes– Shared by Community grid and Explore by Member/recipes/:id– Recipe details with share and review actions
- users: Authentication, preferences, cultural regions, currency
- recipes: User-generated recipes with sustainability scores
- meal_plans: Daily meal planning with nutrition aggregation
- nutrition_tracking: Daily meal logs with AI-calculated nutrition
- ingredient_impacts: Sustainability emission factors
- ingredient_substitutions: Cultural optimization rules
- social_shares: Share activity tracking
- recipe_reviews: Community ratings and feedback
- user_achievements: Gamification milestones
- community_activity: Social feed and trending data
- user_following: Social connections
- Node.js 18+
- PostgreSQL database
- npm or yarn
Windows (PowerShell):
cd backend
npm install
# Environment setup
Copy-Item .env.example .env
# Configure DATABASE_URL, JWT_SECRET, etc.
# Database setup
npm run migrate
# Start development server
npm run dev # localhost:4000macOS/Linux:
cd backend
npm install
cp .env.example .env
# Configure DATABASE_URL, JWT_SECRET, etc.
npm run migrate
npm run dev # localhost:4000Windows (PowerShell):
cd frontend
npm install
# Environment setup
Copy-Item .env.local.example .env.local
# Configure VITE_API_URL
# Start development server
npm run dev # localhost:5173macOS/Linux:
cd frontend
npm install
cp .env.local.example .env.local
# Configure VITE_API_URL
npm run dev # localhost:5173DATABASE_URL=postgresql://user:pass@localhost:5432/affordablemeals
JWT_SECRET=your_secret_here
JWT_EXPIRATION=24h
PORT=4000
CORS_ORIGIN=http://localhost:5173
ENFORCE_AI_RECIPES=false
ENABLE_MOD_ROLES=false
ADMIN_USER_IDS=comma,separated,uuidsVITE_API_URL=http://localhost:4000/api
VITE_PIXABAY_API_KEY=your_pixabay_key
VITE_OPENROUTER_API_KEY=your_openrouter_key
VITE_GROQ_API_KEY=your_groq_api_key.
# Backend tests
cd backend && npm test
# Frontend tests
cd frontend && npm run test
# Test coverage
npm run test:coverage- Unit Tests: Service functions and utilities
- Integration Tests: API endpoints with database
- Component Tests: React component behavior
- E2E Tests: Critical user journeys
POST /api/auth/register # User registration
POST /api/auth/login # User login
PUT /api/auth/profile # Update profile
GET /api/auth/users # List users (for community features)GET /api/recipes # List recipes with filters
POST /api/recipes # Create new recipe
GET /api/meal-plans # Daily meal plans
POST /api/nutrition # Log nutrition tracking
GET /api/achievements # User achievementsGET /api/community/feed # Social activity feed
GET /api/community/trending # Trending recipes
GET /api/community/leaderboard # Top members
POST /api/social-shares # Record share activity
POST /api/reviews # Create recipe review
GET /api/community/recipes/:id/stats # Recipe review stats (avg rating, count)POST /api/meal-plans/ai/generate # AI meal suggestions
POST /api/nutrition/ai/analyze # AI nutrition analysisAffordableMeals uses a robust fallback mechanism for AI features:
- Primary: OpenRouter API (requires
VITE_OPENROUTER_API_KEY) - Fallback: GROQ API KEY (requires
VITE_GROQ_API_KRY)
If OpenRouter returns a 429 (rate limit) or other server error, the same prompt is automatically sent to Groq API. This ensures AI features remain available even during high-traffic periods.
- Redesigned dashboard cards with subtle emerald borders and hover lift for better visual hierarchy
- Switched to Lucide icons across Budget, Macros, Sustainability, and Carbon Footprint cards
- Weekly Budget now formats values using the user’s currency and derives “Spent” from today’s selected recipes
- Macro Distribution donut: clearer legend (grams and %), center total label, and custom tooltip
- Sustainability Trend: improved messaging with icons, cleaner empty states, and consistent styling
- Recent Activity: cost values formatted using the user’s currency
- Fixed header overlap on mobile; responsive grids and spacing for small screens
- Added “In‑App Community” share option in the share modal
- “Copy Link” now auto-copies the URL, closes the modal, and shows a success toast
- Quick Planning modal now records social share events for newly created recipes
- Community Recipes: “Shared by Community” grid and improved “Explore by Member”
- Member selection loads authored vs shared recipes depending on source
- Community feed chips for filtering by activity type; improved timestamps and quick actions
- Top Members card visual refresh with shadows
- Recipe cards: footer actions pinned to the bottom for consistent layout
- Quick Planning modal shows recipe names instead of internal IDs
- Removed duplicate Sustainability card on the dashboard
- Consistent icon tiles and copy-to-clipboard UX across cards
- JWT Authentication: Secure token-based auth
- Rate Limiting: API endpoint protection
- CORS Configuration: Cross-origin security
- Input Validation: Request sanitization
- Content Moderation: Community content oversight
- Privacy Controls: User data protection
- Budget-Conscious Planning: AI factors user's budget and currency for cost-effective meal suggestions
- Currency-Aware System: Multi-currency support to serve users globally regardless of economic context
- Cost Estimation: Accurate budget tracking and estimates for all meals and ingredients
- Local Optimization: Recipe optimization for locally available, affordable ingredients
- Economic Accessibility: Reduces reliance on costly or inaccessible food options
- Food Security: Budget-sensitive meal plans supporting equitable access to nutritious food
- Nutrition Improvement: AI-driven personalized insights tackling malnutrition and deficiencies
- Sustainable Agriculture: Carbon footprint awareness encouraging eco-friendly farming support
- Community Knowledge: Recipe exchange fostering cultural inclusivity and collective progress
- Balanced Diets: Encourages meals rich in essential macro and micronutrients
- GitHub Integration: Auto-deploy on push to main
- Vercel: Frontend builds and deploys automatically
- Render: Backend rebuilds and redeploys on changes
- Database: Neon PostgreSQL with connection pooling
- Environment Variables: Managed through platform dashboards
- Health Monitoring: Endpoint monitoring and alerting
- Error Tracking: Centralized error handling and logging
- Performance: CDN optimization and caching strategies
- Database: Neon auto-scaling PostgreSQL
- API: Horizontal scaling on Render
- Frontend: Vercel Edge Network CDN
- Caching: Client-side and server-side optimization
- Monitoring: Real-time performance tracking
- Fork the repository
- Create feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open Pull Request
- Follow TypeScript best practices
- Write tests for new features
- Update documentation
- Follow existing code style
- Test across different devices
This project is licensed under the MIT License - see the LICENSE file for details.
- UN SDG 1 & 2: No Poverty and Zero Hunger initiatives inspiration
- OpenRouter: AI service provider
- Neon: Serverless PostgreSQL platform
- Vercel & Render: Deployment platforms
- Open Source Community: Various libraries and tools
Built with ❤️ for sustainable food systems, economic accessibility, and global nutrition security