Skip to content

feat: TypeScript SDK is not published to npm β€” the README's "Build an API client" path requires cloning the entire monorepo, making the SDK unusable as a standalone libraryΒ #257

Description

@divyanshim27

πŸš€ Problem Statement

The README's "Start Here" table lists: "Build an API client β†’ Use The SDK." The SDK section documents:

"The local TypeScript SDK lives in sdk/typescript/. It is private for now; it is not published to npm."

And the install instruction is:

bun add /path/to/MicroAI-Paygate/sdk/typescript

This means any developer who wants to integrate payment-gated AI requests into their own application must:

  1. Clone the entire MicroAI-Paygate monorepo (including Go gateway, Rust verifier, Next.js frontend, bench harness, etc.)
  2. Reference a local filesystem path
  3. Manually update when the SDK changes (no version pinning, no semver, no npm audit)

A TypeScript SDK installed via local path is not a distribution mechanism β€” it's a development workaround. The sdk/typescript/package.json already defines "name": "@microai/paygate-sdk" and exports, which means publishing to npm requires essentially zero additional work beyond setting up the CI release workflow.

Proposed Fix

1. Add npm publish workflow in .github/workflows/sdk-publish.yml

name: Publish SDK to npm

on:
  push:
    tags:
      - 'sdk-v*'  # Trigger on tags like sdk-v0.1.0, sdk-v1.0.0
    paths:
      - 'sdk/typescript/**'

jobs:
  publish:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: oven-sh/setup-bun@v2
        with: { bun-version: '1.3.13' }
      - uses: actions/setup-node@v4
        with:
          node-version: '20'
          registry-url: 'https://registry.npmjs.org'

      - name: Install and build SDK
        run: |
          cd sdk/typescript
          bun install
          bun run build

      - name: Run SDK tests
        run: cd sdk/typescript && bun run test

      - name: Publish to npm
        run: cd sdk/typescript && npm publish --access public
        env:
          NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

2. Update sdk/typescript/package.json

Add "files", "exports", and "publishConfig" fields following npm best practices:

{
  "name": "@microai/paygate-sdk",
  "version": "0.1.0",
  "description": "TypeScript SDK for MicroAI Paygate x402-style payment-gated AI APIs",
  "files": ["dist", "README.md", "LICENSE"],
  "exports": {
    ".": {
      "import": "./dist/index.js",
      "types": "./dist/index.d.ts"
    }
  },
  "publishConfig": {
    "access": "public"
  }
}

3. Update README install instruction

# BEFORE (local path β€” not usable externally):
bun add /path/to/MicroAI-Paygate/sdk/typescript

# AFTER (published npm package):
bun add @microai/paygate-sdk
# or
npm install @microai/paygate-sdk

4. Add CHANGELOG.md to sdk/typescript/ for semver tracking

Files to Create/Modify

File Change
.github/workflows/sdk-publish.yml New npm publish workflow
sdk/typescript/package.json Add files, exports, publishConfig
sdk/typescript/CHANGELOG.md New changelog for semver tracking
README.md Update SDK install instruction

Suggested labels: enhancement, sdk, developer-experience, level: intermediate

I would like to work on this. Could you please assign it to me?

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentationtriageNeeds maintainer triage.type:devopsDeployment, observability, operations, CI, or infrastructure work.type:docsDocumentation, API docs, examples, or contributor docs.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions