https://github.com/chiragagg5k/prompt-eats
Real-time recipe recommendation app using Fluvio, Spoonacular API, and WebSockets
Science Score: 13.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
○.zenodo.json file
-
○DOI references
-
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (11.1%) to scientific vocabulary
Keywords
Repository
Real-time recipe recommendation app using Fluvio, Spoonacular API, and WebSockets
Basic Info
Statistics
- Stars: 7
- Watchers: 1
- Forks: 0
- Open Issues: 0
- Releases: 0
Topics
Metadata Files
README.md
Prompt Eats

This project is a recipe recommendation application that uses Fluvio, Spoonacular API, Express, and WebSockets to provide live updates of recipes being searched by users. The backend processes search queries and streams recipe data to the frontend, where it is displayed in real-time.
Table of Contents
- Demo
- Installation
- Usage
- Features
- Architecture
- API Endpoints
- WebSocket Integration
- Frontend Integration
- Clearing Old Data
- Contributing
- License
**Demo
https://github.com/user-attachments/assets/4b9b2f5d-bdf5-4fbd-8758-bcf9f42b0186

Installation
To get started with this project, follow the steps below:
Prerequisites
- Node.js (v14 or higher)
- npm (v6 or higher)
- Fluvio CLI (Ensure Fluvio is installed and running)
Clone the Repository
bash
git clone https://github.com/ChiragAgg5k/prompt-eats
cd prompt-eats
Install Dependencies
```bash cd frontend npm install
cd ../backend npm install ```
Environment Variables
Create two .env files in the frontend and backend directories with the following variables:
- Frontend:
env
NEXT_PUBLIC_BACKEND_URL=http://localhost:8000
- Backend:
env
SPOONACULAR_API_KEY=your_spoonacular_api_key
Start the Backend Server
bash
cd backend
npm run start # or `nodemon index.ts` for development
The backend server will start on http://localhost:8000.
Start the Frontend Server
bash
cd frontend
npm run dev
The frontend server will start on http://localhost:3000.
Features
Real-Time Recipe Updates:
- Users receive live updates of recipes being searched by others, displayed instantly on the frontend.
Spoonacular API Integration:
- Fetch detailed recipes from the Spoonacular API, including titles, descriptions, images, and preparation time.
WebSocket-Based Streaming:
- Uses WebSockets to push new recipes to connected clients as they are searched.
Fluvio for Streaming Data:
- Leverages Fluvio to stream and manage real-time data efficiently.
Trending Recipes:
- Fetches a list of trending recipes from the Spoonacular API.

