{"id":36953815,"url":"https://github.com/btravers/temporal-contract","last_synced_at":"2026-05-04T02:02:58.645Z","repository":{"id":328074755,"uuid":"1111876464","full_name":"btravers/temporal-contract","owner":"btravers","description":"End-to-end type safety and automatic validation for workflows and activities","archived":false,"fork":false,"pushed_at":"2026-01-07T19:32:01.000Z","size":705,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-13T13:55:14.254Z","etag":null,"topics":["nodejs","temporalio","typescript","validation","zod"],"latest_commit_sha":null,"homepage":"https://btravers.github.io/temporal-contract/","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/btravers.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-12-07T19:51:21.000Z","updated_at":"2025-12-21T18:13:38.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/btravers/temporal-contract","commit_stats":null,"previous_names":["btravers/temporal-contract"],"tags_count":56,"template":false,"template_full_name":null,"purl":"pkg:github/btravers/temporal-contract","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/btravers%2Ftemporal-contract","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/btravers%2Ftemporal-contract/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/btravers%2Ftemporal-contract/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/btravers%2Ftemporal-contract/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/btravers","download_url":"https://codeload.github.com/btravers/temporal-contract/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/btravers%2Ftemporal-contract/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28651817,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-22T01:17:37.254Z","status":"online","status_checked_at":"2026-01-22T02:00:07.137Z","response_time":144,"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":["nodejs","temporalio","typescript","validation","zod"],"created_at":"2026-01-13T12:53:54.556Z","updated_at":"2026-05-04T02:02:58.636Z","avatar_url":"https://github.com/btravers.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n# temporal-contract\n\n**Type-safe contracts for Temporal.io**\n\nEnd-to-end type safety and automatic validation for workflows and activities\n\n[![CI](https://github.com/btravers/temporal-contract/actions/workflows/ci.yml/badge.svg)](https://github.com/btravers/temporal-contract/actions/workflows/ci.yml)\n[![npm version](https://img.shields.io/npm/v/@temporal-contract/contract.svg?logo=npm)](https://www.npmjs.com/package/@temporal-contract/contract)\n[![npm downloads](https://img.shields.io/npm/dm/@temporal-contract/contract.svg)](https://www.npmjs.com/package/@temporal-contract/contract)\n[![TypeScript](https://img.shields.io/badge/TypeScript-6.0-blue?logo=typescript)](https://www.typescriptlang.org/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\n[**Documentation**](https://btravers.github.io/temporal-contract) · [**Get Started**](https://btravers.github.io/temporal-contract/guide/getting-started) · [**Examples**](https://btravers.github.io/temporal-contract/examples/)\n\n\u003c/div\u003e\n\n## Features\n\n- ✅ **End-to-end type safety** — From contract to client, workflows, and activities\n- ✅ **Automatic validation** — Zod schemas validate at all network boundaries\n- ✅ **Compile-time checks** — TypeScript catches missing or incorrect implementations\n- ✅ **Better DX** — Autocomplete, refactoring support, inline documentation\n- ✅ **Child workflows** — Type-safe child workflow execution with Result/Future pattern\n- ✅ **Result/Future pattern** — Explicit error handling without exceptions\n- 🚧 **Nexus support** — Cross-namespace operations (planned for v0.5.0)\n\n## Quick Example\n\n```typescript\n// Define contract once\nconst contract = defineContract({\n  taskQueue: \"orders\",\n  workflows: {\n    processOrder: {\n      input: z.object({ orderId: z.string() }),\n      output: z.object({ success: z.boolean() }),\n      activities: {\n        processPayment: {\n          input: z.object({ orderId: z.string() }),\n          output: z.object({ transactionId: z.string() }),\n        },\n      },\n    },\n  },\n});\n\n// Implement activities with Future/Result pattern\nimport { declareActivitiesHandler, ApplicationFailure } from \"@temporal-contract/worker/activity\";\nimport { Future } from \"@swan-io/boxed\";\n\nconst activities = declareActivitiesHandler({\n  contract,\n  activities: {\n    processPayment: ({ orderId }) =\u003e {\n      return Future.fromPromise(paymentService.process(orderId))\n        .mapError((error) =\u003e\n          ApplicationFailure.create({\n            type: \"PAYMENT_FAILED\",\n            message: error instanceof Error ? error.message : \"Payment failed\",\n            ...(error instanceof Error ? { cause: error } : {}),\n          }),\n        )\n        .mapOk((txId) =\u003e ({ transactionId: txId }));\n    },\n  },\n});\n\n// Call from client - fully typed everywhere\nconst result = await client.executeWorkflow(\"processOrder\", {\n  workflowId: \"order-123\",\n  args: { orderId: \"ORD-123\" }, // ✅ TypeScript knows!\n});\n```\n\n## Installation\n\n```bash\n# Core packages\npnpm add @temporal-contract/contract @temporal-contract/worker @temporal-contract/client\n\n# Result/Future pattern (already included in worker/client via @swan-io/boxed)\npnpm add @swan-io/boxed\n```\n\n## Documentation\n\n📖 **[Read the full documentation →](https://btravers.github.io/temporal-contract)**\n\n- [Getting Started](https://btravers.github.io/temporal-contract/guide/getting-started)\n- [Core Concepts](https://btravers.github.io/temporal-contract/guide/core-concepts)\n- [API Reference](https://btravers.github.io/temporal-contract/api/)\n- [Examples](https://btravers.github.io/temporal-contract/examples/)\n\n## Packages\n\n| Package                                            | Description                                                                     |\n| -------------------------------------------------- | ------------------------------------------------------------------------------- |\n| [@temporal-contract/contract](./packages/contract) | Contract builder and type definitions                                           |\n| [@temporal-contract/worker](./packages/worker)     | Type-safe worker with automatic validation (uses @swan-io/boxed for activities) |\n| [@temporal-contract/client](./packages/client)     | Type-safe client for consuming workflows (uses @swan-io/boxed)                  |\n| [@temporal-contract/boxed](./packages/boxed)       | Temporal-compatible Result/Future types for workflows (alternative to @swan-io) |\n| [@temporal-contract/testing](./packages/testing)   | Testing utilities for integration tests                                         |\n\n## Usage Patterns\n\ntemporal-contract uses **[@swan-io/boxed](https://github.com/swan-io/boxed)** for activities and clients, providing excellent error handling with Result/Future patterns. For workflows that require Temporal's deterministic execution, use **@temporal-contract/boxed** which provides a compatible API.\n\n## Contributing\n\nSee [CONTRIBUTING.md](https://github.com/btravers/temporal-contract/blob/main/CONTRIBUTING.md).\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbtravers%2Ftemporal-contract","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbtravers%2Ftemporal-contract","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbtravers%2Ftemporal-contract/lists"}