{ "name": "Rebuild a whole website as code (Tailwind, React, HTML, Vue, Elementor or Shopify) with MiroMiro", "nodes": [ { "parameters": { "content": "## Rebuild a whole website as code (Tailwind, React, HTML, Vue, Elementor or Shopify) with MiroMiro\n\n### How it works\nGive it a website. **List Every Page of the Site** reads the site's sitemap and lists every page, grouped by template (blog posts, products, docs...). This step is free. **Pick the Pages** keeps the pages worth rebuilding: every unique page plus one example of each template, so a 500-page blog costs one post, not 500. **Extract Each Page as Code** then rebuilds each page in a real browser, every section from header to footer, with its real colors, fonts, spacing, breakpoints and hover styles. **Finish Unfinished Pages** completes any long page that ran out of time, for free. You get a zip with one folder per page and one file per section, plus a link to each whole page assembled, with a Download HTML button.\n\n### Setup\nThis template uses the verified community node **n8n-nodes-miromiro** for its credential (any version).\n1. On n8n Cloud, search \"MiroMiro\" in the nodes panel (an admin may need to turn on Verified Community Nodes). Self-hosted: Settings > Community nodes > Install `n8n-nodes-miromiro`.\n2. Get a MiroMiro API key: https://miromiro.app/api/onboarding. Listing the pages works on every plan; extracting whole pages needs a paid plan (Developer and up), because a site is many pages, each loaded in a real browser.\n3. Open **List Every Page of the Site** > Credential for MiroMiro API > Create new, and paste the key. Select the same credential in the two extract nodes.\n4. Set `website`, `output` and `maxPages` in **Set Website and Output** and click **Execute workflow**.\n5. Download the zip from **Zip the Code Files**. **Get Page Preview Links** lists each page with its whole-page link.\n\n### Cost\nListing the pages: free. Each page: 30 credits, whatever its number of sections. Pages already extracted in the last 24 hours, unfinished pages and failed pages are free.\n\n### Customization\n- `output`: tailwind, jsx (React), html, vue, elementor (WordPress templates, .json) or shopify (theme sections, .liquid).\n- `maxPages`: how many pages to rebuild (10 by default).\n- `pages`: your own list of page addresses, one per line. When set, it replaces the automatic pick.\n- Swap **Zip the Code Files** for Google Drive, Dropbox, GitHub or an email to deliver the files.\n\nThe text and images belong to the site you extract from. Replace them with your own unless it is your site or your client's.", "width": 640, "height": 900 }, "id": "a0000000-0000-4000-8000-000000000001", "name": "Sticky Note", "type": "n8n-nodes-base.stickyNote", "typeVersion": 1, "position": [ -760, -260 ] }, { "parameters": {}, "id": "a0000000-0000-4000-8000-000000000002", "name": "Run Manually", "type": "n8n-nodes-base.manualTrigger", "typeVersion": 1, "position": [ 0, 200 ] }, { "parameters": { "assignments": { "assignments": [ { "id": "s0", "name": "website", "value": "https://linear.app", "type": "string" }, { "id": "s1", "name": "output", "value": "tailwind", "type": "string" }, { "id": "s2", "name": "maxPages", "value": 10, "type": "number" }, { "id": "s3", "name": "pages", "value": "", "type": "string" } ] }, "options": {} }, "id": "a0000000-0000-4000-8000-000000000003", "name": "Set Website and Output", "type": "n8n-nodes-base.set", "typeVersion": 3.4, "position": [ 220, 200 ] }, { "parameters": { "url": "https://miromiro.app/api/v1/site/pages", "authentication": "predefinedCredentialType", "nodeCredentialType": "miroMiroApi", "sendQuery": true, "queryParameters": { "parameters": [ { "name": "url", "value": "={{ $json.website }}" } ] }, "options": { "timeout": 120000 } }, "id": "a0000000-0000-4000-8000-000000000004", "name": "List Every Page of the Site", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [ 500, 200 ] }, { "parameters": { "jsCode": "// The page list is free. Keep the pages worth rebuilding: every unique page\n// plus one example of each template (blog post, product, doc...), or the\n// pages you listed yourself in Set Website and Output.\nconst scan = $input.first().json\nconst settings = $('Set Website and Output').first().json\nif (scan.premium) {\n throw new Error(scan.premium.reason + ' Plans: ' + scan.premium.upgradeUrl)\n}\nconst max = Math.max(1, Number(settings.maxPages) || 10)\nconst own = String(settings.pages || '').split(/[\\s,]+/).filter(u => /^https?:\\/\\//.test(u))\nconst urls = own.length ? own : (scan.suggested || []).map(p => typeof p === 'string' ? p : p.url)\nif (!urls.length) throw new Error('No pages found on ' + settings.website + '. Put the addresses in \"pages\" in Set Website and Output.')\nreturn [...new Set(urls)].slice(0, max).map(url => ({ json: { url, output: settings.output }, pairedItem: { item: 0 } }))" }, "id": "a0000000-0000-4000-8000-000000000005", "name": "Pick the Pages", "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [ 720, 200 ] }, { "parameters": { "url": "https://miromiro.app/api/v1/site/page", "authentication": "predefinedCredentialType", "nodeCredentialType": "miroMiroApi", "sendQuery": true, "queryParameters": { "parameters": [ { "name": "url", "value": "={{ $json.url }}" }, { "name": "framework", "value": "={{ $json.output || $json.framework }}" } ] }, "options": { "timeout": 120000, "batching": { "batch": { "batchSize": 2, "batchInterval": 0 } } } }, "id": "a0000000-0000-4000-8000-000000000006", "name": "Extract Each Page as Code", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [ 1000, 200 ], "onError": "continueRegularOutput" }, { "parameters": { "url": "https://miromiro.app/api/v1/site/page", "authentication": "predefinedCredentialType", "nodeCredentialType": "miroMiroApi", "sendQuery": true, "queryParameters": { "parameters": [ { "name": "url", "value": "={{ $json.url }}" }, { "name": "framework", "value": "={{ $json.output || $json.framework }}" } ] }, "options": { "timeout": 120000, "batching": { "batch": { "batchSize": 2, "batchInterval": 0 } } } }, "id": "a0000000-0000-4000-8000-000000000007", "name": "Finish Unfinished Pages", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [ 1220, 200 ], "onError": "continueRegularOutput" }, { "parameters": { "jsCode": "// One folder per page, one file per section, in page order.\nconst output = $('Set Website and Output').first().json.output\nconst ext = { tailwind: 'html', html: 'html', jsx: 'jsx', vue: 'vue', elementor: 'json', shopify: 'liquid' }[output] || 'txt'\nconst slug = s => String(s || '').toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '').slice(0, 40)\nconst picked = $('Pick the Pages').all().map(i => i.json.url)\nconst firstRun = $('Extract Each Page as Code').all().map(i => i.json)\nconst binary = {}\nconst pages = []\nconst failed = []\nlet n = 0\n$input.all().forEach((item, i) => {\n const r = item.json\n const url = r.url || picked[i]\n if (!r.sections || !r.sections.length) {\n // A page that failed in the first call keeps that call's error.\n const first = (firstRun[i] || {}).error\n const e = first || r.error\n failed.push({ url, error: (e && (e.message || e)) || 'No sections returned' })\n return\n }\n const path = String(url).split('/').slice(3).join('/').split(/[?#]/)[0]\n const folder = slug(path) || 'home'\n r.sections.forEach((s, j) => {\n const name = String(j + 1).padStart(2, '0') + '-' + (slug(String(s.label || '').split(/\\s+/).slice(0, 4).join(' ')) || 'section')\n const text = s.css && ext === 'html' ? '\\n' + s.code : s.code\n binary['file_' + (n++)] = { data: Buffer.from(String(text)).toString('base64'), mimeType: 'text/plain', fileName: folder + '/' + name + '.' + ext, fileExtension: ext }\n })\n pages.push({ url, folder, sections: r.sections.length, complete: r.complete !== false, pagePreviewUrl: r.pagePreviewUrl })\n})\nif (!n) throw new Error('No page could be extracted: ' + JSON.stringify(failed))\nreturn [{ json: { pages, failed, files: n }, binary, pairedItem: { item: 0 } }]" }, "id": "a0000000-0000-4000-8000-000000000008", "name": "Save Each Page as Files", "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [ 1500, 200 ] }, { "parameters": { "operation": "compress", "binaryPropertyName": "={{ Object.keys($binary).join(\",\") }}", "outputFormat": "zip", "fileName": "={{ String($('Set Website and Output').first().json.website).split('/')[2].replace(/^www\\./, '') }}-site-code.zip", "binaryPropertyOutput": "data" }, "id": "a0000000-0000-4000-8000-000000000009", "name": "Zip the Code Files", "type": "n8n-nodes-base.compression", "typeVersion": 1.1, "position": [ 1720, 200 ] }, { "parameters": { "jsCode": "// Each page with its whole-page link (every section assembled, with a Download HTML button).\nconst saved = $('Save Each Page as Files').first().json\nreturn saved.pages.map(p => ({ json: p, pairedItem: { item: 0 } }))\n .concat(saved.failed.map(f => ({ json: { url: f.url, failed: true, error: f.error }, pairedItem: { item: 0 } })))" }, "id": "a0000000-0000-4000-8000-00000000000a", "name": "Get Page Preview Links", "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [ 1940, 200 ] }, { "parameters": { "content": "## Choose the site\n\nPut the website, the `output` and `maxPages` in **Set Website and Output**. To pick the pages yourself, list them in `pages`.", "width": 460, "height": 380, "color": 7 }, "id": "a0000000-0000-4000-8000-00000000000b", "name": "Sticky Note1", "type": "n8n-nodes-base.stickyNote", "typeVersion": 1, "position": [ -40, -20 ] }, { "parameters": { "content": "## List and pick the pages (free)\n\nThe sitemap gives every page, grouped by template. Unique pages plus one of each template are kept, up to `maxPages`.", "width": 460, "height": 380, "color": 7 }, "id": "a0000000-0000-4000-8000-00000000000c", "name": "Sticky Note2", "type": "n8n-nodes-base.stickyNote", "typeVersion": 1, "position": [ 450, -20 ] }, { "parameters": { "content": "## Rebuild each page\n\nEvery section of each page, 30 credits a page. A long page that runs out of time is finished by the second node for free. A failed page is skipped and listed.", "width": 460, "height": 380, "color": 7 }, "id": "a0000000-0000-4000-8000-00000000000d", "name": "Sticky Note3", "type": "n8n-nodes-base.stickyNote", "typeVersion": 1, "position": [ 940, -20 ] }, { "parameters": { "content": "## Zip and link\n\nOne folder per page, one file per section. The last node lists each page with its whole-page preview link.", "width": 680, "height": 380, "color": 7 }, "id": "a0000000-0000-4000-8000-00000000000e", "name": "Sticky Note4", "type": "n8n-nodes-base.stickyNote", "typeVersion": 1, "position": [ 1440, -20 ] } ], "connections": { "Run Manually": { "main": [ [ { "node": "Set Website and Output", "type": "main", "index": 0 } ] ] }, "Set Website and Output": { "main": [ [ { "node": "List Every Page of the Site", "type": "main", "index": 0 } ] ] }, "List Every Page of the Site": { "main": [ [ { "node": "Pick the Pages", "type": "main", "index": 0 } ] ] }, "Pick the Pages": { "main": [ [ { "node": "Extract Each Page as Code", "type": "main", "index": 0 } ] ] }, "Extract Each Page as Code": { "main": [ [ { "node": "Finish Unfinished Pages", "type": "main", "index": 0 } ] ] }, "Finish Unfinished Pages": { "main": [ [ { "node": "Save Each Page as Files", "type": "main", "index": 0 } ] ] }, "Save Each Page as Files": { "main": [ [ { "node": "Zip the Code Files", "type": "main", "index": 0 } ] ] }, "Zip the Code Files": { "main": [ [ { "node": "Get Page Preview Links", "type": "main", "index": 0 } ] ] } }, "pinData": {}, "settings": { "executionOrder": "v1" }, "tags": [] }