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.