Back to list
langgenius

orpc-contract-first

by langgenius

Production-ready platform for agentic workflow development.

126,848🍴 19,786📅 Jan 23, 20264 files · 28.7 KB

Use Cases

🔗

MCP Server Integration

AI tool integration using Model Context Protocol. Using orpc-contract-first.

🤖

Workflow Automation

Automate repetitive tasks and reduce manual work.

🚀

CI/CD Pipeline Setup

Build automated pipelines for build, test, and deploy.

FAQ

Files4
28.7 KB
component-refactoring/
references/
SKILL.md14.1 KB
frontend-code-review/
references/
SKILL.md2.8 KB
frontend-testing/
assets/
references/
SKILL.md10.1 KB
orpc-contract-first/
SKILL.md1.7 KB

SKILL.md


name: orpc-contract-first description: Guide for implementing oRPC contract-first API patterns in Dify frontend. Triggers when creating new API contracts, adding service endpoints, integrating TanStack Query with typed contracts, or migrating legacy service calls to oRPC. Use for all API layer work in web/contract and web/service directories.

oRPC Contract-First Development

Project Structure

web/contract/
├── base.ts           # Base contract (inputStructure: 'detailed')
├── router.ts         # Router composition & type exports
├── marketplace.ts    # Marketplace contracts
└── console/          # Console contracts by domain
    ├── system.ts
    └── billing.ts

Workflow

  1. Create contract in web/contract/console/{domain}.ts

    • Import base from ../base and type from @orpc/contract
    • Define route with path, method, input, output
  2. Register in router at web/contract/router.ts

    • Import directly from domain file (no barrel files)
    • Nest by API prefix: billing: { invoices, bindPartnerStack }
  3. Create hooks in web/service/use-{domain}.ts

    • Use consoleQuery.{group}.{contract}.queryKey() for query keys
    • Use consoleClient.{group}.{contract}() for API calls

Key Rules

  • Input structure: Always use { params, query?, body? } format
  • Path params: Use {paramName} in path, match in params object
  • Router nesting: Group by API prefix (e.g., /billing/*billing: {})
  • No barrel files: Import directly from specific files
  • Types: Import from @/types/, use type<T>() helper

Type Export

export type ConsoleInputs = InferContractRouterInputs<typeof consoleRouterContract>

Score

Total Score

80/100

Based on repository quality metrics

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

+10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 1000以上

+15
最近の活動

1ヶ月以内に更新

+10
フォーク

10回以上フォークされている

+5
Issue管理

オープンIssueが50未満

0/5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

+5

Reviews

💬

Reviews coming soon