Skip to content

CRE - Building a Reusable Library Guide (TS & GO) - #4059

Open
ejacquier wants to merge 2 commits into
mainfrom
cre-library-guide
Open

CRE - Building a Reusable Library Guide (TS & GO)#4059
ejacquier wants to merge 2 commits into
mainfrom
cre-library-guide

Conversation

@ejacquier

Copy link
Copy Markdown
Contributor

Summary

Adds a new "Building a Reusable Library" guide (TS + Go) covering how to package integration logic as a standalone dependency that other developers can import into their own CRE workflows — filling a gap where no doc previously covered publishing/consuming shared code across workflows.

  • cre/guides/operations/building-a-library-ts.mdx — npm package guide: QuickJS/WASM restrictions, why standard HTTP/crypto/Node libs don't work, required use of CRE SDK capabilities (HTTPClient, .result() pattern, consensus aggregation), determinism pitfalls, packaging (peerDependency on @chainlink/cre-sdk), and publishing.
  • cre/guides/operations/building-a-library-go.mdx — Go module guide: same shape, adapted for WASI/wasip1 (no filesystem/raw sockets instead of QuickJS's stricter import ban), Promise/Await instead of goroutines/channels, Go-specific determinism rules (map iteration, encoding/json v1, proto.Marshal), and why library files should skip the //go:build wasip1 tag to stay unit-testable.
  • Wired both into src/config/sidebar.ts under Workflow Operations as a paired TS/Go entry (matching pageId/sdkLang), sitting alongside "Custom Rust Plugins."

Why

There was no guidance for the "author once, reuse across workflows" pattern — every integration (Slack, PagerDuty, etc.) was being hand-rolled per workflow. This gives library authors a single source of truth for the constraints that are easy to get wrong (e.g. accidentally depending on axios or net/http, or writing an async public API that can't actually be awaited in a handler).

@ejacquier
ejacquier requested review from a team as code owners August 14, 2026 12:46
@vercel

vercel Bot commented Aug 14, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
documentation Ready Ready Preview Aug 14, 2026 12:56pm

Request Review

@github-actions

Copy link
Copy Markdown
Contributor

👋 ejacquier, thanks for creating this pull request!

To help reviewers, please consider creating future PRs as drafts first. This allows you to self-review and make any final changes before notifying the team.

Once you're ready, you can mark it as "Ready for review" to request feedback. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant