npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@phala/cloud

v0.2.2

Published

TypeScript SDK for Phala Cloud API

Readme

Phala Cloud JavaScript SDK

TypeScript SDK for Phala Cloud API.

Installation

# Using npm
npm install @phala/cloud

# Using yarn
yarn add @phala/cloud

# Using pnpm
pnpm add @phala/cloud

# Using bun
bun add @phala/cloud

Usage

Basic Usage

import { createClient } from '@phala/cloud';

// Create client with API key
const client = createClient({
  apiKey: 'your-api-key',
  // Optional: override base URL
  // baseURL: 'https://custom-api.example.com'
});

// Make API requests
const result = await client.get('/kms');
console.log(result);

// Using safe methods that return a SafeResult
const safeResult = await client.safeGet('/kms');
if (safeResult.success) {
  console.log('Success:', safeResult.data);
} else {
  console.error('Error:', safeResult.error);
}

Environment Variables

You can configure the client using environment variables:

  • PHALA_CLOUD_API_KEY: API key for authentication
  • PHALA_CLOUD_API_PREFIX: Base URL prefix for the API
// Using environment variables (set PHALA_CLOUD_API_KEY)
const client = createClient();

Debug Logging

The SDK includes built-in debug logging that can display cURL-like request and response information. To enable it, set the DEBUG environment variable to phala::api-client:

# Enable debug logging
DEBUG=phala::api-client node your-script.js

# Or with bun
DEBUG=phala::api-client bun run your-script.ts

This will print detailed information about each API call in a format similar to cURL:

=== REQUEST ===
> curl -X GET "https://cloud-api.phala.network/api/v1/kms"
    -H "X-API-Key: your-api-key"
    -H "X-Phala-Version: 2025-05-31"
    -H "Content-Type: application/json"

=== RESPONSE [GET /kms] (123ms) ===
< HTTP/1.1 200 OK
< content-type: application/json
< x-response-time: 123

{
  "data": [
    {
      "id": "example-id",
      "name": "Example Key"
    }
  ]
}

Available Methods

Direct Methods (throw on error)

  • client.get<T>(request, options?): Promise<T>
  • client.post<T>(request, body?, options?): Promise<T>
  • client.put<T>(request, body?, options?): Promise<T>
  • client.patch<T>(request, body?, options?): Promise<T>
  • client.delete<T>(request, options?): Promise<T>

Safe Methods (return SafeResult)

  • client.safeGet<T>(request, options?): Promise<SafeResult<T>>
  • client.safePost<T>(request, body?, options?): Promise<SafeResult<T>>
  • client.safePut<T>(request, body?, options?): Promise<SafeResult<T>>
  • client.safePatch<T>(request, body?, options?): Promise<SafeResult<T>>
  • client.safeDelete<T>(request, options?): Promise<SafeResult<T>>

License

Apache-2.0