<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Kiran kumar</title>
    <description>The latest articles on DEV Community by Kiran kumar (@kiran_kumar_bd5897c125e94).</description>
    <link>https://dev.to/kiran_kumar_bd5897c125e94</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3563865%2F19ef9473-2ab7-458d-b8ac-dbe43c7dad30.jpg</url>
      <title>DEV Community: Kiran kumar</title>
      <link>https://dev.to/kiran_kumar_bd5897c125e94</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/kiran_kumar_bd5897c125e94"/>
    <language>en</language>
    <item>
      <title>How I Built an AI Product Recommendation App in React Native Using Google Gemini</title>
      <dc:creator>Kiran kumar</dc:creator>
      <pubDate>Tue, 21 Oct 2025 09:34:42 +0000</pubDate>
      <link>https://dev.to/kiran_kumar_bd5897c125e94/how-i-built-an-ai-product-recommendation-app-in-react-native-using-google-gemini-4cbb</link>
      <guid>https://dev.to/kiran_kumar_bd5897c125e94/how-i-built-an-ai-product-recommendation-app-in-react-native-using-google-gemini-4cbb</guid>
      <description>&lt;h2&gt;
  
  
  🚀 Building a Product Recommendation App in React Native Using Google Gemini (No Backend Needed)
&lt;/h2&gt;

&lt;p&gt;Generative AI is transforming how we build apps. Instead of manually coding endless rules, we can now let AI &lt;strong&gt;reason over data&lt;/strong&gt; and provide &lt;strong&gt;context-aware answers&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;In this article, I'll walk you through how I built a **React Native app **that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Takes a &lt;strong&gt;user's natural-language query&lt;/strong&gt; (e.g., &lt;em&gt;"I need a lightweight laptop with long battery life"&lt;/em&gt;)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Runs it through &lt;strong&gt;Google's Gemini API&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Compares the query against a static &lt;strong&gt;product catalog&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Returns &lt;strong&gt;personalised recommendations with explanations&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All of this, without a backend - and built on &lt;strong&gt;snack.expo.dev&lt;/strong&gt; so anyone can try it instantly, without worrying about dependency injection or setup.&lt;/p&gt;




&lt;h2&gt;
  
  
  🌟 Why This Matters
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Product recommendations&lt;/strong&gt; are everywhere - e-commerce apps, streaming platforms, food delivery.&lt;br&gt;
Traditionally, they require a &lt;strong&gt;server-side engine&lt;/strong&gt; with rules or ML models.&lt;br&gt;
With LLMs like &lt;strong&gt;Gemini&lt;/strong&gt;, we can &lt;strong&gt;skip the backend&lt;/strong&gt; for quick prototypes, letting AI handle the reasoning.&lt;br&gt;
By building this on &lt;strong&gt;Snack&lt;/strong&gt;, anyone can fork and experiment without touching native config or setup.&lt;/p&gt;

&lt;p&gt;This makes it possible to &lt;strong&gt;learn, prototype, and share quickly&lt;/strong&gt;.&lt;/p&gt;


&lt;h2&gt;
  
  
  🏗️ High-Level Flow
&lt;/h2&gt;

&lt;p&gt;Here’s how the system fits together:&lt;/p&gt;


  &lt;pre&gt;

📱 User Query
+------------------+
| "Need a laptop"  |
+------------------+
          |
          v
💻 React Native Frontend
+---------------------------+
| TextInput + Submit Button |
+---------------------------+
          |
          v
📦 Product Catalog (JSON)
+---------------------------+
| Local JSON product data   |
+---------------------------+
          |
          v
🧠 Gemini API Call
+---------------------------+
| Prompt + Catalog + API Key|
+---------------------------+
          |
          v
📨 Gemini Response (JSON)
+---------------------------+
| Recommendations + Reasons |
+---------------------------+
          |
          v
🎨 Mobile UI Rendering
+---------------------------+
| Product Cards + Why Chosen|
+---------------------------+

 &lt;/pre&gt;


&lt;h2&gt;
  
  
  🧩 How Gemini Works in This App
&lt;/h2&gt;

&lt;p&gt;Think of Gemini as a &lt;strong&gt;normal API&lt;/strong&gt;:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Make an HTTP POST request&lt;/strong&gt; to the Gemini endpoint.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Send along:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;🔑 &lt;strong&gt;API Key&lt;/strong&gt; — passed in the request URL.&lt;/li&gt;
&lt;li&gt;💬 &lt;strong&gt;Prompt&lt;/strong&gt; — included in the request body (user query + product catalog + output instructions).&lt;/li&gt;
&lt;li&gt;📦 &lt;strong&gt;Headers&lt;/strong&gt; — structured as &lt;code&gt;Content-Type: application/json&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Gemini processes&lt;/strong&gt; the request and returns a structured response object.&lt;/li&gt;
&lt;li&gt;Since the output is strictly &lt;strong&gt;JSON&lt;/strong&gt;, you can safely parse it into &lt;strong&gt;React Native state&lt;/strong&gt; and render the results.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In other words:&lt;br&gt;
Prompt In  ---&amp;gt;  Gemini API  ---&amp;gt;  Structured JSON Out&lt;br&gt;
👉 The &lt;strong&gt;key takeaway&lt;/strong&gt;: Gemini doesn't magically decide the format - &lt;strong&gt;you enforce it&lt;/strong&gt; with prompt engineering ("Return JSON with fields: name, reason").&lt;/p&gt;


&lt;h2&gt;
  
  
  ⚙️ Tech Stack
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;React Native (Expo Snack)&lt;/strong&gt; - mobile UI with zero setup.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Google Gemini API&lt;/strong&gt; - natural language reasoning.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Static Product Catalog&lt;/strong&gt; - local JSON file.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Inline Key Management&lt;/strong&gt; - reviewers can add their own Gemini key directly in Snack.&lt;/li&gt;
&lt;/ul&gt;


