{"id":22891684,"url":"https://github.com/hanford/next-static-manifest","last_synced_at":"2026-03-11T16:02:03.171Z","repository":{"id":46289674,"uuid":"303600594","full_name":"hanford/next-static-manifest","owner":"hanford","description":"Create a static page manifest of your Next.js exported html pages, allowing you to route to dynamic HTML pages","archived":false,"fork":false,"pushed_at":"2023-01-10T18:31:16.000Z","size":398,"stargazers_count":13,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-27T12:33:44.466Z","etag":null,"topics":["html","nextjs","routing","static"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hanford.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-10-13T05:46:46.000Z","updated_at":"2024-04-25T09:01:21.000Z","dependencies_parsed_at":"2023-02-08T19:45:59.751Z","dependency_job_id":null,"html_url":"https://github.com/hanford/next-static-manifest","commit_stats":null,"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"purl":"pkg:github/hanford/next-static-manifest","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hanford%2Fnext-static-manifest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hanford%2Fnext-static-manifest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hanford%2Fnext-static-manifest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hanford%2Fnext-static-manifest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hanford","download_url":"https://codeload.github.com/hanford/next-static-manifest/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hanford%2Fnext-static-manifest/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30386976,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-11T14:10:17.325Z","status":"ssl_error","status_checked_at":"2026-03-11T14:09:37.934Z","response_time":84,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["html","nextjs","routing","static"],"created_at":"2024-12-13T22:35:31.735Z","updated_at":"2026-03-11T16:02:03.153Z","avatar_url":"https://github.com/hanford.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\n  next-static-manifest\n\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\nCreate a static page manifest of your \n\u003ca href=\"https://nextjs.org/docs/advanced-features/static-html-export\"\u003eNext.js exported html pages\u003c/a\u003e, allowing you to match incoming requests with dynamic Next.js HTML routes.\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://www.npmjs.com/package/next-static-manifest\"\u003e\n    \u003cimg src=\"https://img.shields.io/npm/dy/next-static-manifest.svg\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://www.npmjs.com/package/next-static-manifest\"\u003e\n    \u003cimg src=\"https://img.shields.io/npm/v/next-static-manifest.svg?maxAge=3600\u0026label=next-static-manifest\u0026colorB=007ec6\"\u003e\n  \u003c/a\u003e\n  \u003cimg src=\"https://img.shields.io/github/repo-size/hanford/next-static-manifest.svg\" /\u003e\n\u003c/p\u003e\n\n\u003cbr/\u003e\n\n## Installation\n\n```sh\n$ npm install --save next-static-manifest\n```\n\n```sh\n$ yarn add next-static-manifest\n```\n\n## Usage\n\nLet's take a look at this scenario, our application looks like this:\n\n```\n|-- pages\n|   |-- index.js\n|   |-- [...slug].js\n|   |-- blog/posts/[id].js\n|   |-- blog/posts/[id]/[authorId].js\n```\n\nWe add next-static-manifest to our export script:\n\n```sh\n$ next build \u0026\u0026 next export \u0026\u0026 next-static-manifest\n```\n\nAnd after exporting our app, we get this:\n\n```\n|-- out\n|   |-- next-static-manifest.json\n|   |-- index.html\n|   |-- [...slug].html\n|   |-- blog/posts/[id].html\n|   |-- blog/posts/[id]/[authorId].html\n```\n\nThe `next-static-manifest.json` will look this:\n\n```json\n[\n  {\n    \"src\": \"/blog/posts/[id]/[authorId]\",\n    \"dest\": \"/blog/posts/[id]/[authorId].html\",\n    \"regex\": \"__REGEXP__:/^\\\\/blog\\\\/posts\\\\/([^/]+?)\\\\/([^/]+?)(?:\\\\/)?$/\",\n    \"dynamic\": true\n  },\n  {\n    \"src\": \"/blog/posts/[id]\",\n    \"dest\": \"/blog/posts/[id].html\",\n    \"regex\": \"__REGEXP__:/^\\\\/blog\\\\/posts\\\\/([^/]+?)(?:\\\\/)?$/\",\n    \"dynamic\": true\n  },\n  {\n    \"src\": \"/index\",\n    \"dest\": \"/index.html\",\n    \"regex\": \"__REGEXP__:/^\\\\/index(?:\\\\/)?$/\",\n    \"dynamic\": false\n  },\n  {\n    \"src\": \"/404\",\n    \"dest\": \"/404.html\",\n    \"regex\": \"__REGEXP__:/^\\\\/404(?:\\\\/)?$/\",\n    \"dynamic\": false\n  },\n  {\n    \"dynamic\": false,\n    \"regex\": \"__REGEXP__:/^\\\\/(?:\\\\/)?$/\",\n    \"src\": \"/\",\n    \"dest\": \"index.html\"\n  },\n  {\n    \"src\": \"/[...slug]\",\n    \"dest\": \"/[...slug].html\",\n    \"regex\": \"__REGEXP__:/^\\\\/(.+?)(?:\\\\/)?$/\",\n    \"dynamic\": true\n  }\n]\n```\n\nWithout any type of infrastructure in place, we can't route users to our dynamically exported routes.\n\nA request to: `/blog/posts/123-456-789` wont match our filesystem location for the `/blog/posts/[id].html` file.\n\nHowever, if we write a small [Lambda@Edge](https://aws.amazon.com/lambda/edge/#:~:text=Lambda%40Edge%20is%20a%20feature,improves%20performance%20and%20reduces%20latency.\u0026text=With%20Lambda%40Edge%2C%20you%20can,all%20with%20zero%20server%20administration.) function or use a [Worker](https://workers.cloudflare.com/) to ingest this file, we can automatically route users to the correct `.html` entrypoint.\n\n## How it works\n\n`next-static-manifest` runs after your app has been exported by Next. We generate a `next-static-manifest.json` file that you can poll on Lambda@Edge or in your Worker, after deploying, your worker will get a new file and route accordingly.\n\nIn your function/worker, it's important to use `decode` when parsing the manifest file.\n\n```js\nimport { decode } from 'next-static-manifest';\n\nfetch('.../next-static-manifest.json')\n  .then((r) =\u003e r.json())\n  .then((data) =\u003e decode(data));\n```\n\nWe need to hydrate our data with `decode`, because regex isn't part of the JSON spec, so we have to encode/decode it ourselves.\n\n\u003chr /\u003e\n\nQuestions? Feedback? [Please let me know](https://github.com/hanford/next-static-manifest/issues/new)\n\n## License (MIT)\n\n```\nWWWWWW||WWWWWW\n W W W||W W W\n      ||\n    ( OO )__________\n     /  |           \\\n    /o o|    MIT     \\\n    \\___/||_||__||_|| *\n         || ||  || ||\n        _||_|| _||_||\n       (__|__|(__|__|\n```\n\nCopyright © 2020-present [Jack Hanford](http://jackhanford.com), jackhanford@gmail.com\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhanford%2Fnext-static-manifest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhanford%2Fnext-static-manifest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhanford%2Fnext-static-manifest/lists"}