{"id":13837615,"url":"https://github.com/geops/next-nginx-routes","last_synced_at":"2025-04-05T20:03:06.780Z","repository":{"id":42691713,"uuid":"474890318","full_name":"geops/next-nginx-routes","owner":"geops","description":null,"archived":false,"fork":false,"pushed_at":"2023-11-05T18:34:11.000Z","size":441,"stargazers_count":146,"open_issues_count":3,"forks_count":14,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-04-26T01:20:50.826Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/geops.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2022-03-28T07:22:39.000Z","updated_at":"2024-04-11T03:48:46.000Z","dependencies_parsed_at":"2023-11-05T19:28:49.018Z","dependency_job_id":null,"html_url":"https://github.com/geops/next-nginx-routes","commit_stats":{"total_commits":16,"total_committers":3,"mean_commits":5.333333333333333,"dds":0.5,"last_synced_commit":"9bfa4adee3baed3a299207b142b6c88b6b7f70b7"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geops%2Fnext-nginx-routes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geops%2Fnext-nginx-routes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geops%2Fnext-nginx-routes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geops%2Fnext-nginx-routes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/geops","download_url":"https://codeload.github.com/geops/next-nginx-routes/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247393547,"owners_count":20931811,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":"2024-08-04T15:01:17.059Z","updated_at":"2025-04-05T20:03:06.729Z","avatar_url":"https://github.com/geops.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# next-nginx-routes\n\nGenerate Nginx routes configuration file for Next.js static HMTL export, also known as `output: export`.\n\nThis dependency-free [NPM package](https://www.npmjs.com/package/next-nginx-routes) provides a NPM script to convert all your Next.js routes like:\n\n```json\n{\n  \"page\": \"/[foo]\",\n  \"regex\": \"^/([^/]+?)(?:/)?$\",\n  \"routeKeys\": { \"foo\": \"foo\" },\n  \"namedRegex\": \"^/(?\u003cfoo\u003e[^/]+?)(?:/)?$\"\n}\n```\n\n... into Nginx routes like:\n\n```nginx\nlocation ~ ^/([^/]+?)(?:/)?$ {\n  try_files /[foo].html /index.html;\n}\n```\n\nNote: currently only Next.js pages router is fully supported.\n\n## Getting started\n\n### Installation\n\n```shell\nyarn add --dev next-nginx-routes\n```\n\nMake sure [`output: \"export\"`](https://nextjs.org/docs/pages/building-your-application/deploying/static-exports#configuration) is configured in your `next.config.js` file.\n\n### Generate Nginx configuration file\n\nAdd next-nginx-routes to your build script:\n\n```json\n{\n  \"build\": \"next build \u0026\u0026 next-nginx-routes\"\n}\n```\n\nAnd run Next.js export:\n\n```shell\nyarn run build\n```\n\n### Include Nginx configuration file\n\nFinally include the generated configuration file `next-routes.conf` in your Nginx site configuration file and make the Next.js `out` directory available to Nginx.\n\n## Requirements\n\n- [Next.js](https://nextjs.org) 12 or higher\n- [Node.js](https://nodejs.org) 18 or higher\n\n## More\n\n- See [`example`](https://github.com/geops/next-nginx-routes/tree/main/example) folder for a minimal Docker example.\n- Read more about this approach in our [blog post](https://geops.ch/en/blog/next-nginx-routes).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeops%2Fnext-nginx-routes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgeops%2Fnext-nginx-routes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeops%2Fnext-nginx-routes/lists"}