{"id":13812978,"url":"https://github.com/relistan/spacesuit","last_synced_at":"2025-10-30T18:53:19.914Z","repository":{"id":137521317,"uuid":"79471459","full_name":"relistan/spacesuit","owner":"relistan","description":"API Gateway with URL remapping","archived":false,"fork":false,"pushed_at":"2019-06-12T14:12:06.000Z","size":150,"stargazers_count":20,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-13T22:00:12.172Z","etag":null,"topics":["api-gateway","beam","elixir","elixir-lang"],"latest_commit_sha":null,"homepage":"","language":"Elixir","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/relistan.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}},"created_at":"2017-01-19T16:22:04.000Z","updated_at":"2023-09-01T08:53:02.000Z","dependencies_parsed_at":"2024-01-18T02:38:52.003Z","dependency_job_id":"313bec9a-9e49-4645-a4dc-c15d4583d338","html_url":"https://github.com/relistan/spacesuit","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/relistan%2Fspacesuit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/relistan%2Fspacesuit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/relistan%2Fspacesuit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/relistan%2Fspacesuit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/relistan","download_url":"https://codeload.github.com/relistan/spacesuit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248487378,"owners_count":21112186,"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":["api-gateway","beam","elixir","elixir-lang"],"created_at":"2024-08-04T04:00:59.009Z","updated_at":"2025-10-30T18:53:19.796Z","avatar_url":"https://github.com/relistan.png","language":"Elixir","funding_links":[],"categories":["Elixir"],"sub_categories":[],"readme":"Spacesuit\n=========\n\n![spacesuit build](https://travis-ci.org/Nitro/spacesuit.svg?branch=master)\n\nAn API gateway written in Elixir, built on top of the Cowboy web server and\nHackney http client. Supports streaming requests, remapping by hostname, HTTP\nmethod, and endpoint. Now also includes full CORS support with middleware,\nallowing backing services to offload CORS to Spacesuit.\n\nSample config:\n```ruby\n  \"[...]:_\" =\u003e [ # Match any hostname/port\n    { \"/users/:user_id\", %{\n      description: \"users to [::1]:9090\",\n      GET: \"http://[::1]:9090/:user_id\", # ipv6 localhost (thanks osx)\n      POST: \"http://[::1]:9090/:user_id\"\n    }},\n\n    {\"/users/something/:user_id\", %{\n      description: \"users/something to [::1]:9090\",\n      all_actions: \"http://[::1]:9090/something/:user_id\"\n    }},\n\n    {\"/[...]\", %{\n      description: \"others to hacker news\",\n      destination: \"https://news.ycombinator.com\"\n    }}\n  ]\n```\n\nInstallation\n------------\n\nYou need to have Elixir and the BEAM VM installed. On OSX the easiest way to do\nthat is to `brew install elixir`. Next you need to install dependencies, with\n`mix deps.get`. Now you're ready to roll.\n\n*Note*: To run `mix compile` or `mix test` you also have to install Rebar3, the Erlang build system.\nOn OSX, use `brew install rebar` to install it.\n\nRunning\n-------\n\nSpacesuit listens on 8080 and waits for requests. You can start it up by running\n`iex -S mix run` or `mix run --no-halt`.\n\nConfiguration\n-------------\n\nSpacesuit relies on the `mix` configuration system with a common config in\n`config/config.exs` and environment based configs merged on top of that. If you\nwere running in the `dev` environment, for example, `config/config.exs` would\nget loaded first and then `config/dev.exs` would be loaded afterward.\nAdditionally, it can be configured with some environment variables. The most\ncommon of these are\n\n* `MIX_ENV` which describes the current evironment\n* `SPACESUIT_LOGGING_LEVEL` which is a string corresponding to the minimum level of\n  logging we'll show in the console. (e.g. `SPACESUIT_LOGGING_LEVEL=\"warn\"`)\n\nIf you use New Relic for monitoring your applications, you can also turn on basic\nmetric support in Spacesuit by providing the standard New Relic environment variable\nfor your license key:\n\n* `NEW_RELIC_LICENSE_KEY` the string value containing your New Relic license, as\n  provided to any other New Relic agent.\n\nRoute Configuration\n-------------------\n\nThe routes support a fairly extensive pattern match, primarily from the\nunderlying Cowboy web server. The good documentation on that is [available\nhere](https://ninenines.eu/docs/en/cowboy/1.0/guide/routing/). Spacesuit supports\noutbound remapping using a very similar syntax, as shown above.\n\nThe routes operate as a drop-through list so the first match will be the one\nused. This means you need to order your routes from the most specific to the\nleast specific in descending order. E.g. if you have a wildcard match that will\nmatch all hostnames, it needs to be below any routes that match on specific\nhostnames. If you've written network access lists before, these operate in a\nsimilar manner.\n\nOnce you have written your routes, a good step is to run the `mix validate_routes`\ntask, which will load the routes for the current `MIX_ENV` and check them all\nfor correctness.\n\nCORS Middleware\n---------------\n\nSpacesuit contains a CORS middleware which handles offloading CORS support from\nbackend services. You can enable this in the config following the examples set\nthere. **Note** if upstream services have CORS handling enabled internally and\nare sending CORS headers, responses from those services will override any from\nSpacesuit, even if CORS is enabled, *except* for `OPTIONS` requests which will\nbe served from Spacesuit all the time if CORS support is enabled for an endpoint.\n\nCoverage\n--------\n\nYou can view the coverage output in test mode by running:\n```\nMIX_ENV=test mix coveralls.html\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frelistan%2Fspacesuit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frelistan%2Fspacesuit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frelistan%2Fspacesuit/lists"}