Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions lego-hunter/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/versions

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

# env files (can opt-in for committing if needed)
.env*

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
135 changes: 135 additions & 0 deletions lego-hunter/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
# Lego Restock Hunter - Global Inventory Finder

## Demo

![lego-hunter Demo](./75339b8c-4e68-490d-89cf-96c62334598a.jpg)

**Live Demo:** https://lego-hunter.vercel.app/
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Use Markdown link syntax for the URL.

The bare URL should use proper Markdown link syntax for better compatibility and rendering across different Markdown processors.

Proposed fix
-**Live Demo:** https://lego-hunter.vercel.app/
+**Live Demo:** [https://lego-hunter.vercel.app/](https://lego-hunter.vercel.app/)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
**Live Demo:** https://lego-hunter.vercel.app/
**Live Demo:** [https://lego-hunter.vercel.app/](https://lego-hunter.vercel.app/)
🧰 Tools
🪛 markdownlint-cli2 (0.18.1)

7-7: Bare URL used

(MD034, no-bare-urls)

🤖 Prompt for AI Agents
In `@lego-hunter/README.md` at line 7, Update the README line that currently shows
a bare URL by replacing it with proper Markdown link syntax; change the "Live
Demo:" line to use a labeled link like [Live
Demo](https://lego-hunter.vercel.app/) so the URL renders consistently across
Markdown processors.


The Lego Restock Hunter is a powerful inventory search tool designed to find rare or sold-out Lego sets across 15+ global retailers simultaneously. It uses AI to discover the best retailers for a specific set, deploys parallel Mino browser agents to check stock and pricing, and finishes with a Gemini-powered analysis to recommend the single best deal (balancing price and shipping).

---

---

## Demo

*[Demo video/screenshot to be added]*
Comment on lines +3 to +17
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Remove duplicate Demo section.

There are two "## Demo" sections (lines 3-9 and lines 15-17). The second section at lines 15-17 contains placeholder text and appears redundant. Consider removing lines 13-17 (including the extra separator).

Proposed fix
 ![lego-hunter Demo](./75339b8c-4e68-490d-89cf-96c62334598a.jpg)
 
 **Live Demo:** https://lego-hunter.vercel.app/
 
 The Lego Restock Hunter is a powerful inventory search tool designed to find rare or sold-out Lego sets across 15+ global retailers simultaneously. It uses AI to discover the best retailers for a specific set, deploys parallel Mino browser agents to check stock and pricing, and finishes with a Gemini-powered analysis to recommend the single best deal (balancing price and shipping).
 
 ---
 
----
-
-## Demo
-
-*[Demo video/screenshot to be added]*
-
----
-
 ## How Mino API is Used
🧰 Tools
🪛 markdownlint-cli2 (0.18.1)

7-7: Bare URL used

(MD034, no-bare-urls)


15-15: Multiple headings with the same content

(MD024, no-duplicate-heading)

🤖 Prompt for AI Agents
In `@lego-hunter/README.md` around lines 3 - 17, Remove the duplicate "## Demo"
block that contains only the placeholder "*[Demo video/screenshot to be
added]*": locate the second "## Demo" heading and the trailing separator and
delete that entire section (the heading and the placeholder text) so only the
first Demo section with the image and live demo link remains; ensure the
top-level separators ("---") remain intact around the kept content.


---

## How Mino API is Used

The Mino API powers browser automation for this use case. See the code snippet below for implementation details.

### Code Snippet

```bash
curl -N -X POST "https://mino.ai/v1/automation/run-sse" \
-H "X-API-Key: $MINO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://www.lego.com/en-us/search?q=75192",
"goal": "Search for Millennium Falcon Lego set. Extract inStock, price, and shipping. Return JSON.",
"browser_profile": "lite"
}'
```

---

## How to Run

### Prerequisites

- Node.js 18+
- Mino API key (get from [mino.ai](https://mino.ai))

### Setup

1. Clone the repository:
```bash
git clone <repo-url>
cd lego-hunter
```

2. Install dependencies:
```bash
npm install
```

3. Create `.env.local` file:
```bash
# Add your environment variables here
MINO_API_KEY=sk-mino-...
```

4. Run the development server:
```bash
npm run dev
```

5. Open [http://localhost:3000](http://localhost:3000) in your browser

---

## Architecture Diagram

```mermaid
graph TD
subgraph Frontend [Next.js Client]
UI[User Interface - Lego Brick Style]
State[Retailer Status & Best Deal]
end

subgraph Backend [Next.js API Routes]
UrlGen[/api/generate-urls]
Search[/api/search-lego]
end

subgraph External_APIs [External Services]
Gemini[Gemini 2.0 - URL Gen & Analysis]
Mino[Mino API - Browser Automation]
end

%% User Interactions
UI -->|Lego Set Name| UrlGen
UrlGen -->|AI Discovery| Gemini

%% Scrape Phase
UrlGen -->|Return 15 URLs| UI
UI -->|Trigger Parallel Scrape| Search

Search -->|Deploy 15 Agents| Mino
Mino --.->|SSE Streams| UI
Mino --.->|Product JSON| Search

%% Final Analysis
Search -->|Analyze All Deals| Gemini
Gemini -->|Best Retailer Recommendation| Search
Search --.->|Final Best Deal Event| UI
```

```mermaid
sequenceDiagram
participant U as User
participant S as API (/api/search-lego)
participant G as Gemini (AI)
participant M as Mino (15 Parallel Agents)

U->>G: Discover Retailers for "Millennium Falcon"
G-->>U: List of 15 Shop URLs

U->>S: POST Search (Set Name + 15 URLs)

par Retailer 1 to 15 (Amazon, Walmart, Lego.com, etc.)
S->>M: Scrape Retailer (Goal: Find Stock/Price)
M-->>U: SSE: Progress Step
M-->>S: JSON Result (inStock, price, shipping)
end

S->>G: Analyze All Results
G-->>S: Best Deal Recommendation
S->>U: Final Trophy Notification (Confetti Trigger)
```


22 changes: 22 additions & 0 deletions lego-hunter/app/api/generate-urls/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { generateRetailerUrls } from '@/lib/gemini-client'
import type { GenerateUrlsRequest } from '@/types'

export async function POST(request: Request) {
try {
const body: GenerateUrlsRequest = await request.json()

if (!body.legoSetName) {
return Response.json({ error: 'legoSetName is required' }, { status: 400 })
}

const retailers = await generateRetailerUrls(body.legoSetName)

return Response.json({ retailers })
} catch (error) {
console.error('Error generating URLs:', error)
return Response.json(
{ error: 'Failed to generate retailer URLs' },
{ status: 500 }
)
}
}
Loading