{"id":29867205,"url":"https://github.com/any2api/any2api-gateframe","last_synced_at":"2025-07-30T13:22:51.554Z","repository":{"id":57098027,"uuid":"114093611","full_name":"any2api/any2api-gateframe","owner":"any2api","description":null,"archived":false,"fork":false,"pushed_at":"2018-03-28T14:27:26.000Z","size":256,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-06T09:24:39.898Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/any2api.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":"2017-12-13T08:20:24.000Z","updated_at":"2019-08-03T11:47:46.000Z","dependencies_parsed_at":"2022-08-20T16:50:57.549Z","dependency_job_id":null,"html_url":"https://github.com/any2api/any2api-gateframe","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/any2api/any2api-gateframe","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/any2api%2Fany2api-gateframe","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/any2api%2Fany2api-gateframe/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/any2api%2Fany2api-gateframe/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/any2api%2Fany2api-gateframe/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/any2api","download_url":"https://codeload.github.com/any2api/any2api-gateframe/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/any2api%2Fany2api-gateframe/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267875056,"owners_count":24158767,"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","status":"online","status_checked_at":"2025-07-30T02:00:09.044Z","response_time":70,"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":[],"created_at":"2025-07-30T13:22:51.030Z","updated_at":"2025-07-30T13:22:51.536Z","avatar_url":"https://github.com/any2api.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# any2api-gateframe\n\nCore framework of the any2api ecosystem to expose domain/business logic through different kinds of APIs.\nBy default, domain/business logic is implemented as (micro)service, exposing its functionality through a gRPC API.\nEssentially, **any2api-gateframe** is a *gateway framework* to build specific gateways:\n\n\u003e gateframe + set of plugins + configuration = gateway\n\n**Adapters** (e.g. REST/HTTP adapter or GraphQL adapter) are implemented as plugins of the framework to expose functionality through diverse APIs.\nAnother kind of plugin supported by the framework are **intermediaries** to provide reusable technical logic (like request rate limiting or authentication).\nDomain/business logic that is not exposed through a gRPC API can be connected to the gateway through **connector** plugins (such as an AWS Lambda connector or OpenAPI connector).\n\nAll plugins should be as generic and reusable as possible to use them in conjunction with diverse plugins and services.\nTwo specific plugins are part of the framework, namely the **gRPC connector** and the **gRPC adapter**.\nThe framework prescribes interfaces to be implemented by plugins:\n\n```\nTODO add TS interface definitions\n```\n\nThe framework itself provides an admin API (gRPC) to register and deregister services:\n\n```\nservice Admin {\n  rpc AddConfig (AddConfigRequest) returns (AddConfigResponse)\n  rpc RemoveConfig (RemoveConfigRequest) returns (google.protobuf.Empty)\n  rpc GetConfig (GetConfigRequest) returns (GetConfigResponse)\n}\n\nmessage Config {\n  message ProtoService {\n    // optional package name to override package in proto definition\n    string proto_package_name\n    // inline proto definition or URL to proto definition\n    oneof def_or_url {\n      string proto_definition\n      string proto_url\n    }\n  }\n  message Connector {\n    string plugin_name // npm package name\n    google.protobuf.Any plugin_config\n  }\n  message Intermediary {\n    string plugin_name\n    google.protobuf.Any plugin_config\n  }\n  message Adapter {\n    string plugin_name\n    google.protobuf.Any plugin_config\n  }\n  oneof proto_or_connector {\n    ProtoService proto_service\n    Connector connector\n  }\n  repeated Intermediary intermediaries\n  Adapter adapter\n}\n\nmessage AddConfigRequest {\n  Config config\n}\n\nmessage AddConfigResponse {\n  string config_id\n}\n\nmessage RemoveConfigRequest {\n  string config_id\n}\n\nmessage GetConfigRequest {\n  string config_id\n}\n\nmessage GetConfigResponse {\n  Config config\n}\n```\n\nThis admin API can be disabled, for example for security purposes.\nAn alternative to using the admin API is providing `Config` messages as JSON files that are read by the gateway during start.\nPlugins are available as npm modules.\nThey are specified as npm dependencies at deployment time of the gateway.\n\n\n\n## Architecture\n\n**TODO** (generic, independent from implementation)\n\n\n\n## Implementation \u0026 deployment\n\nThe current implementation is based on Node.js.\nHowever, the architecture is generic and can be implemented in Golang or another language, for example to make the performance even better.\nMoreover, multiple gateways (like Node.js and Golang) could be combined to run extremely performance-critical plugins (like intermediaries) in Golang and utilize a rich ecosystem of Node.js at the same time.\n\n**TODO** add details\n\n\n\n## Further ideas\n\n* Global gateway config: blacklist/whitelist of plugins\n* \"Eat your own dogfood\" - use adapters for admin service of gateway\n* Adapter candidates\n  * gRPC Web: https://github.com/improbable-eng/grpc-web\n  * REST/HTTP\n  * REST/Kong: https://getkong.org\n  * SOAP/WSDL\n  * GraphQL\n    * https://github.com/google/rejoiner\n  * http://restql.b2w.io/\n  * https://mmikowski.github.io/json-pure/\n  * https://github.com/uber/tchannel\n  * https://github.com/mikeal/znode\n  * push STDIN messages as Server Sent Events: https://github.com/benas/ssed\n  * Jabber/XMPP\n  * https://www.w3.org/TR/pubsub/\n  * BERT-RPC\n  * cloud-native messaging: http://nats.io\n  * the new REST: http://graphql.org\n  * virtual JSON resource on client: https://netflix.github.io/falcor/\n  * Terraform modules: https://terraform.io/docs/modules/create.html\n  * TOSCA node type\n  * NPM module (exporting JS functions)\n  * Web UI\n  * use redis (or http://webd.is) pub/sub to interact with APIs\n  * use kue to interact with APIs: https://github.com/Automattic/kue\n  * JSON-RPC\n    * http://uber.github.io/multitransport-jsonrpc\n    * http://en.m.wikipedia.org/wiki/JSON-WSP\n  * XML-RPC?\n  * Java RMI?\n  * SocketIO (w/ WebSocket)\n  * SockJS\n  * SQL\n  * Thrift\n  * microservice frameworks\n    * http://senecajs.org\n    * https://hemerajs.github.io/hemera-site/\n  * Kafka, KafkaStreams: https://dev.to/danlebrero/simplifying-your-microservices-architecture-with-kafka-and-kafkastreams\n  * CLI adapter (docs endpoint with usage info and how to install CLI tool)\n    * interactive CLI using a library such as https://www.npmjs.com/package/inquirer\n* Intermediary candidates\n  * Service mesh like Envoy\n  * \"Sidecar for endpoint security\" (TW Tech Radar)\n  * Token-based Authentication\n  * API Monitoring \u0026 Prometheus Metrics Pull Interface (requests per minute, etc.)\n  * Interface Filter (hide gRPC operation/parameter, etc.)\n  * Circuit Breaker\n  * Request Rate Limiting\n  * Monitoring (DataDog?)\n  * Authentication (OpenID?)\n  * Authorization (OAuth 2.0)\n  * Auditing \u0026 Logging\n  * Request size limiting\n  * Request filtering (by content or headers)\n  * Request transformer\n  * Response transformer\n  * Correlation ID\n  * see https://getkong.org plugins for more ideas\n  * ...\n* Connector candidates\n  * OpenAPI\n  * AWS Lambda\n  * gRPC API Merge/Combine Connector to consolidate multiple gRPC APIs into a single one, which is then provided to the first intermediary\n  * https://wrapapi.com\n  * DB connector, e.g. mongodb-connector to expose DB functionality through any kind of API\n  * ...\n* Allow local \"one-file\" plugins to be loaded into any2api-gateframe during start\n* **TODO** any2api backlog: move relevant aspects to here!\n\n## Execution Architecture\n\nAfter the registration of service the plugins are initialized one after the other.\nThe first plugin to be initialized is the connnector, then all intermediaries and at last the adapter.\nThe service definition provided by the connector can be changed by every intermediary, so every plugin sees a service definition that is provided by the prescending plugin.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fany2api%2Fany2api-gateframe","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fany2api%2Fany2api-gateframe","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fany2api%2Fany2api-gateframe/lists"}