&lt;h2&gt;
  
  
  📂 Project Structure
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/project-root
  /components
    ProductCard.tsx
  /data
    PRODUCT_CATALOG.js
  /screens
    HomeScreen.tsx
  App.tsx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;em&gt;(No dependency injection required - everything runs in Snack.)&lt;/em&gt;&lt;/p&gt;


&lt;h2&gt;
  
  
  📦 Example Product Catalog
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// /data/PRODUCT_CATALOG.js
export const PRODUCT_CATALOG = [
  { id: 1, name: "UltraLight Laptop", weight: "1.1kg", battery: "15h" },
  { id: 2, name: "PowerMax Pro", weight: "2.3kg", battery: "20h" },
  { id: 3, name: "BudgetBook", weight: "1.9kg", battery: "8h" },
];
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  🔑 Gemini API Integration
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// /screens/HomeScreen.tsx
import React, { useState } from "react";
import { View, TextInput, Button, FlatList, Text } from "react-native";
import { PRODUCT_CATALOG } from "../data/PRODUCT_CATALOG";
export default function HomeScreen() {
  const [query, setQuery] = useState("");
  const [results, setResults] = useState([]);
const fetchRecommendations = async () =&amp;gt; {
    const prompt = `
You are a product recommendation assistant.
Here is the product catalog:
${JSON.stringify(PRODUCT_CATALOG)}
User request: "${userQuery}"
Task:
1. Pick 2–3 products from the catalog that best match the request.
2. For each, provide:
- "name": product name
- "reason": why it matches
3. Respond ONLY in valid JSON array format.
`;
    const response = await fetch(
      "https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash:generateContent?key=" +
        "YOUR_GEMINI_API_KEY_HERE",
      {
        method: "POST",
        headers: { "Content-Type": "application/json" },
        body: JSON.stringify({
          contents: [{ parts: [{ text: prompt }] }],
        }),
      }
    );
    const data = await response.json();
    const text = data.candidates?.[0]?.content?.parts?.[0]?.text || "[]";
    setResults(JSON.parse(text));
  };
  return (
    &amp;lt;View style={{ padding: 20 }}&amp;gt;
      &amp;lt;TextInput
        placeholder="Describe what you need..."
        value={query}
        onChangeText={setQuery}
        style={{ borderWidth: 1, padding: 10, marginBottom: 10 }}
      /&amp;gt;
      &amp;lt;Button title="Get Recommendations" onPress={fetchRecommendations} /&amp;gt;
      &amp;lt;FlatList
        data={results}
        keyExtractor={(item, i) =&amp;gt; i.toString()}
        renderItem={({ item }) =&amp;gt; (
          &amp;lt;View style={{ marginTop: 10 }}&amp;gt;
            &amp;lt;Text style={{ fontWeight: "bold" }}&amp;gt;{item.name}&amp;lt;/Text&amp;gt;
            &amp;lt;Text&amp;gt;{item.reason}&amp;lt;/Text&amp;gt;
          &amp;lt;/View&amp;gt;
        )}
      /&amp;gt;
    &amp;lt;/View&amp;gt;
  );
}


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  🎨 Sample Output
&lt;/h2&gt;

&lt;p&gt;If the user types:&lt;br&gt;
&lt;em&gt;&lt;code&gt;"I need a lightweight laptop for travel with long battery life"&lt;/code&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Gemini might respond:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[
  {
    "name": "UltraLight Laptop",
    "reason": "It weighs only 1.1kg and lasts 15h, perfect for travel."
  },
  {
    "name": "PowerMax Pro",
    "reason": "Though heavier, it offers 20h battery life for long trips."
  }
]

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And the app renders recommendation cards with reasons under each product.&lt;/p&gt;




&lt;h2&gt;
  
  
  📌 Key Learnings
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Gemini behaves like a standard API&lt;/strong&gt; - you send structured input, get structured output.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Prompt engineering&lt;/strong&gt; is essential to enforce JSON responses.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Frontend-only POCs&lt;/strong&gt; are possible with Snack - no native setup, no dependency injection.&lt;/li&gt;
&lt;li&gt;LLMs excel at &lt;strong&gt;reasoning across structured data&lt;/strong&gt; like catalogs.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  🚀 What's Next?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Add filters (price, availability).&lt;/li&gt;
&lt;li&gt;Secure the flow with a backend proxy for API keys.&lt;/li&gt;
&lt;li&gt;Extend to &lt;strong&gt;multi-modal catalogs&lt;/strong&gt; (products with images + specs).&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🎯 Conclusion
&lt;/h2&gt;

&lt;p&gt;This project shows how quickly you can integrate &lt;strong&gt;Generative AI into mobile apps&lt;/strong&gt; with Gemini.&lt;/p&gt;

&lt;p&gt;By using &lt;strong&gt;snack.expo.dev&lt;/strong&gt;, I avoided dependency injection headaches and made it super easy for anyone to fork, add their API key, and explore AI-powered recommendations.&lt;/p&gt;

&lt;p&gt;👉 If you'd like to dive deeper into the code:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I've hosted the full implementation in a &lt;strong&gt;private GitHub repository&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;You can &lt;strong&gt;send me a request to fork it&lt;/strong&gt; and explore locally.&lt;/li&gt;
&lt;li&gt;This helps me understand how many developers are truly interested in experimenting with this project.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://github.com/kiran-kumar011/my-ai-advisor-app" rel="noopener noreferrer"&gt;🔗 Request access to the GitHub repo&lt;/a&gt;&lt;/p&gt;

</description>
      <category>google</category>
      <category>reactnative</category>
      <category>ai</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
