{"id":20367626,"url":"https://github.com/fugazi-io/proxify","last_synced_at":"2026-04-21T14:03:18.757Z","repository":{"id":75130363,"uuid":"95497869","full_name":"fugazi-io/proxify","owner":"fugazi-io","description":"Serve existing http based APIs as fugazi modules","archived":false,"fork":false,"pushed_at":"2017-09-16T20:07:07.000Z","size":41,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-15T14:17:22.247Z","etag":null,"topics":["cli","console","cors","fugazi","proxy","rpc","rpc-client","terminal"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fugazi-io.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2017-06-26T23:24:47.000Z","updated_at":"2017-07-28T15:27:07.000Z","dependencies_parsed_at":"2023-03-10T15:30:30.780Z","dependency_job_id":null,"html_url":"https://github.com/fugazi-io/proxify","commit_stats":{"total_commits":20,"total_committers":4,"mean_commits":5.0,"dds":0.5,"last_synced_commit":"ac72a007a05d7b12c2a850bb8d46b2207afa26c4"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fugazi-io%2Fproxify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fugazi-io%2Fproxify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fugazi-io%2Fproxify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fugazi-io%2Fproxify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fugazi-io","download_url":"https://codeload.github.com/fugazi-io/proxify/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241909245,"owners_count":20040772,"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":["cli","console","cors","fugazi","proxy","rpc","rpc-client","terminal"],"created_at":"2024-11-15T00:33:41.155Z","updated_at":"2026-04-21T14:03:18.661Z","avatar_url":"https://github.com/fugazi-io.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fugazi proxify\n\nA node package for serving remote APIs as [fugazi modules](https://github.com/fugazi-io/webclient/blob/master/docs/components/modules.md).  \nIt does so by:\n * Serving the module descriptor\n * Proxying all of the requests to the original server and adding [CORS headers](https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS) for the responses\n\n## Motivation\nThe fugazi terminal is restricted by the browser security, and more precisely the [Same-origin policy](https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy), \nand so every request made must be served from the same host as the one that fugazi was loaded from.  \nThat can be bypassed using CORS, or by hosting the [fugazi proxy-frame](https://github.com/fugazi-io/webclient/blob/master/html/proxyframe.html), but in some cases changing the configuration \nof the server which exposes the API isn't easy, or against policies.\n\nBy running proxify on the local machine, the entire API is \"proxied\" with CORS headers and can be loaded into \nthe fugazi terminal.\n\n## Installation\n```npm\nnpm install @fugazi/proxify\n```\n\n## Build\n```bash\nnpm run compile\n// or\nnode_modules/typescript/bin/tsc -p scripts\n```\n\n## Running\n```bash\nnpm start [OPTIONS] descriptor\n// OR\nnode scripts/bin/index.js [OPTIONS] descriptor\n```\n\nIf you want to pass arguments then:\n```bash\nnpm run start -- --listen-host 3232\n// or\nnode scripts/bin/index.js --listen-host 3232\n```\n\n#### descriptor\nEither a url or a path to a file to a [root module descriptor](https://github.com/fugazi-io/webclient/blob/master/docs/components/modules.md#root-module).\n\n#### Options\n * **--listen-host**: The host to which proxify will bind to, default is localhost\n * **--listen-port**: The port to which proxify will bind to, default is 33334\n\n\n## Predefined Modules\nFew REST based Descriptors are provided \"out of the box\" and can be used right away,\nor serve for reference and basis for more customizations.\n\nThe modules are located under _modules_ directory.\n\nTo run a module, replace the _BASE_URL_ placeholder for remote.origin,\nwith the actual url of your server, e.g. _http://localhost:1234_.\n\n#### Docker Module\nA Docker descriptor to interact with the REST API of a Docker engine is\nprovided under _modules/docker.json_.\n```bash\nnpm start [OPTIONS] modules/docker.json\n```\n\n#### Jenkins Module\nA Jenkins descriptor to interact with the REST API of a Jenkins server is\nprovided under _modules/jenkins.json_.\n```bash\nnpm start [OPTIONS] modules/jenkins.json\n```\n\n\n## Example\nLet's take an example of a (very) simple http based API for a music database with the following endpoints:\n * GET /labels - returns a list of all record labels\n * GET /artists - returns a list of all artists\n * GET /genres - returns a list of all genres\n \n * GET /label/{ id } - returns the record label for the given id\n * GET /artist/{ id } - returns the artist for the given id\n * GET /genre/{ id } - returns the genre for the given id\n \nLet's also say that the API is served from `http://db.music.com/api`.\n\nTo use this api from the fugazi client all we need to do is:\nWe create a descriptor file:\n```json\n{\n\t\"name\": \"music.db\",\n\t\"title\": \"The music database API\",\n\t\"remote\": {\n\t\t\"origin\": \"http://db.music.com\",\n\t\t\"base\": \"/api\"\n\t},\n\t\"commands\": {\n\t\t\"allLabels\": {\n\t\t\t\"returns\": \"list\",\n\t\t\t\"syntax\": [\n\t\t\t\t\"get all labels\",\n\t\t\t\t\"labels\"\n\t\t\t],\n\t\t\t\"handler\": {\n\t\t\t\t\"endpoint\": \"/labels\"\n\t\t\t}\n\t\t},\n\t\t\"allArtists\": {\n\t\t\t\"returns\": \"list\",\n\t\t\t\"syntax\": [\n\t\t\t\t\"get all artists\",\n\t\t\t\t\"artists\"\n\t\t\t],\n\t\t\t\"handler\": {\n\t\t\t\t\"endpoint\": \"/artists\"\n\t\t\t}\n\t\t},\n\t\t\"allGenres\": {\n\t\t\t\"returns\": \"list\",\n\t\t\t\"syntax\": [\n\t\t\t\t\"get all genres\",\n\t\t\t\t\"genres\"\n\t\t\t],\n\t\t\t\"handler\": {\n\t\t\t\t\"endpoint\": \"/genres\"\n\t\t\t}\n\t\t},\n\t\t\"getLabel\": {\n\t\t\t\"returns\": \"map\",\n\t\t\t\"syntax\": \"label (id string)\",\n\t\t\t\"handler\": {\n\t\t\t\t\"endpoint\": \"/label/{ id }\"\n\t\t\t}\n\t\t},\n\t\t\"getArtist\": {\n\t\t\t\"returns\": \"map\",\n\t\t\t\"syntax\": \"artist (id string)\",\n\t\t\t\"handler\": {\n\t\t\t\t\"endpoint\": \"/artist/{ id }\"\n\t\t\t}\n\t\t},\n\t\t\"getGenre\": {\n\t\t\t\"returns\": \"map\",\n\t\t\t\"syntax\": \"genre (id string)\",\n\t\t\t\"handler\": {\n\t\t\t\t\"endpoint\": \"/genre/{ id }\"\n\t\t\t}\n\t\t}\n\t}\n}\n```\n\nAnd save it in the directory where we installed the `proxify` package, let's say `~/fugazi/proxify/music.db.json`.  \nNow we run it:\n```npm\n~/fugazi/proxify\u003e npm start music.db.json\n```\nThe output should be something like:\n```bash\nserver started, listening to localhost:33334\nload module descriptor from: http://localhost:33334/music.db.json\n```\n\nNow, inside the [fugazi terminal](http://fugazi.io) we simply load the module:\n```\nload module from \"http://localhost:33334/music.db.json\"\n```\n\nAnd then we can just execute the commands:\n```\nget all artists\ngenre 1243tg\netc\n```\n\n\n## Contact\nFeel free to [create issues](https://github.com/fugazi-io/proxify/issues) if you're running into trouble, \nand welcome to ask any question in [our gitter](https://gitter.im/fugazi-io/Lobby).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffugazi-io%2Fproxify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffugazi-io%2Fproxify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffugazi-io%2Fproxify/lists"}