{"id":28203910,"url":"https://github.com/siddami/mycooking-ai","last_synced_at":"2025-07-06T23:32:46.200Z","repository":{"id":288233618,"uuid":"965596170","full_name":"Siddami/mycooking-ai","owner":"Siddami","description":null,"archived":false,"fork":false,"pushed_at":"2025-04-24T09:29:20.000Z","size":3640,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-10T14:43:29.748Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://mycooking-ai.vercel.app","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Siddami.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-04-13T14:09:19.000Z","updated_at":"2025-04-24T09:29:23.000Z","dependencies_parsed_at":"2025-04-24T10:24:38.096Z","dependency_job_id":null,"html_url":"https://github.com/Siddami/mycooking-ai","commit_stats":null,"previous_names":["siddami/mycooking-ai"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Siddami/mycooking-ai","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Siddami%2Fmycooking-ai","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Siddami%2Fmycooking-ai/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Siddami%2Fmycooking-ai/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Siddami%2Fmycooking-ai/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Siddami","download_url":"https://codeload.github.com/Siddami/mycooking-ai/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Siddami%2Fmycooking-ai/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263988647,"owners_count":23540238,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-05-17T03:16:07.589Z","updated_at":"2025-07-06T23:32:46.149Z","avatar_url":"https://github.com/Siddami.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MyCookingAI - AI-Driven Recipe Recommendation System\n\n## Overview\nHey there! I’m excited to walk you through MyCookingAI, a web app I built to make cooking a breeze by recommending personalized recipes using AI. This project was part of a task to create an innovative feature combining Angular and React in an Nx monorepo, and I chose to build an AI-driven recipe recommendation system. I’ll cover what the app does, its standout features, the hurdles I faced, and how I overcame them. Let’s dive in!\n\n## What’s MyCookingAI All About?\nMyCookingAI lets you input ingredients you have (like “rice, tomatoes, onions”), select a cuisine (e.g., Italian), and choose a dietary preference (e.g., vegetarian). It generates 6 unique recipes using the Google Gemini API and displays them in a sleek carousel where you can upvote or downvote to sort by popularity. I built this in an Nx monorepo, using Angular for the input form, React for the recipe carousel, and a NestJS API to handle AI interactions. The app is styled with Tailwind CSS for a consistent look, deployed on Vercel (frontend) and Render (API), with the code hosted on GitHub.\n\n## Key Features\nHere’s what makes MyCookingAI stand out:\n\n1. AI-Driven Recipe Recommendations:\n    Input ingredients, cuisine, and dietary preferences.\n    Uses the Google Gemini API to generate 6 tailored recipes.\n    Handles specific needs, like vegetarian Italian recipes.\n2. Angular + React Integration:\n    Angular powers the form for user inputs.\n    React drives a dynamic recipe carousel with a modal for full details.\n    Used an event bus (window.eventBus) to pass data between Angular and React, ensuring seamless communication.\n3. Interactive Recipe Sorting:\n    Upvote or downvote recipes in the carousel.\n    Recipes sort by popularity in real-time based on votes.\n4. Consistent Styling:\n    Tailwind CSS ensures the Angular form and React carousel have a uniform, user-friendly design.\n    No style clashes—just a clean, cohesive look.\n5. Production-Ready Deployment:\n\nFrontend deployed on Vercel at [https://mycooking-ai.vercel.app/].\nAPI deployed on Render at https://cooking-ai-api.onrender.com/.\nCode hosted on GitHub with clear commit messages for review.\n\n## How I Built It\nI used an Nx monorepo to manage the Angular, React, and NestJS apps in one repository. Here’s the breakdown:\n\n1. Nx Workspace:\n    Set up with npx create-nx-workspace@latest mycooking-ai --preset=apps, then added Angular, React, and NestJS apps.\n    Nx managed builds (e.g., nx build cooking-ai-angular) and dependencies efficiently.\n2. Angular Form:\n    Built in apps/cooking-ai-angular/ with Angular 18 (standalone components).\n    Created a reactive form for user inputs, sending data to the API via HttpClient.\n    Output to dist/form/, with --base-href=/form/ for routing.\n3. React Carousel:\n    Built in apps/cooking-ai-react/ with React 18.\n    Used Swiper.js for the carousel, with upvote/downvote buttons and real-time sorting.\n    Output to dist/recipes/, served as static assets on Vercel.\n4. NestJS API:\n    Built in api/ using NestJS.\n    Created a /api/vote endpoint to handle voting and a /generate-recipes endpoint to call the Gemini API.\n    Deployed on Render at https://cooking-ai-api.onrender.com/.\n\n### Frontend-Backend Connection:\nAngular form sends requests to the Render API (e.g., https://cooking-ai-api.onrender.com/api/generate-recipes).\nReact carousel sends vote updates to https://cooking-ai-api.onrender.com/api/vote.\nAdded CORS headers in NestJS to allow requests from https://mycooking-ai.vercel.app.\n\n## Deployment:\nFrontend (Vercel): Used a vercel.json to define builds and routes.\nCommitted dist/ to Git (removed from .gitignore) to ensure Vercel uses the built files.\nAdded GEMINI_API_KEY in Vercel’s Settings \u003e Environment Variables.\nAPI (Render): Deployed the NestJS API from the api/ directory, set GEMINI_API_KEY in Render’s environment variables, and exposed it at https://cooking-ai-api.onrender.com/.\nChallenges I Faced\nThis project had its share of challenges:\n\n## Integrating Angular and React:\n1. Originally planned to use Module Federation, but faced CORS and Webpack config issues.\n2. Switched to a simpler event bus (window.eventBus) to pass recipe data between Angular and React.\n\n3. Google Gemini API Issues:\n    The Gemini API sometimes generated incorrect recipes (e.g., meat in vegetarian requests).\n    Rate limits and timeouts disrupted development.\n4. Vercel Deployment Struggles:\n    Initial 404 errors because dist/ was in .gitignore, so Vercel couldn’t find the files.\n    Old builds persisted due to caching and static asset names (e.g., main.js).\n5. Real-Time Sorting Performance:\n    Sorting recipes by votes in the React carousel caused lag with frequent updates.\n6. Stylesheet Warning:\n    Angular build warned: Unable to locate stylesheet: /assets/styles.css.\n\n## Solutions I Came Up With\nHere’s how I addressed those challenges:\n\n1. Angular + React Integration:\n    Abandoned Module Federation due to complexity.\n    Used a global window.eventBus with RxJS BehaviorSubject to share data between Angular and React, adding a delay to ensure React was ready.\n2. Gemini API Fixes:\n    Refined the API prompt (e.g., “Generate 6 vegetarian recipes using rice, tomatoes, onions for Italian cuisine”).\n    Added a retry mechanism in the NestJS API (up to 3 retries on failure).\n3. Vercel Deployment:\n    Removed dist/ from .gitignore, committed the built files, and forced a clean build with vercel --prod --force.\n    Added asset hashing in Angular (outputHashing: \"all\") and Vite (entryFileNames: \"assets/[name].[hash].js\") to bust browser/CDN caches.\n    Updated vercel.json to ensure npm run prepare-deploy runs on each deploy, with rm -rf dist/ to avoid cache issues.\n4. Sorting Performance:\n    Debounced the sorting function in React (300ms delay) to reduce re-renders.\n    Stored vote state in memory to avoid full carousel updates.\n5. Stylesheet Warning:\n    Updated angular.json to include \"styles\": [\"src/assets/styles.css\"].\n    Copied assets/styles.css to dist/assets/styles.css in prepare-deploy to match the expected path.\n\n## Why This Project Rocks\n1. Innovation: An AI-driven recipe system using the Gemini API, with interactive voting, makes cooking fun and personalized.\n2. Technical Complexity: Combining Angular, React, and NestJS in an Nx monorepo, with a deployed frontend and backend, showcases advanced skills.\n3. Presentation: Clear documentation here and in the GitHub README, detailing features, challenges, and solutions.\nHow to Check It Out\nDeployed URL: [https://mycooking-ai.vercel.app/]\n\n1. Visit the Vercel URL.\n2. Enter ingredients (e.g., “rice, tomatoes, onions”), pick a cuisine (e.g., Italian), and a dietary preference (e.g., vegetarian).\n3. Click “Generate Recipes” to see 6 recipes in the carousel.\n4. Upvote or downvote recipes to sort them by popularity.\n\n## Wrapping Up\nMyCookingAI is a project I’m proud of—it’s innovative, technically challenging, and solves a real problem for anyone seeking quick, personalized recipes. I faced some tough hurdles but delivered it by the deadline (April 15, 2025), and it’s now live on Vercel and Render for you to try. Thanks for checking it out—I’d love to hear your feedback!\n\n## Screenshots before production \n![screenshot](/screen1.png)\n![screenshot](/screen2.png)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsiddami%2Fmycooking-ai","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsiddami%2Fmycooking-ai","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsiddami%2Fmycooking-ai/lists"}