IKEA assembly, step by step: animated, manual-style 3D guides. Scan any paper manual with Together AI.
TypeScript
Docs match the code; drop starter assets
Youssefbe68a8639953
diff --git a/.env.example b/.env.exampleindex 77b1041..d663400 100644--- a/.env.example+++ b/.env.example@@ -1,6 +1,7 @@# Together AI key: unlocks any product name, photo lookup, live help, and the# hands-free voice on lines that have no pre-recorded clip (scanned manuals,-# spoken help answers). Without it those lines use the device's own voice.+# spoken help answers). Without it those lines are skipped (they stay on+# screen): the device's own voice is never used.# Scanning a manual (/scan) always uses the visitor's own key instead.# Re-record the voice clips with `npm run voice`. Get a key at https://api.together.aiTOGETHER_API_KEY=@@ -9,7 +10,13 @@ TOGETHER_API_KEY=# NEXT_PUBLIC_GITHUB_REPO=Luffixos/bygga# Optional: comma separated model lists, tried in order.-# TOGETHER_TEXT_MODEL=openai/gpt-oss-120b,zai-org/GLM-5.3-Flash-# TOGETHER_VISION_MODEL=nvidia/NVIDIA-Nemotron-3.5-Super-VL,MiniMaxAI/MiniMax-M3-# TOGETHER_READ_MODEL=MiniMaxAI/MiniMax-M3,nvidia/NVIDIA-Nemotron-3.5-Super-VL-# TOGETHER_PLAN_MODEL=openai/gpt-oss-120b,zai-org/GLM-5.3-Flash+# TOGETHER_TEXT_MODEL=openai/gpt-oss-120b,zai-org/GLM-5.3-Flash,Qwen/Qwen3.8-Flash+# TOGETHER_VISION_MODEL=nvidia/NVIDIA-Nemotron-3.5-Super-VL,MiniMaxAI/MiniMax-M3,Qwen/Qwen3.5-9B+# TOGETHER_READ_MODEL=MiniMaxAI/MiniMax-M3,nvidia/NVIDIA-Nemotron-3.5-Super-VL,Qwen/Qwen3.5-9B+# TOGETHER_PLAN_MODEL=openai/gpt-oss-120b,zai-org/GLM-5.3-Flash,Qwen/Qwen3.7-Plus++# Optional: the public URL, used for share cards, the sitemap and canonical links.+# NEXT_PUBLIC_SITE_URL=https://bygga-eta.vercel.app++# Optional: bring back the manual scanner at /scan (parked for v2).+# NEXT_PUBLIC_SCAN=1diff --git a/AGENTS.md b/AGENTS.mdindex af3b7c8..0319cfd 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -1,9 +1,10 @@-<!-- BEGIN:nextjs-agent-rules -->+## This is Next.js 16-## This is NOT the Next.js you know+This version has breaking changes: APIs, conventions and file structure may differ from your training data. Read the relevant guide in `node_modules/next/dist/docs/` before writing any code, and heed deprecation notices. (`agentRules: false` in `next.config.ts` keeps `next dev` from rewriting this file.)-This version has breaking changes — APIs, conventions, and file structure may all differ from your training data. Read the relevant guide in `node_modules/next/dist/docs/` (resolved from this file's directory; in monorepos the `next` package may not be visible from the repo root) before writing any code. Heed deprecation notices.+## House rules-This block is written and re-added by `next dev` — verify at `node_modules/next/dist/server/lib/generate-agent-files.js`. Removing it from a diff only re-creates the uncommitted change; committing it with your work keeps the tree clean.--<!-- END:nextjs-agent-rules -->+- No em dashes or en dashes anywhere: copy, code, comments, commit messages. Use a comma, colon or parentheses.+- One voice only: Kokoro `af_heart` on Together AI, for recorded clips and live lines alike (`src/lib/voice/tts.ts`). Never fall back to the device's speech.+- IKEA's raw listings (`scripts/ikea/facts*.json`, `scripts/ikea/cache/`) stay out of git; only the rows built from them in `src/data` ship.+- Every guide is generated by `src/lib/plan`; never copy IKEA's manuals or images.diff --git a/README.md b/README.mdindex 6b0b81e..5c0f61a 100644--- a/README.md+++ b/README.md@@ -8,10 +8,10 @@## Tech stack-- Next.js 16 (App Router, Cache Components) with React 19 and TypeScript, plain CSS, no UI kit+- Next.js 16 (App Router, Cache Components) with React 19 and TypeScript, plain CSS with Motion and Lucide icons, no UI kit- three.js line-art stage (`src/engine`): ink outlines, fly-in parts, a zoomed callout per fitting, offscreen thumbnails- A parametric plan generator (`src/lib/plan`) for 7 furniture types and 62 kinds: 973 IKEA products (1,696 sizes) drawn offline, with typo-tolerant search and article numbers-- IKEA's public product facts (`scripts/ikea`): name, type, size and article numbers only, mapped to kinds by `classify.ts`, checked by `npm run ikea:check`; every IKEA family name is known, so MARKUS reads as an office chair and never as a typo of MARIUS+- IKEA's public product listings (`scripts/ikea`): `npm run ikea:fetch` downloads them locally (they are git ignored, see NOTICE), `classify.ts` maps name, type and size to kinds, `npm run ikea:build` writes the catalog rows in `src/data`, and `npm run ikea:check` tests them; every IKEA family name is known, so MARKUS reads as an office chair and never as a typo of MARIUS- Manual scanner (`/scan`, parked for v2 and off unless `NEXT_PUBLIC_SCAN=1`): a vision model reads each page, `gpt-oss-120b` lays out the parts in millimetres, and `src/lib/plan/custom.ts` places every dowel, bolt and screw where parts touch- Together AI for unknown product names (steered by IKEA's own type, cached for good with `use cache: remote`), photo lookup and the "Stuck?" helper, with model fallback lists in `src/lib/together.ts`- A hands-free voice on Together AI (Kokoro, `src/lib/voice/tts.ts`): every catalog line is pre-recorded with `npm run voice` (1,283 clips cover all 1,696 guides), the rest are recorded live, product names keep phonetic spellings where they help (`npm run voice:names`), and saying "next" turns the page@@ -25,20 +25,22 @@3. Run: `npm run dev`, open http://localhost:3000 and type `BISSA`4. Jump to a step: http://localhost:3000/build/malm-3-drawers?step=12, print one at `/build/malm-3-drawers/print`, or see finished builds at `/builds`5. Try the scanner free: run with `NEXT_PUBLIC_SCAN=1`, then on `/scan` paste `bygga-dev-mock-key-000000` as the key and add any photo (only `npm run dev` accepts it)-6. Before pushing: `npm run lint && npm run build`+6. Rebuild the catalog from IKEA's listings (only needed when they change): `npm run ikea:fetch && npm run ikea:build && npm run ikea:check`+7. Before pushing: `npm run lint && npm run build`## Roadmap- [x] let people flag a step that doesn't match their box (logged as `[feedback]`)- [x] a print view: the whole guide on A4- [x] cache AI product reads on the server so the second person to ask gets them instantly-- [ ] teach the generator corner sofas, sliding doors, office chairs and kitchen units with drawers (the biggest groups `ikea:check` still skips)+- [x] teach the generator corner sofas, sliding doors, office chairs, day-beds, kitchen and bathroom cabinets+- [ ] the last odd shapes `scripts/ikea/skips.ts` lists: three-cornered shelves, corner combinations and PAX widths that don't split into frames- [ ] the voice in more languages- [ ] test the scanner on a stack of real manuals and bring it back in v2-- Real IKEA PDFs are not scraped or mirrored on purpose: every guide is generated, and the cover links to the official manual.+- Real IKEA PDFs are not scraped or mirrored on purpose: every guide is generated, and the cover links to the product on ikea.com, where the official manual is.## Security-The server's Together key never reaches the browser, and every `/api/*` route is rate limited per IP. A visitor's own key (needed for `/scan`) stays in their `localStorage`, travels only in an `x-together-key` header, and is never stored or logged. Scanned guides and build progress live in the browser too, and a shared scan carries the guide inside its link.+The server's Together key never reaches the browser, every `/api/*` route that spends it answers only the site's own pages and is rate limited per IP, and the pages send a strict Content Security Policy. A visitor's own key (needed for `/scan`) stays in their `localStorage`, travels only in an `x-together-key` header, and is never stored or logged. Scanned guides and build progress live in the browser too, and a shared scan carries the guide inside its link. What the site keeps and sends where is spelled out on [/privacy](https://bygga-eta.vercel.app/privacy).-Not affiliated with IKEA, product names are trademarks of Inter IKEA Systems B.V. No license chosen yet, so all rights reserved.+MIT licensed, see [LICENSE](LICENSE). Bygga is not affiliated with IKEA: IKEA and its product names are trademarks of Inter IKEA Systems B.V., and the license grants no rights in them (see [NOTICE](NOTICE)).diff --git a/eslint.config.mjs b/eslint.config.mjsindex 05e726d..c7ff2a1 100644--- a/eslint.config.mjs+++ b/eslint.config.mjs@@ -12,6 +12,8 @@ const eslintConfig = defineConfig(["out/**","build/**","next-env.d.ts",+ // agent worktrees and local tool state+ ".claude/**",]),]);diff --git a/next.config.ts b/next.config.tsindex 494ac7f..d241d5a 100644--- a/next.config.ts+++ b/next.config.ts@@ -30,6 +30,8 @@ const SECURITY = [];const nextConfig: NextConfig = {+ // AGENTS.md is ours (it keeps the same advice, without the dashes the managed block brings)+ agentRules: false,cacheComponents: true,partialPrefetching: true,// the share cards read their fonts and drawings from diskdiff --git a/scripts/og/render.mjs b/scripts/og/render.mjsindex 30c84da..3199eff 100644--- a/scripts/og/render.mjs+++ b/scripts/og/render.mjs@@ -4,7 +4,7 @@* npm run dev, then: node scripts/og/render.mjs [--base http://localhost:3000] [--only kallax-2x2] [--missing]** Needs Playwright from any project that has it: PLAYWRIGHT_FROM=/path/to/project.- * Writes public/og/{slug}.png for the hand-picked catalog and public/og/kind-{kind}.png+ * Writes public/og/{slug}.png for every catalog product and public/og/kind-{kind}.png* for every furniture kind (the fallback for everything else).*/import { createRequire } from "node:module";diff --git a/src/lib/ikea.ts b/src/lib/ikea.tsindex 364422d..36b5b6c 100644--- a/src/lib/ikea.ts+++ b/src/lib/ikea.ts@@ -68,7 +68,7 @@ export function decodeRows(text: string): IkeaRow[] {const guard = new Set(IKEA_GUARD.split(" "));-/** A real IKEA name we can't draw, which search must not read as a typo of one we can (MARKUS is not MARIUS). */+/** A real IKEA name we can't draw, which search must not read as a typo of one we can (FRÖSÖN is not FRÖSET). */export function isGuardedName(word: string) {return guard.has(fold(word).replace(/\s+/g, ""));}