{"id":30766637,"url":"https://github.com/cocrafts/graphql","last_synced_at":"2026-04-13T09:32:02.324Z","repository":{"id":310587554,"uuid":"1035411288","full_name":"cocrafts/graphql","owner":"cocrafts","description":"A GraphQL Server setup for cross runtimes, supporting both dedicated servers and serverless environments. Compliant with the graphql-ws protocol.","archived":false,"fork":false,"pushed_at":"2025-09-25T05:17:05.000Z","size":340,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-12-03T01:20:01.211Z","etag":null,"topics":["aws","graphql","graphql-subscriptions","graphql-ws","lambda","pubsub","serverless","websocket"],"latest_commit_sha":null,"homepage":"","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/cocrafts.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-08-10T10:43:44.000Z","updated_at":"2025-09-25T05:17:09.000Z","dependencies_parsed_at":"2025-08-19T03:36:26.825Z","dependency_job_id":"fbed883d-d0b6-405a-b59f-73957c00f464","html_url":"https://github.com/cocrafts/graphql","commit_stats":null,"previous_names":["cocrafts/graphql"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/cocrafts/graphql","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cocrafts%2Fgraphql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cocrafts%2Fgraphql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cocrafts%2Fgraphql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cocrafts%2Fgraphql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cocrafts","download_url":"https://codeload.github.com/cocrafts/graphql/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cocrafts%2Fgraphql/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31746294,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-13T09:16:15.125Z","status":"ssl_error","status_checked_at":"2026-04-13T09:16:05.023Z","response_time":93,"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":["aws","graphql","graphql-subscriptions","graphql-ws","lambda","pubsub","serverless","websocket"],"created_at":"2025-09-04T19:31:03.866Z","updated_at":"2026-04-13T09:32:02.318Z","avatar_url":"https://github.com/cocrafts.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @cocrafts/graphql\n\nA GraphQL Server setup for cross runtimes, supporting both dedicated servers and serverless environments. Compliant with the [`graphql-ws` protocol](https://github.com/enisdenjo/graphql-ws/blob/master/PROTOCOL.md).\n\n## Overview\n\nThis project provides a unified GraphQL backend architecture that can run on dedicated servers, local development environments, and AWS Lambda infrastructure. The same GraphQL schema and resolvers work across all environments.\n\n## Packages\n\n### @cocrafts/graphql-lambda\n\nAWS Lambda adapters for GraphQL with HTTP and WebSocket support.\n\n**Features:**\n\n- HTTP and WebSocket adapters for AWS Lambda\n- Redis integration for distributed storage and pub/sub\n- Cross-environment compatibility (local + Lambda)\n- Unified GraphQL interface\n\n**Usage:**\n\n```typescript\nimport {\n\tAWSGraphQLHttpAdapter,\n\tAWSGraphQLWsAdapter,\n} from '@cocrafts/graphql-lambda';\n\n// HTTP Lambda\nexport const httpHandler = AWSGraphQLHttpAdapter(graphqlHttpOptions);\n\n// WebSocket Lambda\nexport const wsHandler = AWSGraphQLWsAdapter({\n\t...graphqlWsOptions,\n\tstorage,\n\tgateway,\n\tpubsub,\n});\n```\n\n### @cocrafts/graphql-pubsub\n\nAbstract pub/sub interface for GraphQL subscriptions.\n\n**Features:**\n\n- Abstract `GraphQLPubSub` interface\n- Default implementation with `graphql-subscriptions`\n- Extensible for custom pub/sub backends\n\n**Usage:**\n\n```typescript\nimport { DefaultGraphQLPubSub } from '@cocrafts/graphql-pubsub';\n\nconst pubsub = new DefaultGraphQLPubSub();\nconst channel = pubsub.subscribe('user.created');\nawait pubsub.publish('user.created', { id: '123', name: 'John' });\n```\n\n### @cocrafts/graphql-example\n\nComplete working example demonstrating the full stack integration.\n\n## Runtime Environments\n\n### Local Development / Monolith Server\n\n- Standard `graphql-http` and `graphql-ws` libraries\n- Local pub/sub engine\n- Direct WebSocket connections\n\n### AWS Lambda Serverless\n\n- WebSocket Gateway via API Gateway\n- Redis-based distributed storage and pub/sub\n- Lambda functions for resolvers\n- Context persistence between invocations\n\n## Installation\n\n```bash\nnpm install @cocrafts/graphql-lambda @cocrafts/graphql-pubsub\n```\n\n## Key Benefits\n\n- **Unified Codebase**: Single GraphQL schema works everywhere\n- **Environment Agnostic**: Same code runs locally and in production\n- **Serverless Ready**: Lambda adapters with Redis pub/sub\n- **Protocol Compliant**: Full `graphql-ws` protocol support\n- **Type Safe**: Complete TypeScript support\n\n## Development\n\n```bash\n# Build packages\ncd packages/graphql-lambda \u0026\u0026 bun run build\ncd packages/graphql-pubsub \u0026\u0026 bun run build\n\n# Run example\ncd packages/graphql-example \u0026\u0026 bun run dev\n```\n\n## Critical Considerations\n\n### Serverless Limitations\n\n- **Context must be JSON serializable** - No functions, classes, or circular references\n- **No async iterators** - Uses custom pub/sub engine instead\n- **No field-level filtering** - Topic-based subscription routing only\n- **Context reconstruction** - Context rebuilt from Redis on each Lambda invocation\n\n### Best Practices\n\n- Design subscriptions for direct payload forwarding\n- Use topic-based filtering instead of field-level filtering\n- Keep context data minimal and serializable\n- Implement proper error handling and cleanup\n\nFor detailed serverless considerations, see the [@cocrafts/graphql-lambda README](./packages/graphql-lambda/README.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcocrafts%2Fgraphql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcocrafts%2Fgraphql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcocrafts%2Fgraphql/lists"}