Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Volcano SDK

CI License npm

The official JavaScript/TypeScript SDK for Volcano.

Installation

npm install @volcano.dev/sdk

Quick Start

import { VolcanoAuth } from '@volcano.dev/sdk';

const volcano = new VolcanoAuth({
  apiUrl: 'https://api.yourproject.volcano.dev',
  anonKey: 'your-anon-key',
});

// Authentication
const { user } = await volcano.auth.signIn({
  email: 'user@example.com',
  password: 'password123',
});

// Database queries
volcano.database('my-database');
const { data } = await volcano
  .from('posts')
  .select('*')
  .eq('published', true)
  .order('created_at', { ascending: false });

// File storage
const { data: file } = await volcano.storage.from('uploads').upload('photo.jpg', imageFile);

// Backend leader election (initialize accessToken with a service-role key)
const lockResult = await volcano.locks.withLock('daily-rollup', { ttl: 30 }, async ({ signal }) => {
  await runRollup({ signal });
});
if (lockResult.error) throw lockResult.error;

// Realtime subscriptions
import { VolcanoRealtime } from '@volcano.dev/sdk/realtime';

const realtime = new VolcanoRealtime({
  apiUrl: 'https://api.yourproject.volcano.dev',
  anonKey: 'your-anon-key',
  accessToken: volcano.accessToken,
});

await realtime.connect();
const channel = realtime.channel('updates', { type: 'postgres' });
channel.onPostgresChanges('INSERT', 'public', 'posts', (change) => {
  console.log('New post:', change.record);
});
await channel.subscribe();

For browser realtime connections, make sure the browser app's origin is allowed in your project's auth CORS settings. The anonymous key is used to identify the project before the WebSocket upgrade completes.

Documentation

Guide Description
Getting Started Installation and setup
Authentication Sign-up, sign-in, OAuth, sessions
Database Query builder and CRUD operations
Storage File upload and management
Realtime Live subscriptions and presence
Functions Serverless function invocation
Project locks Renewable backend leases
Next.js Server components and middleware
TypeScript Type definitions
Error Handling Error patterns

Contributing

See CONTRIBUTING.md for local workflows, package structure, and pull request expectations.

If you believe you have found a security vulnerability, do not open a public issue. Follow SECURITY.md instead.

License

Volcano SDK is licensed under the Apache License 2.0. See LICENSE.

About

JavaScript SDK for Volcano Hosting

Resources

Contributing

Security policy

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages