{"id":39811384,"url":"https://github.com/yandex-cloud-examples/yc-serverless-graphql-subscriptions","last_synced_at":"2026-01-18T12:44:34.498Z","repository":{"id":298495461,"uuid":"771715499","full_name":"yandex-cloud-examples/yc-serverless-graphql-subscriptions","owner":"yandex-cloud-examples","description":"How to implement a basic GraphQL subscriptions using Yandex Cloud Serverless ecosystem.","archived":false,"fork":false,"pushed_at":"2025-06-11T11:09:45.000Z","size":310,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-06-11T12:25:10.539Z","etag":null,"topics":["api-gateway","graphql","serverless","serverless-function","yandex-cloud","yandexcloud","ydb"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yandex-cloud-examples.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-03-13T20:14:22.000Z","updated_at":"2025-06-11T11:09:50.000Z","dependencies_parsed_at":"2025-06-11T12:35:40.735Z","dependency_job_id":null,"html_url":"https://github.com/yandex-cloud-examples/yc-serverless-graphql-subscriptions","commit_stats":null,"previous_names":["yandex-cloud-examples/yc-serverless-graphql-subscriptions"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/yandex-cloud-examples/yc-serverless-graphql-subscriptions","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yandex-cloud-examples%2Fyc-serverless-graphql-subscriptions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yandex-cloud-examples%2Fyc-serverless-graphql-subscriptions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yandex-cloud-examples%2Fyc-serverless-graphql-subscriptions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yandex-cloud-examples%2Fyc-serverless-graphql-subscriptions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yandex-cloud-examples","download_url":"https://codeload.github.com/yandex-cloud-examples/yc-serverless-graphql-subscriptions/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yandex-cloud-examples%2Fyc-serverless-graphql-subscriptions/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28536012,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-18T10:13:46.436Z","status":"ssl_error","status_checked_at":"2026-01-18T10:13:11.045Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["api-gateway","graphql","serverless","serverless-function","yandex-cloud","yandexcloud","ydb"],"created_at":"2026-01-18T12:44:34.397Z","updated_at":"2026-01-18T12:44:34.472Z","avatar_url":"https://github.com/yandex-cloud-examples.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Yandex Cloud Serverless GraphQL Subscriptions\nExample on how to implement a basic GraphQL subscriptions using Yandex Cloud Serverless ecosystem\n\n# Setup\nResources required:\n- YDB\n- 3 Cloud functions\n- Api Gateway\n\n## Infrastructure\nAs of now WebSocket and YDB features are not supported by YC's `terraform` or `serverless`, so we are to create resources and execute migrations manually.\n\n- Create a folder\n- Create a service-account. For simplicity give this account admin role to the folder. In production the role should be more granular\n- [Create](https://cloud.yandex.ru/docs/functions/operations/function/function-create) `graphql-websocket-connect` function\n- [Create](https://cloud.yandex.ru/docs/functions/operations/function/function-create) `graphql-websocket-message` function\n- [Create](https://cloud.yandex.ru/docs/functions/operations/function/function-create) `graphql-websocket-disconnect` function\n- [Create](https://cloud.yandex.ru/docs/ydb/operations/manage-database#create-db) a YDB database in a serverless mode\n- In the database console execute SQL queries from [/src/migrations/](/src/migrations/) consequently\n- [Create](https://cloud.yandex.ru/docs/api-gateway/operations/api-gw-create) Api Gateway with config similar to this:\n```yaml\nopenapi: 3.0.0\ninfo:\n  title: Sample API\n  version: 1.0.0\npaths:\n  /:\n    x-yc-apigateway-websocket-connect:\n      x-yc-apigateway-integration:\n        type: cloud_functions\n        function_id: \u003cgraphql-websocket-connect id\u003e\n        tag: $latest\n        service_account_id: \u003cservice-account id\u003e\n    x-yc-apigateway-websocket-message:\n      x-yc-apigateway-integration:\n        type: cloud_functions\n        function_id: \u003cgraphql-websocket-message id\u003e\n        tag: $latest\n        service_account_id: \u003cservice-account id\u003e\n    x-yc-apigateway-websocket-disconnect:\n      x-yc-apigateway-integration:\n        type: cloud_functions\n        function_id: \u003cgraphql-websocket-disconnect id\u003e\n        tag: $latest\n        service_account_id: \u003cservice-account id\u003e\n```\nNote that function_ids and service_account_id should be replaced with corresponding data.\nAs long as you keep the ids you can specify any name for the function. In production this should be configured with terraform and CI scripts\n\n## Development\n- Install packages using `npm ci`\n- Create service account with at least functions.editor role\n- Create and save [authorized key](https://cloud.yandex.ru/docs/iam/operations/authorized-key/create) for this account\n- Create and fill `.env` file in the repository root accordingly to [example.env](/example.env)\n- Execute `npm dev`\n\nThis is gonna upload the functions to the cloud and start watch mode for development\n\n## Testing\nhttps://studio.apollographql.com/sandbox/explorer can be used for GraphQL query\\subscription testing after deployment\n\n# Code generation and tools\nThis project uses several tools some of which might be considered unorthodox:\n### graphql-codegen\nProduction solution to generate typescript and resolver definitions from GraphQL Schema\n### esbuild\nOne of the fastest Typescript to Javascript compilers\n### ydb-codegen\nWIP project to simplify working with Yandex Database\n### serverless-esbuild\nPlugin for esbuild which makes development process faster\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyandex-cloud-examples%2Fyc-serverless-graphql-subscriptions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyandex-cloud-examples%2Fyc-serverless-graphql-subscriptions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyandex-cloud-examples%2Fyc-serverless-graphql-subscriptions/lists"}