{"id":21942813,"url":"https://github.com/react-declarative/nestjs-appwrite-bff","last_synced_at":"2026-03-07T17:31:19.315Z","repository":{"id":199270203,"uuid":"701696898","full_name":"react-declarative/nestjs-appwrite-bff","owner":"react-declarative","description":"Long polling realtime event support for AppWrite","archived":false,"fork":false,"pushed_at":"2023-10-13T17:25:04.000Z","size":130,"stargazers_count":3,"open_issues_count":1,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-11T06:43:01.205Z","etag":null,"topics":["appwrite","longpolling","realtime","sockjs"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/cra-template-appwrite","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/react-declarative.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}},"created_at":"2023-10-07T09:49:50.000Z","updated_at":"2024-09-17T00:45:44.000Z","dependencies_parsed_at":null,"dependency_job_id":"7b7c6fbb-6567-4ee9-b728-cd638fbf84a4","html_url":"https://github.com/react-declarative/nestjs-appwrite-bff","commit_stats":null,"previous_names":["react-declarative/nestjs-appwrite-bff"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/react-declarative/nestjs-appwrite-bff","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/react-declarative%2Fnestjs-appwrite-bff","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/react-declarative%2Fnestjs-appwrite-bff/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/react-declarative%2Fnestjs-appwrite-bff/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/react-declarative%2Fnestjs-appwrite-bff/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/react-declarative","download_url":"https://codeload.github.com/react-declarative/nestjs-appwrite-bff/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/react-declarative%2Fnestjs-appwrite-bff/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30223241,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-07T17:00:40.062Z","status":"ssl_error","status_checked_at":"2026-03-07T17:00:39.026Z","response_time":53,"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":["appwrite","longpolling","realtime","sockjs"],"created_at":"2024-11-29T03:26:41.382Z","updated_at":"2026-03-07T17:31:19.278Z","avatar_url":"https://github.com/react-declarative.png","language":"TypeScript","readme":"# nestjs-appwrite-bff\n\n\u003e AppWrite PWA bootstrap starter kit\n\n\u003ca href=\"https://cloud.appwrite.io/card/64b53d046c81edba0b1a\"\u003e\n\t\u003cimg width=\"350\" src=\"https://cloud.appwrite.io/v1/cards/cloud?userId=64b53d046c81edba0b1a\" alt=\"Appwrite Cloud Card\" /\u003e\n\u003c/a\u003e\n\n## The problem\n\nCurrently AppWrite [does not support Long Polling instead of WebSocket](\nhttps://github.com/appwrite/appwrite/issues/5631). This is critical if you want to use [Ngrok](https://ngrok.com). Also, using additional microservices together with the AppWrite functions is a must have feature for API integration to other systems: What if we need to cache some data in Redis before writing It into the production database?\n\n## Solution\n\nYou can use `createProxyMiddleware` with Express web server to connect your PWA with backend microservices. Also this tool restream AppWrite Realtime events by using [sockjs-client](https://www.npmjs.com/package/sockjs-client)\n\n```typescript\nimport AppwriteService from \"./AppwriteService\";\nimport { CC_APPWRITE_EVENT_RESTREAMER_URL } from \"../../../config/params\";\nimport Socket from \"sockjs-client\";\nimport TYPES from \"../../types\";\nimport { inject } from \"react-declarative\";\nimport { makeObservable } from \"mobx\";\n\ntype RealtimeResponseEvent\u003cT extends unknown\u003e = {\n  events: string[];\n  channels: string[];\n  timestamp: number;\n  payload: T;\n};\n\nexport class RealtimeService {\n  readonly appwriteService = inject\u003cAppwriteService\u003e(TYPES.appwriteService);\n\n  constructor() {\n    makeObservable(this, {});\n  }\n\n  subscribe = \u003cT extends unknown\u003e(\n    channels: string | string[],\n    callback: (payload: RealtimeResponseEvent\u003cT\u003e) =\u003e void\n  ) =\u003e {\n    if (CC_APPWRITE_EVENT_RESTREAMER_URL) {\n      const socket = new Socket(CC_APPWRITE_EVENT_RESTREAMER_URL);\n\n      socket.onopen = () =\u003e {\n        socket.send(JSON.stringify(channels));\n      };\n\n      socket.onerror = (error) =\u003e {\n        console.error(error);\n      };\n\n      socket.onmessage = (msg) =\u003e {\n        const payload = JSON.parse(msg.data);\n        callback(payload);\n      };\n\n      socket.onclose = (...args) =\u003e {\n        console.log(\"socket closed\", { args });\n      };\n\n      return () =\u003e socket.close();\n    }\n    return this.appwriteService.client.subscribe(channels, callback);\n  };\n}\n\nexport default RealtimeService;\n```\n\nJust copy and paste that code to [cra-template-appwrite](https://www.npmjs.com/package/cra-template-appwrite) and enjoy long polling appwrite events\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freact-declarative%2Fnestjs-appwrite-bff","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Freact-declarative%2Fnestjs-appwrite-bff","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freact-declarative%2Fnestjs-appwrite-bff/lists"}