docs(adr): add ADR 0001 for SDK API design principles (#144) - #170
Merged
El-swaggerito merged 1 commit intoJul 21, 2026
Merged
Conversation
Add an Architecture Decision Record documenting the SDK's API design principles across naming, error handling, configuration, async operations, and backwards compatibility, plus an ADR index and a README link. Closes Axionvera#144
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add ADR for SDK API design principles
Closes #144
Summary
Adds an Architecture Decision Record documenting the SDK's API design principles, so future contributions and reviews have a shared reference instead of re-deciding these questions case by case. This is a documentation-only change: it records current practice and introduces no code changes.
What it adds
docs/adr/0001-api-design-principles.md— the ADR itself, covering the five areas the issue calls for:camelCaseaction verbs grouped by domain module, a single package entry point, and thedoThing/safeDoThing/enhancedDoThing/safeEnhancedDoThingprefix convention that communicates a function's error behavior from its name.PocketPayError(message, code, details?, cause?)class with stable machine-readable codes, and the two consumption styles (throwing base functions vs.safe*functions returning a{ ok, value }/{ ok, error }discriminated union).SDKConfig, resolved throughresolveConfigwith a clear override → environment → default precedence, and fail-fast validation.ResultWarnings and actionableRecoveryHints.docs/adr/README.md— an ADR index describing what ADRs are and listing the records.Acceptance criteria
Notes
The ADR documents the API patterns as they exist in the current source (the result union,
PocketPayErrorshape, thesafe*/enhanced*naming family,Partial<SDKConfig>overrides, and theResultWarning/RecoveryHintenrichment). No source files were modified.Separately, while preparing this ADR I noticed
maincurrently does not type-check:src/types/index.tsis missing exports that many modules import from../types(PocketPayError,SDKConfig,StellarNetwork,SuccessResult,PocketPayResult, and others), sotsc --noEmitfails project-wide. That is a pre-existing issue unrelated to this documentation change and is not addressed here; I'd suggest tracking it as its own bug.