-
Notifications
You must be signed in to change notification settings - Fork 106
Add job-hunting - Mino Use Case #15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
pranavjana
wants to merge
1
commit into
tinyfish-io:main
Choose a base branch
from
pranavjana:pranav/job-hunting
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,144 @@ | ||
| # Job Hunter - AI-Powered Job Search Automation | ||
|
|
||
| ## Demo | ||
|
|
||
|  | ||
|
|
||
| **Live Demo:** https://job-huntboard.vercel.app | ||
|
|
||
| Job Hunter is a comprehensive platform that automates the job search process using Mino's browser automation API and OpenRouter's AI models. It handles everything from resume parsing and optimized job board search generation to parallel scraping and intelligent job matching. | ||
|
|
||
| --- | ||
|
|
||
| --- | ||
|
|
||
| ## Demo | ||
|
|
||
| *[Demo video/screenshot to be added]* | ||
|
|
||
| --- | ||
|
|
||
| ## 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://sg.indeed.com/jobs?q=frontend+developer", | ||
| "goal": "I am looking for: frontend developer. Extract ONLY the 6-7 most relevant job listings...", | ||
| "browser_profile": "stealth" | ||
| }' | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## 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 https://github.com/tinyfish-io/TinyFish-cookbook | ||
| cd TinyFish-cookbook/job-hunting | ||
| ``` | ||
|
|
||
| 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 - React/Tailwind] | ||
| State[State Management - Custom Hooks] | ||
| LS[(Local Storage)] | ||
| end | ||
|
|
||
| subgraph Backend [Next.js API Routes] | ||
| Parse[/api/ai/parse-resume] | ||
| GenURLs[/api/ai/generate-urls] | ||
| Scrape[/api/scrape] | ||
| Match[/api/ai/match-jobs] | ||
| Letter[/api/ai/cover-letter] | ||
| end | ||
|
|
||
| subgraph External_APIs [External Services] | ||
| Mino[Mino API - Browser Automation] | ||
| OpenRouter[OpenRouter AI - Minimax M2.1] | ||
| end | ||
|
|
||
| %% User Interactions | ||
| UI -->|Resume Text| State | ||
| UI -->|Search Criteria| State | ||
|
|
||
| %% Internal Orchestration | ||
| State <-->|Read/Write Profile & Jobs| LS | ||
| State -->|Trigger| Parse | ||
| State -->|Trigger| GenURLs | ||
| State -->|Trigger Parallel| Scrape | ||
| State -->|Trigger| Match | ||
| State -->|Trigger| Letter | ||
|
|
||
| %% External Service Calls | ||
| Parse -->|Extract JSON| OpenRouter | ||
| GenURLs -->|Generate Search URLs| OpenRouter | ||
| Match -->|Analyze Fit| OpenRouter | ||
| Letter -->|Personalize Content| OpenRouter | ||
|
|
||
| Scrape -->|Orchestrate Agents| Mino | ||
| Mino --.->|SSE Stream: Progress + Live Preview| UI | ||
| Mino --.->|JSON Result| Scrape | ||
| Scrape -->|Job Objects| State | ||
| ``` | ||
|
|
||
| ```mermaid | ||
| sequenceDiagram | ||
| participant U as User | ||
| participant D as Dashboard | ||
| participant S as API Route (/api/scrape) | ||
| participant M as Mino (Stealth Browser) | ||
|
|
||
| U->>D: Click "Find Jobs" | ||
| D->>D: Load Search URLs from State | ||
|
|
||
| par For Each Job Board (LinkedIn, Indeed, etc.) | ||
| D->>S: POST /api/scrape (Board URL) | ||
| S->>M: POST /v1/automation/run-sse (Goal + Stealth) | ||
| M-->>D: Event: streamingUrl (Live Preview) | ||
| M-->>D: Event: STEP (Navigating/Scanning) | ||
| M-->>D: Event: COMPLETE (JSON Result) | ||
| D->>D: Parse & Deduplicate Jobs | ||
| end | ||
|
|
||
| D->>U: Update Feed with New Listings | ||
| ``` | ||
|
|
||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| import { NextRequest, NextResponse } from "next/server"; | ||
| import { createOpenAICompatible } from "@ai-sdk/openai-compatible"; | ||
| import { generateText } from "ai"; | ||
|
|
||
| export async function POST(request: NextRequest) { | ||
| try { | ||
| const { job, profile } = await request.json(); | ||
|
|
||
| if (!job || !profile) { | ||
| return NextResponse.json( | ||
| { error: "Job and profile are required" }, | ||
| { status: 400 } | ||
| ); | ||
| } | ||
|
|
||
| const apiKey = process.env.OPENROUTER_API_KEY; | ||
| if (!apiKey) { | ||
| return NextResponse.json( | ||
| { error: "OpenRouter API key not configured" }, | ||
| { status: 500 } | ||
| ); | ||
| } | ||
|
|
||
| const openrouter = createOpenAICompatible({ | ||
| name: "openrouter", | ||
| baseURL: "https://openrouter.ai/api/v1", | ||
| headers: { | ||
| Authorization: `Bearer ${apiKey}`, | ||
| "HTTP-Referer": "https://jobhunter.app", | ||
| "X-Title": "Job Hunter Dashboard", | ||
| }, | ||
| }); | ||
|
|
||
| const model = openrouter.chatModel("minimax/minimax-m2.1"); | ||
|
|
||
| const { text } = await generateText({ | ||
| model, | ||
| system: `You are an expert cover letter writer who creates compelling, personalized letters. | ||
| Write naturally and professionally, avoiding generic phrases. | ||
| Be specific about why this candidate is a great fit for this role. | ||
| Never use placeholder text - use actual company and candidate names.`, | ||
| prompt: `Write a compelling cover letter for this job application: | ||
|
|
||
| JOB DETAILS: | ||
| - Company: ${job.company} | ||
| - Title: ${job.title} | ||
| - Location: ${job.location} | ||
| - Description: ${job.description} | ||
| ${job.requirements ? `- Requirements: ${job.requirements.join(", ")}` : ""} | ||
|
|
||
| CANDIDATE PROFILE: | ||
| - Name: ${profile.fullName} | ||
| - Current title: ${profile.currentTitle} | ||
| - Years of experience: ${profile.yearsExperience} | ||
| - Key skills: ${profile.skills?.slice(0, 8).join(", ") || ""} | ||
| - Summary: ${profile.summary} | ||
|
|
||
| Write a 3-4 paragraph cover letter that: | ||
| - Opens with a strong hook relevant to the company/role | ||
| - Highlights 2-3 specific qualifications that match the job requirements | ||
| - Shows enthusiasm for the company and role | ||
| - Ends with a clear call to action`, | ||
| }); | ||
|
|
||
| return NextResponse.json({ data: text }); | ||
| } catch (error) { | ||
| return NextResponse.json( | ||
| { error: "Failed to generate cover letter" }, | ||
| { status: 500 } | ||
| ); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,119 @@ | ||
| import { NextRequest, NextResponse } from "next/server"; | ||
| import { createOpenAICompatible } from "@ai-sdk/openai-compatible"; | ||
| import { generateText } from "ai"; | ||
| import { z } from "zod"; | ||
|
|
||
| const searchUrlsSchema = z.object({ | ||
| urls: z.array( | ||
| z.object({ | ||
| boardName: z.string(), | ||
| searchUrl: z.string(), | ||
| }) | ||
| ), | ||
| }); | ||
|
|
||
| function extractJSON(text: string): string { | ||
| // Remove markdown code blocks if present | ||
| const codeBlockMatch = text.match(/```(?:json)?\s*([\s\S]*?)```/); | ||
| if (codeBlockMatch) { | ||
| return codeBlockMatch[1].trim(); | ||
| } | ||
| // Try to find JSON object directly | ||
| const jsonMatch = text.match(/\{[\s\S]*\}/); | ||
| if (jsonMatch) { | ||
| return jsonMatch[0]; | ||
| } | ||
| return text; | ||
| } | ||
|
|
||
| export async function POST(request: NextRequest) { | ||
| try { | ||
| const { profile, searchConfig } = await request.json(); | ||
|
|
||
| if (!profile) { | ||
| return NextResponse.json( | ||
| { error: "Profile is required" }, | ||
| { status: 400 } | ||
| ); | ||
| } | ||
|
|
||
| const apiKey = process.env.OPENROUTER_API_KEY; | ||
| if (!apiKey) { | ||
| return NextResponse.json( | ||
| { error: "OpenRouter API key not configured" }, | ||
| { status: 500 } | ||
| ); | ||
| } | ||
|
|
||
| const openrouter = createOpenAICompatible({ | ||
| name: "openrouter", | ||
| baseURL: "https://openrouter.ai/api/v1", | ||
| headers: { | ||
| Authorization: `Bearer ${apiKey}`, | ||
| "HTTP-Referer": "https://jobhunter.app", | ||
| "X-Title": "Job Hunter Dashboard", | ||
| }, | ||
| }); | ||
|
|
||
| const model = openrouter.chatModel("minimax/minimax-m2.1"); | ||
|
|
||
| const locationStr = | ||
| searchConfig?.locations?.length > 0 | ||
| ? searchConfig.locations.join(", ") | ||
| : profile.location; | ||
|
|
||
| const remoteNote = | ||
| searchConfig?.remotePreference === "remote-only" | ||
| ? "Focus on remote positions only." | ||
| : searchConfig?.remotePreference === "hybrid-ok" | ||
| ? "Include remote and hybrid positions." | ||
| : ""; | ||
|
|
||
| const jobSearchPrompt = searchConfig?.jobSearchPrompt || ""; | ||
|
|
||
| const { text } = await generateText({ | ||
| model, | ||
| system: `You are an expert at finding jobs on the internet. You know all the best job boards for different regions, industries, and job types. You create working search URLs with proper parameters. Always respond with valid JSON only.`, | ||
| prompt: `Generate the BEST job board search URLs for this job search: | ||
|
|
||
| === JOB SEARCH REQUEST === | ||
| ${jobSearchPrompt || `Looking for ${profile.preferredTitles?.join(" or ") || profile.currentTitle} positions`} | ||
|
|
||
| === LOCATION === | ||
| ${locationStr} | ||
|
|
||
| === CONTEXT === | ||
| - Experience level: ${profile.seniorityLevel} | ||
| ${remoteNote ? `- Remote preference: ${remoteNote}` : ""} | ||
| ${searchConfig?.salaryMinimum ? `- Minimum salary: $${searchConfig.salaryMinimum}` : ""} | ||
|
|
||
| === INSTRUCTIONS === | ||
| 1. Choose the BEST 10-15 job boards for this search based on the LOCATION and JOB TYPE | ||
| 2. For each region, include LOCAL job boards (e.g., for Singapore: JobsCentral, JobStreet, TechInAsia; for UK: Reed, TotalJobs; for India: Naukri, etc.) | ||
| 3. Include global boards like LinkedIn, Indeed (use regional domains like indeed.sg, indeed.co.uk, etc.) | ||
| 4. Include industry-specific boards if relevant (tech: AngelList, Dice, HackerNews; startups: Y Combinator, etc.) | ||
| 5. Create working search URLs with the job keywords and location pre-filled | ||
| 6. Use proper URL encoding (spaces become %20 or +) | ||
|
|
||
| Return ONLY a JSON object: | ||
| { | ||
| "urls": [ | ||
| { "boardName": "LinkedIn", "searchUrl": "https://www.linkedin.com/jobs/search/?keywords=..." }, | ||
| { "boardName": "Indeed Singapore", "searchUrl": "https://sg.indeed.com/jobs?q=..." }, | ||
| ... | ||
| ] | ||
| }`, | ||
| }); | ||
|
|
||
| const jsonStr = extractJSON(text); | ||
| const parsed = JSON.parse(jsonStr); | ||
| const validated = searchUrlsSchema.parse(parsed); | ||
|
|
||
| return NextResponse.json({ data: validated.urls }); | ||
| } catch (error) { | ||
| return NextResponse.json( | ||
| { error: "Failed to generate search URLs" }, | ||
| { status: 500 } | ||
| ); | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🌐 Web query:
minimax/minimax-m2.1 context length limit OpenRouter💡 Result:
On OpenRouter,
minimax/minimax-m2.1has a context length limit of 196,608 tokens (i.e., the maximum total tokens the model can handle in a single request/conversation window on OpenRouter). [1][2]For comparison, MiniMax’s own API docs list 204,800 tokens for MiniMax-M2.1, so OpenRouter’s routed offering appears slightly lower. [3]
Sources: OpenRouter model page / API quickstart [1][2], MiniMax docs [3].
🏁 Script executed:
Repository: tinyfish-io/TinyFish-cookbook
Length of output: 119
🏁 Script executed:
Repository: tinyfish-io/TinyFish-cookbook
Length of output: 100
🏁 Script executed:
Repository: tinyfish-io/TinyFish-cookbook
Length of output: 100
🏁 Script executed:
Repository: tinyfish-io/TinyFish-cookbook
Length of output: 2855
🏁 Script executed:
Repository: tinyfish-io/TinyFish-cookbook
Length of output: 5645
🏁 Script executed:
Repository: tinyfish-io/TinyFish-cookbook
Length of output: 545
Guard prompt inputs: validate job.requirements is an array and cap job description length.
The code assumes
job.requirementsis an array and calls.join()without type checking—this will throw if the field is a string or other non-array type from the external job API. Additionally, unbounded job descriptions from external sources can inflate token usage and model latency. Validate and bound both inputs before constructing the prompt.🔧 Proposed fix
🤖 Prompt for AI Agents