A comprehensive web application that optimizes user-submitted recipes for health goals while finding the best prices for ingredients across multiple grocery stores. Built with Next.js 14, TypeScript, Prisma, and the Anthropic Claude API.
- π³ Recipe Management: Create and manage your favorite recipes
- π€ AI-Powered Optimization: Optimize recipes for your health goals using Claude AI
- π° Price Comparison: Compare ingredient prices across multiple grocery stores
- π Smart Shopping: Generate shopping lists with direct Instacart integration
- π Nutrition Tracking: Detailed nutritional information for all recipes
- πͺ Multi-Store Support: Find the best prices across different stores
- Framework: Next.js 14 with App Router
- Language: TypeScript
- Database: PostgreSQL with Prisma ORM
- AI: Anthropic Claude API for recipe optimization
- State Management: Zustand
- UI Components: Radix UI + Tailwind CSS
- Authentication: JWT-based auth system
Before you begin, ensure you have:
- Node.js 18+ installed
- PostgreSQL database (local or cloud)
- Anthropic API key (Get one here)
git clone <repository-url>
cd alihacksnpm installCreate a .env file in the root directory:
# Database
DATABASE_URL="postgresql://user:password@localhost:5432/recipe_optimizer?schema=public"
# Authentication
JWT_SECRET="your-secure-jwt-secret-at-least-32-characters-long"
# Anthropic API
ANTHROPIC_API_KEY="your-anthropic-api-key-here"
# App Configuration
NEXT_PUBLIC_APP_URL="http://localhost:3000"
NEXT_PUBLIC_USE_MOCK_API=true
NEXT_PUBLIC_ENABLE_PRICE_OPTIMIZATION=true# Generate Prisma Client
npx prisma generate
# Run database migrations
npx prisma db push
# (Optional) Open Prisma Studio to view your data
npx prisma studionpm run devOpen http://localhost:3000 in your browser.
alihacks/
βββ app/ # Next.js 14 App Router
β βββ api/ # API Routes
β β βββ auth/ # Authentication endpoints
β β βββ recipes/ # Recipe management
β β βββ grocery-list/ # Grocery list operations
β β βββ cart/ # Shopping cart generation
β β βββ instacart/ # Mock Instacart API
β βββ dashboard/ # Protected dashboard pages
β β βββ recipes/ # Recipe pages
β β βββ grocery-lists/ # Grocery list pages
β β βββ stores/ # Store browsing
β βββ login/ # Login page
β βββ signup/ # Signup page
β βββ page.tsx # Landing page
βββ components/
β βββ ui/ # Reusable UI components
βββ lib/
β βββ services/ # Business logic services
β β βββ recipe-optimizer.ts # Claude AI integration
β β βββ instacart-mock.ts # Mock Instacart service
β β βββ price-engine.ts # Price comparison logic
β βββ stores/ # Zustand state stores
β βββ auth.ts # Authentication utilities
β βββ db.ts # Prisma client
β βββ types.ts # TypeScript types
β βββ utils.ts # Helper functions
βββ mocks/
β βββ data/ # Mock data for stores/products
βββ prisma/
β βββ schema.prisma # Database schema
βββ public/ # Static assets
The application uses the Anthropic Claude API to intelligently optimize recipes:
- Submit any recipe with ingredients and instructions
- AI analyzes the recipe based on your health goals
- Suggests healthier ingredient substitutions
- Maintains the dish's identity and taste
- Provides detailed nutritional information
The price comparison engine:
- Searches for all ingredients across multiple stores
- Compares prices in real-time
- Suggests the best single-store option
- Identifies multi-store savings opportunities
- Calculates delivery fees and minimum orders
Generate consolidated shopping lists:
- Select multiple recipes
- Automatically consolidates duplicate ingredients
- Handles unit conversions (cups to tbsp, etc.)
- Groups items by category
- Creates deep links to Instacart for one-click checkout
POST /api/auth/signup- Create new accountPOST /api/auth/login- LoginPOST /api/auth/logout- LogoutGET /api/auth/me- Get current user
POST /api/recipes/create- Create recipeGET /api/recipes/list- List all recipesGET /api/recipes/[id]- Get recipe detailsPOST /api/recipes/optimize- Optimize recipe with AIDELETE /api/recipes/[id]- Delete recipe
POST /api/grocery-list/create- Create grocery listGET /api/grocery-list/list- List all grocery listsGET /api/grocery-list/[id]- Get list detailsPOST /api/grocery-list/prices- Fetch price comparisons
POST /api/cart/create-link- Generate Instacart deep link
GET /api/instacart/stores- Get available storesPOST /api/instacart/search- Search products
The application uses Prisma with PostgreSQL. Key models:
- User: User accounts and profiles
- UserProfile: Dietary preferences, goals, and restrictions
- Recipe: Recipe data with ingredients and instructions
- RecipeIngredient: Individual recipe ingredients
- Nutrition: Nutritional information
- GroceryList: Shopping lists
- GroceryListItem: Items in a grocery list
- PriceComparison: Price data from different stores
- ShoppingCart: Generated shopping cart links
npm testnpm run build
npm start# View database in Prisma Studio
npx prisma studio
# Create a new migration
npx prisma migrate dev --name your_migration_name
# Reset database
npx prisma migrate reset- Push your code to GitHub
- Import project in Vercel
- Add environment variables
- Deploy
Make sure to set these in your deployment platform:
DATABASE_URL- Your production PostgreSQL URLJWT_SECRET- A secure secret for JWT tokensANTHROPIC_API_KEY- Your Anthropic API keyNEXT_PUBLIC_APP_URL- Your production URL
The application includes mock data for development:
- Products: 36 sample products across categories
- Stores: 5 sample stores with realistic pricing
- Instacart API: Fully functional mock API with realistic delays
- Real Instacart API integration
- Walmart and Kroger API integration
- Meal planning calendar
- Recipe sharing and community features
- Mobile app (React Native)
- Barcode scanning for pantry management
- Advanced nutrition analytics
- Recipe recommendations based on available ingredients
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
MIT License - feel free to use this project for learning and development.
For questions or issues, please open a GitHub issue.
- Anthropic Claude for AI-powered recipe optimization
- Radix UI for accessible component primitives
- Tailwind CSS for styling
- Prisma for database management
Built with β€οΈ for healthier, more affordable cooking.