How thebishalghosh/healthapp-backend works
This is a Core PHP REST API for a mobile health and wellness app, plus a PHP admin portal. The documented implemented workflow is account registration/login and bearer-token authentication, followed by saving a health profile and calculating nutrition requirements from that profile. The README describes meal planning, AI, reminders, subscriptions, and other features as planned for this checkpoint, although corresponding source paths exist. Those branches are represented as product areas, not asserted as implemented. Connections are limited to routing or calls visible in excerpts, SOURCE INDEX references, or README statements.
Main entry points: food-recommendations.php Food recommendations · backend/index.php API router · database.php MySQL database · admin/index.php Admin dashboard
Components 32
API and identity
- API router
backend/index.php - Bearer authentication
backend/core/auth.php - Account endpoints
backend/api/v1/auth - Account deactivation
backend/api/v1/account.php
Health and nutrition
- Health profile
backend/api/v1/health/profile.php - Nutrition endpoints
backend/api/v1/health/nutrition - Nutrition calculations
backend/services/NutritionService.php - Health tracking
backend/services/HealthTrackingService.php - Medical profile
backend/services/HealthMedicalProfileService.php
Product capabilities
- Food recommendations
backend/api/v1/ai/food-recommendations.php - Food region preferences
backend/services/FoodLocationService.php - Recommendation history
backend/services/FoodRecommendationHistoryService.php - Food nutrition lookup
backend/services/FoodNutritionLookupService.php - Chat messaging
backend/api/v1/chatbot/message.php - Chatbot service
backend/services/ChatbotService.php - Gemini integration
backend/services/GeminiService.php - Feature entitlements
backend/services/EntitlementService.php - Reminder management
backend/models/Reminder.php - User settings
backend/models/UserSettings.php - Subscription management
backend/models/Subscription.php - Razorpay integration
backend/services/RazorpayService.php
Admin portal
- Admin authentication
backend/admin/includes/auth.php - Admin dashboard
backend/admin/index.php - Admin layout header
backend/admin/includes/header.php - Admin layout footer
backend/admin/includes/footer.php
Shared foundation
- MySQL database
backend/config/database.php - Request bootstrap
backend/bootstrap.php - JSON responses
backend/core/response.php
Other components
- Mobile client
- Admin users
- Google Gemini
- Razorpay
Connections 30
- Mobile client → API router: sends requests
- API router → Request bootstrap: initializes
backend/index.php - API router → Bearer authentication: loads
backend/index.php - API router → Nutrition endpoints: routes requests
backend/index.php - API router → Food recommendations: routes requests
backend/index.php - API router → Chat messaging: routes requests
backend/index.php - Account endpoints → Bearer authentication: validates credentials
- Health profile → MySQL database: stores profile
- Nutrition endpoints → Nutrition calculations: calculates requirements
- Nutrition endpoints → MySQL database: stores history
- Food recommendations → Food region preferences: loads region
backend/api/v1/ai/food-recommendations.php - Food recommendations → Health tracking: builds daily context
backend/api/v1/ai/food-recommendations.php - Food recommendations → Medical profile: loads allergies
backend/api/v1/ai/food-recommendations.php - Food recommendations → Feature entitlements: checks access
backend/api/v1/ai/food-recommendations.php - Food recommendations → Gemini integration: requests recommendations
backend/api/v1/ai/food-recommendations.php - Chat messaging → Chatbot service: delegates message
backend/api/v1/chatbot/message.php - Chatbot service → Gemini integration: generates replies
backend/services/ChatbotService.php - Chatbot service → Feature entitlements: checks access
backend/services/ChatbotService.php - Admin dashboard → Admin authentication: requires session
backend/admin/index.php - Admin dashboard → Admin layout header: renders header
backend/admin/index.php - Admin dashboard → Admin layout footer: renders footer
backend/admin/index.php - Admin authentication → MySQL database: queries admins
backend/admin/includes/auth.php - Admin users → MySQL database: authenticates against
- Request bootstrap → MySQL database: loads connection
backend/bootstrap.php - Request bootstrap → JSON responses: configures errors
backend/bootstrap.php - Food recommendations → Recommendation history: records results
backend/api/v1/ai/food-recommendations.php - Food recommendations → Food nutrition lookup: resolves nutrition
- Reminder management → User settings: uses preferences
backend/cron/reminders.php - Subscription management → Razorpay integration: delegates payment
backend/services/RazorpayService.php - Razorpay integration → Razorpay: calls provider