{"id":31628038,"url":"https://github.com/jirutka/nginx-jsconf","last_synced_at":"2026-04-18T11:31:42.670Z","repository":{"id":241109193,"uuid":"804334406","full_name":"jirutka/nginx-jsconf","owner":"jirutka","description":"JS library and a CLI tool to convert nginx configuration from YAML or JSON to nginx config format","archived":false,"fork":false,"pushed_at":"2024-06-24T21:30:26.000Z","size":39,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-20T04:51:10.081Z","etag":null,"topics":["cli-tool","nginx","nginx-configuration"],"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/jirutka.png","metadata":{"files":{"readme":"README.adoc","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,"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":"2024-05-22T11:59:08.000Z","updated_at":"2025-07-08T20:46:55.000Z","dependencies_parsed_at":null,"dependency_job_id":"e50d74c2-b9ec-419f-9441-b4beb7b2ac8f","html_url":"https://github.com/jirutka/nginx-jsconf","commit_stats":null,"previous_names":["jirutka/nginx-jsconf"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/jirutka/nginx-jsconf","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jirutka%2Fnginx-jsconf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jirutka%2Fnginx-jsconf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jirutka%2Fnginx-jsconf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jirutka%2Fnginx-jsconf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jirutka","download_url":"https://codeload.github.com/jirutka/nginx-jsconf/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jirutka%2Fnginx-jsconf/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31966920,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T00:39:45.007Z","status":"online","status_checked_at":"2026-04-18T02:00:07.018Z","response_time":103,"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":["cli-tool","nginx","nginx-configuration"],"created_at":"2025-10-06T20:17:09.386Z","updated_at":"2026-04-18T11:31:42.649Z","avatar_url":"https://github.com/jirutka.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"= nginx-jsconf\n:npm-name: nginx-jsconf\n:gh-name: jirutka/{npm-name}\n:version: 0.1.2\n:releases-uri: https://github.com/{gh-name}/releases/download/v{version}\n\nifdef::env-github[]\nimage:https://github.com/{gh-name}/workflows/CI/badge.svg[Build Status, link=https://github.com/{gh-name}/actions?query=workflow%3A%22CI%22]\nimage:https://img.shields.io/npm/v/{npm-name}.svg[npm Version, link=\"https://www.npmjs.org/package/{npm-name}\"]\nendif::env-github[]\n\nThis project provides a JavaScript library and a CLI tool to convert nginx configuration from YAML or JSON format to nginx configuration format, as well as functions to traverse and transform the configuration.\n\nSee https://github.com/jirutka/nginx-json-schema[jirutka/nginx-json-schema] for description of the YAML/JSON format.\n\n\n== Install CLI\n\n=== Using npm\n\n[source, sh, subs=\"+attributes\"]\nnpm install --global {npm-name}\n\n\n=== Download from Releases\n\n{npm-name} is also provided as a single JavaScript file with bundled dependencies, requiring only Node.js (version 18 or later) on the system.\n\n[source, sh, subs=\"+attributes\"]\ncurl -LO  {releases-uri}/{npm-name}.cjs\ncurl -fsSL {releases-uri}/checksums.txt | sha256sum -c --ignore-missing\ninstall -D -m755 {npm-name}.cjs /usr/local/bin/{npm-name}\n\n\n== Examples\n\n=== CLI: Convert configuration from YAML to nginx format\n\n[source, sh]\nnginx-jsconf --context main --out nginx.conf nginx.yml\n\n\n=== JavaScript: Convert JS(ON) object to nginx format\n\n[source, js, subs=\"+attributes\"]\n----\nimport { stringify } from '{npm-name}'\n\nconst config = {\n  server: [\n    {\n      listen: '443 http2 ssl',\n      server_name: 'example.org',\n      allow: [\n        '127.0.0.1/8',\n        '10.12.0.0/16',\n      ],\n      deny: 'all',\n      location: {\n        '/': {\n          proxy_pass: 'http://1.2.3.4',\n          proxy_set_header: {\n            Host: '$http_host',\n            'X-Forwarded-For': '$proxy_add_x_forwarded_for',\n            'X-Forwarded-Host': '$host',\n          },\n          proxy_buffering: false,\n        },\n        '~ \\\\.(?:css|js)$': {\n          add_header: {\n            'Cache-Control': '\"max-age=31556952, public\"',\n          }\n        }\n      }\n    }\n  ]\n}\n\nconsole.log(stringify('http', config, { indentation: 4 }))\n----\n\n\n=== JavaScript: Transform configuration\n\n[source, js, subs=\"+attributes\"]\n----\nimport { transform } from '{npm-name}'\n\nconst addProxyHeadersTransformer = {\n  name: ['server', 'location', 'if'],\n  block: true,\n  if: context =\u003e 'proxy_pass' in context,\n  transform: context =\u003e ({\n    ...context,\n    proxy_set_header: {\n      ...context.proxy_set_header,\n      'X-Forwarded-For': '$proxy_add_x_forwarded_for',\n      'X-Forwarded-Host': '$host',\n    }\n  })\n}\n\nconst adjustIncludePathTransformer = {\n  name: 'include',\n  context: ['server', 'location'],\n  block: false,\n  transform: value =\u003e {\n    const values = Array.isArray(value) ? value : [value]\n    return values.map(name =\u003e `/etc/nginx/incl/${name}.conf`)\n  }\n}\n\nconst newConfig = transform('main', config, [\n  addProxyHeadersTransformer,\n  adjustIncludePathTransformer,\n])\n----\n\n\n== License\n\nThis project is licensed under https://opensource.org/license/mit/[MIT License].\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjirutka%2Fnginx-jsconf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjirutka%2Fnginx-jsconf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjirutka%2Fnginx-jsconf/lists"}