{"id":51173654,"url":"https://github.com/btravstack/temporal-contract","last_synced_at":"2026-06-27T02:05:07.938Z","repository":{"id":328074755,"uuid":"1111876464","full_name":"btravstack/temporal-contract","owner":"btravstack","description":"End-to-end type safety and automatic validation for workflows and activities","archived":false,"fork":false,"pushed_at":"2026-06-27T00:04:02.000Z","size":2060,"stargazers_count":9,"open_issues_count":3,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-06-27T00:07:11.451Z","etag":null,"topics":["nodejs","temporalio","typescript","validation","zod"],"latest_commit_sha":null,"homepage":"https://btravstack.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/btravstack.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":"AGENTS.md","dco":null,"cla":null}},"created_at":"2025-12-07T19:51:21.000Z","updated_at":"2026-06-26T23:58:55.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/btravstack/temporal-contract","commit_stats":null,"previous_names":["btravers/temporal-contract","btravstack/temporal-contract"],"tags_count":73,"template":false,"template_full_name":null,"purl":"pkg:github/btravstack/temporal-contract","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/btravstack%2Ftemporal-contract","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/btravstack%2Ftemporal-contract/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/btravstack%2Ftemporal-contract/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/btravstack%2Ftemporal-contract/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/btravstack","download_url":"https://codeload.github.com/btravstack/temporal-contract/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/btravstack%2Ftemporal-contract/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34839011,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-27T02:00:06.362Z","response_time":126,"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-06-27T02:05:07.211Z","updated_at":"2026-06-27T02:05:07.930Z","avatar_url":"https://github.com/btravstack.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/btravstack/temporal-contract/actions/workflows/ci.yml/badge.svg)](https://github.com/btravstack/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://btravstack.github.io/temporal-contract) · [**Get Started**](https://btravstack.github.io/temporal-contract/guide/getting-started) · [**Examples**](https://btravstack.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 unthrown's `AsyncResult`\n- ✅ **Result pattern** — Explicit error handling without exceptions, powered by [unthrown](https://github.com/btravstack/unthrown)\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 unthrown's AsyncResult\nimport { declareActivitiesHandler, ApplicationFailure } from \"@temporal-contract/worker/activity\";\nimport { fromPromise } from \"unthrown\";\n\nconst activities = declareActivitiesHandler({\n  contract,\n  activities: {\n    processPayment: ({ orderId }) =\u003e\n      fromPromise(paymentService.process(orderId), (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      ).map((txId) =\u003e ({ transactionId: txId })),\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/AsyncResult — peer dep used by worker/client APIs\npnpm add unthrown\n```\n\n## Documentation\n\n📖 **[Read the full documentation →](https://btravstack.github.io/temporal-contract)**\n\n- [Getting Started](https://btravstack.github.io/temporal-contract/guide/getting-started)\n- [Core Concepts](https://btravstack.github.io/temporal-contract/guide/core-concepts)\n- [API Reference](https://btravstack.github.io/temporal-contract/api/)\n- [Examples](https://btravstack.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 |\n| [@temporal-contract/client](./packages/client)     | Type-safe client for consuming workflows   |\n| [@temporal-contract/testing](./packages/testing)   | Testing utilities for integration tests    |\n\n## Usage Patterns\n\ntemporal-contract uses **[unthrown](https://github.com/btravstack/unthrown)** end-to-end (workflows, activities, and the typed client) for explicit error handling via `Result` and `AsyncResult`, with a separate `defect` channel for unanticipated failures. Migrating from a previous release that used `neverthrow`? See [Migrating to unthrown](https://btravstack.github.io/temporal-contract/guide/migrating-to-unthrown).\n\n## Contributing\n\nSee [CONTRIBUTING.md](https://github.com/btravstack/temporal-contract/blob/main/CONTRIBUTING.md).\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbtravstack%2Ftemporal-contract","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbtravstack%2Ftemporal-contract","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbtravstack%2Ftemporal-contract/lists"}