Architecture
The project is divided into two main components:
- Backend (Express + Fluvio):
- **Express:** Handles HTTP requests, serves API endpoints, and manages WebSocket connections.
- **Fluvio:** Manages streaming of recipe data between the backend and frontend.
- **Spoonacular API:** Fetches recipe data based on user prompts.
- Frontend (Nextjs + WebSocket):
- Nextjs: Displays the list of recipes in real-time as they are received.
- WebSocket: Maintains a persistent connection with the backend to receive live updates.
API Endpoints
1. GET /trending
Fetches a list of trending recipes.
- Query Parameters:
- None
- Response:
- An array of recipe objects with the following fields:
-
id: Recipe ID -
title: Recipe title (truncated) -
description: Short description -
image: Image URL -
readyInMinutes: Preparation time in minutes -
url: Link to the full recipe
-
- An array of recipe objects with the following fields:
2. POST /search
Searches for recipes based on a user-provided prompt and streams the results via Fluvio.
- Request Body:
-
prompt: The search query provided by the user.
-
- Response:
- A message indicating that the recipes have been sent to Fluvio.
WebSocket Integration
The WebSocket server listens for incoming connections and streams new recipe data as soon as it's available. The WebSocket connection is established on ws://localhost:3000.
Client-Side Integration Example (React)
```javascript useEffect(() => { const ws = new WebSocket("ws://localhost:3000");
ws.onmessage = (event) => {
const recipe = JSON.parse(event.data);
setRecipes((prevRecipes) => [...prevRecipes, recipe]);
};
ws.onclose = () => {
console.log("WebSocket connection closed");
};
return () => {
ws.close();
};
}, []); ```
Frontend Integration
To integrate the backend with the frontend:
- Connect to WebSocket:
- Establish a WebSocket connection to receive real-time updates.
- Render Recipes:
- Display the received recipes in a list or any other desired format.
Example frontend code can be found in the src/App.tsx file.
Clearing Old Data
This project uses Offset.FromEnd() to start consuming from the latest offset, effectively skipping all old messages. This ensures that only new messages are processed, keeping the data fresh.
To reset the topic entirely, you can delete and recreate the Fluvio topic:
bash
fluvio topic delete recipe-stream
fluvio topic create recipe-stream
Contributing
Contributions are welcome! Please fork the repository and create a pull request with your changes. Ensure that your code follows the established style and passes all tests.
- Fork the Repository:
- Click on the "Fork" button at the top right of this repository.
- Clone the Forked Repository:
- `git clone https://github.com/yourusername/real-time-recipe-app.git`
- Create a New Branch:
- `git checkout -b feature/your-feature-name`
- Make Your Changes:
- Implement your feature or fix.
- Push to Your Fork:
- `git push origin feature/your-feature-name`
- Create a Pull Request:
- Submit a pull request to the main repository for review.
License
This project is licensed under the MIT License. See the LICENSE file for details.
This README should provide a comprehensive guide to setting up, using, and contributing to the project. If you have any questions or need further assistance, feel free to open an issue in the GitHub repository.
Owner
- Name: Chirag Aggarwal
- Login: ChiragAgg5k
- Kind: user
- Location: Noida , Uttar Pradesh , India
- Company: Bennett University
- Twitter: ChiragAgg5k
- Repositories: 3
- Profile: https://github.com/ChiragAgg5k
CSE Undergrad | Student at Bennett University
GitHub Events
Total
Last Year
Issues and Pull Requests
Last synced: 7 months ago
All Time
- Total issues: 0
- Total pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Total issue authors: 0
- Total pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels
Dependencies
- @types/body-parser 1.19.5 development
- @types/connect 3.4.38 development
- @types/express 4.17.21 development
- @types/express-serve-static-core 4.19.5 development
- @types/http-errors 2.0.4 development
- @types/mime 1.3.5 development
- @types/node 22.4.0 development
- @types/qs 6.9.15 development
- @types/range-parser 1.2.7 development
- @types/send 0.17.4 development
- @types/serve-static 1.15.7 development
- typescript 5.5.4 development
- undici-types 6.19.6 development
- @fluvio/client 0.14.9
- accepts 1.3.8
- array-flatten 1.1.1
- asynckit 0.4.0
- axios 1.7.4
- body-parser 1.20.2
- bytes 3.1.2
- call-bind 1.0.7
- combined-stream 1.0.8
- content-disposition 0.5.4
- content-type 1.0.5
- cookie 0.6.0
- cookie-signature 1.0.6
- debug 2.6.9
- define-data-property 1.1.4
- delayed-stream 1.0.0
- depd 2.0.0
- destroy 1.2.0
- ee-first 1.1.1
- encodeurl 1.0.2
- es-define-property 1.0.0
- es-errors 1.3.0
- escape-html 1.0.3
- etag 1.8.1
- express 4.19.2
- finalhandler 1.2.0
- follow-redirects 1.15.6
- form-data 4.0.0
- forwarded 0.2.0
- fresh 0.5.2
- function-bind 1.1.2
- get-intrinsic 1.2.4
- gopd 1.0.1
- has-property-descriptors 1.0.2
- has-proto 1.0.3
- has-symbols 1.0.3
- hasown 2.0.2
- http-errors 2.0.0
- iconv-lite 0.4.24
- inherits 2.0.4
- ipaddr.js 1.9.1
- media-typer 0.3.0
- merge-descriptors 1.0.1
- methods 1.1.2
- mime 1.6.0
- mime-db 1.52.0
- mime-types 2.1.35
- ms 2.1.3
- ms 2.0.0
- negotiator 0.6.3
- object-inspect 1.13.2
- on-finished 2.4.1
- parseurl 1.3.3
- path-to-regexp 0.1.7
- proxy-addr 2.0.7
- proxy-from-env 1.1.0
- qs 6.11.0
- range-parser 1.2.1
- raw-body 2.5.2
- safe-buffer 5.2.1
- safer-buffer 2.1.2
- send 0.18.0
- serve-static 1.15.0
- set-function-length 1.2.2
- setprototypeof 1.2.0
- side-channel 1.0.6
- statuses 2.0.1
- toidentifier 1.0.1
- type-is 1.6.18
- unpipe 1.0.0
- utils-merge 1.0.1
- vary 1.1.2
- @types/express ^4.17.21 development
- @types/node ^22.4.0 development
- typescript ^5.5.4 development
- @fluvio/client ^0.14.9
- axios ^1.7.4
- express ^4.19.2
- 368 dependencies
- @types/node ^20 development
- @types/react ^18 development
- @types/react-dom ^18 development
- eslint ^8 development
- eslint-config-next 14.2.5 development
- postcss ^8 development
- tailwindcss ^3.4.1 development
- typescript ^5 development
- @radix-ui/react-icons ^1.3.0
- @radix-ui/react-slot ^1.1.0
- class-variance-authority ^0.7.0
- clsx ^2.1.1
- lucide-react ^0.428.0
- next 14.2.5
- react ^18.3.1
- react-dom ^18
- tailwind-merge ^2.5.2
- tailwindcss-animate ^1.0.7