A comprehensive backend system for managing cultural dietary preferences, Ayurvedic nutrition, and traditional food practices with local-first operation using SQLite.
- User Management: Profile management with cultural and dietary preferences
- Recipe Database: Authentic recipes with cultural and Ayurvedic metadata
- Meal Planning: Smart meal generation based on cultural rules and preferences
- Shopping Lists: Retailer-organized shopping with cultural ingredient mapping
- Product Catalog: Multi-retailer product database with cultural classifications
- Cultural Rules Engine: Comprehensive validation for dietary and cultural compliance
- Hindu Dietary Compliance: No red meat, traditional food practices
- Ayurvedic Dosha Support: Vata, Pitta, Kapha-based meal recommendations
- Multi-Cultural: North Indian, South Indian, Mughlai, Gujarati, and international cuisines
- Retailer Integration: Patel Brothers, Subzi Mandi, Hanuman, Trader Joe's
- Dietary Restrictions: Vegetarian, vegan, medical restrictions, cultural requirements
- Backend: Node.js + Express + TypeScript
- Database: SQLite (local-first operation)
- Architecture: Repository pattern with service layer
- Authentication: JWT-based with bcrypt password hashing
- Validation: Joi schema validation with cultural compliance checking
src/
βββ controllers/ # API route handlers
βββ repositories/ # Data access layer (Repository pattern)
βββ services/ # Business logic (Cultural rules engine)
βββ middleware/ # Authentication, validation, error handling
βββ utils/ # Validation, auth, error utilities
βββ types/ # TypeScript type definitions
βββ database/ # Database schema, migration, seeding
βββ server.ts # Main application entry point
- Docker: Docker Desktop (recommended) or Docker Engine + Docker Compose
- OR Node.js: Node.js 18+ and npm (for native development)
- Git
- Quick Start
git clone <repository-url>
cd cultural-diet-app
./quick-start.sh- Or manual Docker setup
# Start development environment
./deploy.sh dev up
# Access the application
# Frontend: http://localhost:3001
# Backend API: http://localhost:3000
# Health Check: http://localhost:3000/health- Docker documentation π See DOCKER_SETUP.md for comprehensive Docker documentation
- Clone and setup
git clone <repository-url>
cd diet_doctor
npm install- Environment configuration
cp .env.example .env
# Edit .env with your configuration- Database setup
# Run database migration
npm run migrate
# Seed with sample data
npm run seed- Start development server
npm run devThe server will start on http://localhost:3000
npm run dev- Development server with auto-reloadnpm run build- Build for productionnpm run start- Start production servernpm run migrate- Run database migrationsnpm run seed- Seed sample datanpm run test- Run testsnpm run lint- Run linting
- Development:
http://localhost:3000/api/v1 - Health Check:
http://localhost:3000/health
All authenticated endpoints require a JWT token in the Authorization header:
Authorization: Bearer <your-jwt-token>
POST /auth/register- User registrationPOST /auth/login- User loginGET /users/profile- Get user profilePUT /users/profile- Update user profilePOST /users/change-password- Change passwordDELETE /users/account- Delete account
GET /recipes- Search recipes with cultural filtersGET /recipes/:id- Get recipe detailsGET /recipes/favorites- Get user's favorite recipesPOST /recipes/:id/favorite- Add to favoritesPOST /recipes/:id/rate- Rate recipePOST /recipes- Create new recipe
POST /meal-plans/generate- Generate meal planGET /meal-plans- Get user's meal plansGET /meal-plans/:date- Get meal plan for specific datePUT /meal-plans/:date- Update meal planGET /meal-plans/stats- Get meal planning statistics
POST /shopping-lists- Create shopping listGET /shopping-lists- Get user's shopping listsGET /shopping-lists/:id- Get shopping list detailsPOST /shopping-lists/:id/items- Add item to listPATCH /shopping-lists/:id/items/:itemId- Update item statusPOST /shopping-lists/from-meal-plan- Generate from meal plan
GET /products- Search productsGET /products/retailers- Get retailer informationGET /products/categories- Get product categoriesGET /products/price-comparison- Compare prices across retailersGET /products/:retailer/:sku- Get specific product
GET /cultural-rules- Get cultural dietary rulesPOST /cultural-rules/validate-recipe/:recipeId- Validate recipe compliancePOST /cultural-rules/validate-ingredient- Validate ingredientGET /cultural-rules/substitutions- Get ingredient substitutesGET /cultural-rules/ayurvedic-recommendations- Get Ayurvedic guidanceGET /cultural-rules/hindu-dietary-guidance- Get Hindu dietary principles
- Hindu Dietary Restrictions: No beef, limited pork, traditional practices
- Ayurvedic Dosha System: Vata/Pitta/Kapha balancing recommendations
- Vegetarian/Vegan: Plant-based dietary preferences
- Medical Restrictions: Gluten-free, lactose-free, allergies
- Cultural Traditions: Jain fasting, Sattvic principles
- Recipe compliance checking with scoring system
- Ingredient validation with substitution suggestions
- Cultural authenticity verification
- Ayurvedic balance analysis
- Patel Brothers: Indian grocery specialist
- Subzi Mandi: Fresh produce and Indian ingredients
- Hanuman: Traditional Indian food products
- Trader Joe's: Modern alternatives and organic options
- Price comparison across retailers
- Cultural ingredient mapping
- Shopping list generation by retailer
- Product substitution suggestions
users- User profiles with cultural preferencesrecipes- Recipe database with cultural metadatameal_plans- User meal planning datashopping_lists- Shopping lists with retailer groupingproduct_catalog- Multi-retailer product databasecultural_rules- Dietary and cultural restriction rules
- User β Meal Plans (1:N)
- User β Shopping Lists (1:N)
- User β Recipe Favorites (M:N)
- Product β Cultural Tags (M:N)
- Recipes β Ayurvedic Properties (1:1)
- JWT-based authentication with refresh tokens
- Password hashing with bcrypt (12 rounds)
- Input validation with Joi schemas
- CORS configuration for frontend integration
- SQL injection prevention with parameterized queries
- Rate limiting ready (implementation optional)
- Authentic recipes from cultural sources
- Traditional cooking methods preserved
- Cultural notes and historical context
- Regional cuisine differentiation
- Religious restriction enforcement
- Cultural practice respect and accuracy
- Traditional ingredient mapping
- Modern adaptation guidelines
npm testnpm run lint # ESLint checking
npm run typecheck # TypeScript type checkingnpm run migrate # Run migrations
npm run migrate:down # Rollback migrations
npm run seed # Seed sample data
npm run seed:reset # Reset and reseed- SQLite optimization with proper indexing
- Efficient query patterns with repository layer
- Lazy loading for large datasets
- Pagination for resource management
- JSON field optimization for complex data
- Offline capability with local SQLite database
- No external database dependencies
- Fast local operation without network latency
- Simple deployment and scaling
- TypeScript strict mode enforced
- Comprehensive test coverage required
- Cultural accuracy and sensitivity mandatory
- Documentation updates for new features
- Respect for all dietary traditions required
- Accurate representation of cultural practices
- Community consultation for new cultural additions
- Proper attribution for traditional knowledge
MIT License - See LICENSE file for details
- Traditional recipe sources and cultural knowledge keepers
- Ayurvedic practitioners and nutritionists
- Community members providing authentic recipes
- Retail partners for product information
Built with β€οΈ for cultural preservation and dietary freedom.