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

@camposcloud/sdk

v1.1.4

Published

camposcloud-sdk is a TypeScript SDK for interacting with the CamposCloud API, providing methods to manage applications, users, and more.

Readme

CamposCloud SDK

A TypeScript/JavaScript SDK for interacting with the CamposCloud API. This SDK provides a simple and intuitive way to manage applications, upload files, and perform various operations on the CamposCloud platform.

You can see the full API documentation at API Docs.

Installation

npm install @camposcloud/sdk

Getting Started

First, you need to obtain an API token from your CamposCloud dashboard. Then initialize the SDK:

import CamposCloudSDK from '@camposcloud/sdk';

const api = new CamposCloudSDK({ 
    apiToken: "your-api-token-here" 
});

Basic Usage

Get User Information

const main = async () => {
    try {
        const me = await api.getMe();
        console.log(`Hello ${me.name} 👋`);
    } catch (error) {
        console.error('Error fetching user data:', error);
    }
}

main();

Methods

getMe()

Get information about the authenticated user.

const userInfo = await api.getMe();

Returns: UserData object containing user information.

getApplication({ appId })

Get details of a specific application.

const app = await api.getApplication({ appId: "your-app-id" });

Parameters:

  • appId (string): The ID of the application

Returns: Application instance

getApplications()

Get all applications for the authenticated user.

const result = await api.getApplications();
console.log(result.applications);
console.log(`Total RAM used: ${result.totalUsedRAM}`);

Returns: Object containing:

  • applications: Array of ApplicationResponseData
  • totalUsedRAM: String indicating total RAM usage
  • pagination: Pagination information

createApplication(data)

Create a new application.

import fs from 'fs';

const file = await fs.promises.readFile('path/to/your/app.zip');

const app = await api.createApplication({
    appName: "My App",
    file: file,
    mainFile: "index.js",
    memoryMB: 512,
    runtimeEnvironment: "nodejs",
});

Parameters:

  • appName (string): Name of the application
  • file (Buffer): ZIP file containing your application
  • mainFile (string): Entry point file (e.g., "index.js", "main.py")
  • memoryMB (number): Memory allocation in MB
  • runtimeEnvironment ("nodejs" | "python"): Runtime environment
  • exposedViaWeb (boolean, optional): Whether to expose via web
  • autoRestartEnabled (boolean, optional): Enable auto-restart
  • startupCommand (string, optional): Custom startup command
  • teamId (string, optional): Team ID if creating for a team

Returns: Application instance

deleteApplication({ appId })

Delete an application.

await api.deleteApplication({ appId: "your-app-id" });

startApplication({ appId })

Start an application.

const result = await api.startApplication({ appId: "your-app-id" });

stopApplication({ appId })

Stop an application.

const result = await api.stopApplication({ appId: "your-app-id" });

restartApplication({ appId })

Restart an application.

const result = await api.restartApplication({ appId: "your-app-id" });

uploadFile({ appId, file, path })

Upload a file to an application.

import fs from 'fs';

const file = await fs.promises.readFile('path/to/file.txt');
const result = await api.uploadFile({ 
    appId: "your-app-id", 
    file: file,
    path: "/optional/path" // Optional
});

Parameters:

  • appId (string): The application ID
  • file (Buffer): File content as Buffer
  • path (string, optional): Target path in the application

Application Class

When you get or create an application, you receive an Application instance with convenient methods:

const app = await api.getApplication({ appId: "your-app-id" });

// Application data
console.log(app.data);

// Control methods
await app.start(); // Start the application
await app.stop(); // Stop the application
await app.restart(); // Restart the application
await app.delete(); // Delete the application

// Download file
await app.downloadFile({ path: "path/to/file.txt" /* "path" is optional */ });

// Update application with new data
await app.update({
    appName: "My App",
    memoryMB: 512,
    runtimeEnvironment: "nodejs",
    startupCommand: "node index.js",
    environmentVariables: [{ key: "NODE_ENV", value: "production" }], // Optional
    exposedViaWeb: true, // Optional
    autoRestartEnabled: true, // Optional
    teamId: "your-team-id", // Optional
});

// Upload file directly to this application
import fs from 'fs';

const file = await fs.promises.readFile('path/to/file.txt');
await app.uploadFile(file, '/optional/path');

Application Methods

  • start(): Start the application
  • stop(): Stop the application
  • restart(): Restart the application
  • delete(): Delete the application
  • uploadFile(file: Buffer, path?: string): Upload a file to the application
  • downloadFile({ path?: string }): Download a file from the application
  • update(data: UpdateApplicationDataParams): Update the application with new data

Complete Example

import CamposCloudSDK from '@camposcloud/sdk';
import fs from 'fs';

const api = new CamposCloudSDK({ 
    apiToken: "your-api-token-here" 
});

const main = async () => {
    try {
        // Get user info
        const me = await api.getMe();
        console.log(`Hello ${me.name}!`);

        // Create an application
        const file = await fs.promises.readFile('my-app.zip');

        const app = await api.createApplication({
            appName: "My Node.js App",
            file: file,
            mainFile: "index.js",
            memoryMB: 256,
            runtimeEnvironment: "nodejs",
        });

        console.log(`Application created with ID: ${app.data._id}`);

        // Start the application
        await app.start();
        console.log('Application started!');

        // Upload additional file
        const configFile = await fs.promises.readFile('config.json');
        await app.uploadFile({ file: configFile, path: '/config' });

        console.log('Config file uploaded!');

        // Get all applications
        const apps = await api.getApplications();
        console.log(`You have ${apps.applications.length} applications`);
        
    } catch (error) {
        console.error('Error:', error);
    }
}

main();

Error Handling

The SDK throws errors for various conditions. Always wrap your API calls in try-catch blocks:

try {
    const app = await api.getApplication({ appId: "invalid-id" });
} catch (error: any) {
    if (error.response?.status === 404) {
        console.log('Application not found');
    } else {
        console.error('API Error:', error.message);
    }
}

TypeScript Support

This SDK is written in TypeScript and provides full type definitions. You'll get autocomplete and type checking out of the box:

import { ApplicationResponseData, UserData } from '@camposcloud/sdk';

// Types are automatically inferred
const user: UserData = await api.getMe();
const apps: ApplicationResponseData[] = (await api.getApplications()).applications;

Development

To contribute to this SDK:

# Clone the repository
git clone https://github.com/camposcloud/camposcloud-sdk

# Install dependencies
npm install

# Run tests
npm run test

# Build the project
npm run build

Support

License

This project is licensed under the ISC License.