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

@aaspai/sdk

v0.0.1

Published

Official JavaScript/TypeScript client for AASPAI Backend-as-a-Service platform

Readme

aaspai-sdk-js

npm version License

Official TypeScript/JavaScript SDK for AASPAI - A powerful, open-source Backend-as-a-Service (BaaS) platform.

Features

  • Authentication - Email/password, OAuth (Google, GitHub), session management
  • Database - Full PostgreSQL database access with PostgREST
  • Storage - File upload and management with S3-compatible storage
  • Edge Functions - Serverless function invocation
  • AI Integration - Built-in AI capabilities
  • TypeScript - Full TypeScript support with type definitions
  • Automatic OAuth Handling - Seamless OAuth callback detection

Installation

npm install @aaspai/sdk

Or with yarn:

yarn add @aaspai/sdk

Quick Start

Initialize the Client

import { createClient } from '@aaspai/sdk';

const aaspai = createClient({
  baseUrl: 'http://localhost:7130' // Your AASPAI backend URL
});

Authentication

// Sign up a new user
const { data, error } = await aaspai.auth.signUp({
  email: '[email protected]',
  password: 'securePassword123',
  name: 'John Doe' // optional
});

// Sign in with email/password
const { data, error } = await aaspai.auth.signInWithPassword({
  email: '[email protected]',
  password: 'securePassword123'
});

// OAuth authentication (Google, GitHub)
await aaspai.auth.signInWithOAuth({
  provider: 'google',
  redirectTo: 'http://localhost:3000/dashboard'
});

// Get current user
const { data: user } = await aaspai.auth.getCurrentUser();

// Get any user's profile by ID (public endpoint)
const { data: profile, error } = await aaspai.auth.getProfile('user-id-here');

// Update current user's profile (requires authentication)
const { data: updatedProfile, error } = await aaspai.auth.setProfile({
  displayName: 'John Doe',
  bio: 'Software developer',
  avatarUrl: 'https://example.com/avatar.jpg'
});

// Sign out
await aaspai.auth.signOut();

Database Operations

// Insert data
const { data, error } = await aaspai.database
  .from('posts')
  .insert([
    { title: 'My First Post', content: 'Hello World!' }
  ]);

// Query data
const { data, error } = await aaspai.database
  .from('posts')
  .select('*')
  .eq('author_id', userId);

// Update data
const { data, error } = await aaspai.database
  .from('posts')
  .update({ title: 'Updated Title' })
  .eq('id', postId);

// Delete data
const { data, error } = await aaspai.database
  .from('posts')
  .delete()
  .eq('id', postId);

File Storage

// Upload a file
const file = document.querySelector('input[type="file"]').files[0];
const { data, error } = await aaspai.storage
  .from('avatars')
  .upload(file);

// Download a file
const { data, error } = await aaspai.storage
  .from('avatars')
  .download('user-avatar.png');

// Delete a file
const { data, error } = await aaspai.storage
  .from('avatars')
  .remove(['user-avatar.png']);

// List files
const { data, error } = await aaspai.storage
  .from('avatars')
  .list();

Edge Functions

// Invoke an edge function
const { data, error } = await aaspai.functions.invoke('my-function', {
  body: { key: 'value' }
});

AI Integration

// Generate text completion
const { data, error } = await aaspai.ai.completion({
  model: 'gpt-3.5-turbo',
  prompt: 'Write a hello world program'
});

// Analyze an image
const { data, error } = await aaspai.ai.vision({
  imageUrl: 'https://example.com/image.jpg',
  prompt: 'Describe this image'
});

Documentation

For complete API reference and advanced usage, see:

Configuration

The SDK supports the following configuration options:

const aaspai = createClient({
  baseUrl: 'http://localhost:7130',  // Required: Your AASPAI backend URL
  storageStrategy: 'localStorage'     // Optional: 'localStorage' or 'memory' (default: 'localStorage')
});

TypeScript Support

The SDK is written in TypeScript and provides full type definitions:

import { createClient, AASPAIClient, User, Session } from '@aaspai/sdk';

const aaspai: AASPAIClient = createClient({
  baseUrl: 'http://localhost:7130'
});

// Type-safe API calls
const response: { data: User | null; error: Error | null } =
  await aaspai.auth.getCurrentUser();

Error Handling

All SDK methods return a consistent response format:

const { data, error } = await aaspai.auth.signUp({...});

if (error) {
  console.error('Error:', error.message);
  console.error('Status:', error.statusCode);
} else {
  console.log('Success:', data);
}

Browser Support

The SDK works in all modern browsers that support:

  • ES6+ features
  • Fetch API
  • LocalStorage (for session management)

For Node.js environments, ensure you're using Node.js 18 or higher.

Contributing

We welcome contributions! Please see our Contributing Guide for details.

Development Setup

# Clone the repository
git clone https://github.com/AASPAI/aaspai-sdk-js.git
cd aaspai-sdk-js

# Install dependencies
npm install

# Build the SDK
npm run build

# Run tests
npm test

# Run integration tests
npm run test:integration

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

Community & Support

Related Projects

  • AASPAI - The main AASPAI backend platform
  • AASPAI MCP - Model Context Protocol server for AASPAI

Built with ❤️ by the AASPAI team