{"id":50490392,"url":"https://github.com/nuuxcode/iqg-v2","last_synced_at":"2026-06-02T02:06:05.106Z","repository":{"id":360310059,"uuid":"1249558826","full_name":"nuuxcode/iqg-v2","owner":"nuuxcode","description":"Mobile-first interview question generator. Next.js 16 + Gemini + Tailwind v4. Live: https://iqg-v2.vercel.app","archived":false,"fork":false,"pushed_at":"2026-05-25T23:09:22.000Z","size":303,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-05-25T23:14:06.697Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/nuuxcode.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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-25T20:38:53.000Z","updated_at":"2026-05-25T23:09:26.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/nuuxcode/iqg-v2","commit_stats":null,"previous_names":["nuuxcode/iqg-v2"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/nuuxcode/iqg-v2","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nuuxcode%2Fiqg-v2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nuuxcode%2Fiqg-v2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nuuxcode%2Fiqg-v2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nuuxcode%2Fiqg-v2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nuuxcode","download_url":"https://codeload.github.com/nuuxcode/iqg-v2/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nuuxcode%2Fiqg-v2/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33802185,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-02T02:00:07.132Z","response_time":109,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":"2026-06-02T02:06:04.268Z","updated_at":"2026-06-02T02:06:05.094Z","avatar_url":"https://github.com/nuuxcode.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Interview Question Generator (iqg-v2)\n\nA mobile-first web app: type a job title, pick question type and difficulty, get 3 thoughtful, role-specific interview questions from an LLM. Tap \"Give me 3 more\" to extend without repeats.\n\n**Live:** https://iqg-v2.vercel.app\n**Repo:** https://github.com/nuuxcode/iqg-v2\n\n---\n\n## Features\n\n### Core flow\n- **Job title input** with a 100-char cap and a 3-char minimum (real-time hint)\n- **Quick-pick chips** on the empty state — Customer Success Manager, Software Engineer, Product Manager — tap to populate the input\n- **Type selector** — Behavioral / Technical / Situational\n- **Difficulty selector** — Easy / Medium / Hard\n- **Last-used type and difficulty** persist across visits (localStorage)\n- **Loading state** inside the button itself — the button IS the spinner\n- **3 questions rendered as cards**, mobile-readable typography\n\n### Smart UX\n- **Generate button morphs** to \"Give me 3 more\" after first generation; resets when input changes\n- **\"Give me 3 more\"** sends previously-generated questions to the LLM as an exclude list — no repeats or paraphrases\n- **15-question cap per `role + type + difficulty` combo** — button disables with a hint to try a different combo\n- **Sticky scroll banner** appears at the top once the user scrolls past the form — tap role to scroll back, or tap \"↻ 3 more\" to regenerate without scrolling\n- **History drawer** — sliding sidebar with past sessions; tap to restore a past question set\n- **History merge logic** — clicking \"3 more\" updates the same history entry instead of duplicating it; changing role/type/difficulty starts a fresh entry\n\n### LLM strategy\n- **Two-stage cost pattern** — Gemini Flash Lite validates the input first (real job title or garbage?), then Gemini Flash generates the questions. Bad inputs get rejected without paying for the main call.\n- **Main model = Flash, deliberately not Pro** — interview-question generation doesn't need frontier reasoning. It needs role knowledge, consistent structure, and speed. Flash gives all three at ~10× lower cost and ~3× faster than Pro. The real quality lever in this product is the prompt + exclude list, not the model size.\n- **Backup model** — if the main fails, retries with Gemini Flash Lite. Same family, no second vendor, no second SDK.\n- **Model names via env var** — swap any model with a dashboard change, no code edit\n- **Skip re-validation on retry** — validated inputs are cached client-side; retries don't pay for a second validator call\n- **Temperature tuned per call** — `0` for the deterministic validator, `0.7` for the creative generator\n\n### Errors that guide instead of dead-end\n- **Invalid input** → friendly banner with **clickable example chips** that fill the input on tap (not a useless \"try again\")\n- **Rate-limit reached** → tells the user when they can come back\n- **LLM failed** → simple retry, no jargon\n- **Network error** → \"check your connection and retry\"\n- **Mid-failure recovery** — backup model attempt is invisible to the user\n\n### Safety \u0026 anti-abuse\n- **HMAC-signed daily rate limit** — HttpOnly cookie, 10 generations per browser per day. No third-party service required.\n- **Vercel $5 spend cap** — hard ceiling on cost if rate limiting fails or someone clears cookies to bypass\n- **Input sanitization** — length cap, newline stripping, rejection of obvious prompt-injection patterns\n- **Validator LLM** doubles as a second layer of injection defense\n- **Output filter library** for prompt-leak detection (built and tested; route integration deferred to v1.1 — see Tradeoffs)\n- **Zod schema** validates every API request body before any logic runs\n- **All secrets server-only** — no `NEXT_PUBLIC_` API keys\n\n### Mobile-first design\n- **Built for 375px-wide phones first**, then enhanced for tablet and desktop\n- **44px minimum tap targets** on every button per Apple HIG\n- **`min-h-dvh`** for the dynamic viewport (no layout jumps on iOS Safari URL bar)\n- **iOS tap-highlight disabled** for a native-app feel\n\n### No-DB architecture\n- **User identity** = client-generated UUID in localStorage (no auth, no fingerprint)\n- **History** = localStorage, capped at 50 entries\n- **Rate limit** = HMAC-signed cookie (no Redis, no Upstash)\n- **Email/feedback** = deferred to v2 (no Resend or SMTP in v1)\n\n---\n\n## How it works (architecture)\n\n```\n[Browser]\n   POST /api/generate {role, type, difficulty, exclude, validated}\n        |\n        v\n[Next.js API route]\n   1. Zod parse body                  -\u003e 400 on malformed\n   2. Verify HMAC cookie + increment  -\u003e 429 if over daily limit\n   3. Sanitize input                  -\u003e 400 on bad chars / length\n   4. Validator LLM (cheap)           -\u003e 200 with examples if invalid\n   5. Main LLM (Gemini Pro)\n        on failure: Backup LLM\n   6. Return {questions: [q1, q2, q3]}\n        |\n        v\n[Browser]\n   Render question cards\n   Save to localStorage history (merge if same combo as top entry)\n```\n\n---\n\n## Tech stack\n\n- **Next.js 16** App Router\n- **TypeScript** strict\n- **Tailwind v4** with `@theme` directive\n- **Vercel AI SDK v6** + `@ai-sdk/google`\n- **Zod** for request validation\n- **Vitest** for unit + integration tests\n- **Vercel** for hosting\n\n---\n\n## Local development\n\n```bash\npnpm install\ncp .env.example .env.local\n# Fill in GEMINI_API_KEY (https://aistudio.google.com/apikey)\n# Fill in RATELIMIT_SECRET (openssl rand -hex 32)\npnpm dev\n```\n\nOpen http://localhost:3000.\n\n---\n\n## Tests\n\n```bash\npnpm test           # unit + integration (mocked Gemini, deterministic, fast)\npnpm test:smoke     # 7 real-Gemini tests, ~$0.05 per run\npnpm typecheck      # tsc --noEmit\n```\n\n60+ tests covering the rate-limit cookie, sanitizer, output filter, prompt builders, LLM wrapper (mocked), API route integration, and React components.\n\n---\n\n## Environment variables\n\n| Name | Purpose | Required |\n|---|---|---|\n| `GEMINI_API_KEY` | Google AI Studio key | yes |\n| `GEMINI_MODEL_VALIDATOR` | cheap model for input validation | yes |\n| `GEMINI_MODEL_MAIN` | main model for question generation | yes |\n| `GEMINI_MODEL_BACKUP` | fallback if main fails | yes |\n| `RATELIMIT_SECRET` | 32-byte hex string for HMAC cookie | yes |\n| `DAILY_LIMIT` | requests per day per user (default 10) | no |\n\nCurrent values: validator `gemini-2.5-flash-lite` / main `gemini-2.5-flash` / backup `gemini-2.5-flash-lite`. Single-family stack for simplicity. Swap to `gemini-3.x` in the Vercel dashboard if you want preview-grade quality.\n\n---\n\n## Tradeoffs (what I'd add for production)\n\n- **Real rate limiting** via Upstash through the Vercel Marketplace — the current HMAC cookie is bypassable by clearing storage. The Vercel $5 spend cap is the hard wall today.\n- **Wire the output filter** (already built in `lib/output-filter.ts`, with tests) into the route — catches prompt-leak patterns in LLM output. One-line integration, deferred to v1.1.\n- **Real streaming UX** — `streamObject` from AI SDK v6 returns 0 bytes in production. The streaming UI primitives (`StreamingText`, `streaming` prop on cards) are in the codebase ready to reconnect when the API stabilizes.\n- **Feedback + Report buttons** with email delivery via Resend (deferred to v2).\n- **Sentry** for production error tracking.\n- **A/B testing** the main prompt to measure question quality per role.\n- **Cross-device history** via Neon Postgres once auth is added.\n\n---\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnuuxcode%2Fiqg-v2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnuuxcode%2Fiqg-v2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnuuxcode%2Fiqg-v2/lists"}