B2H BaaS

B2H BaaS Documentation

Welcome to the B2H BaaS platform documentation. B2H BaaS provides a Firebase-like backend-as-a-service with PostgreSQL, real-time updates, and multi-tenant support.

What is B2H BaaS?

B2H BaaS is a complete backend solution that handles:

  • Database - PostgreSQL with automatic schema detection
  • Authentication - Email/password and OAuth providers
  • Real-time - WebSocket subscriptions with LISTEN/NOTIFY
  • Storage - File uploads with bucket organization
  • Security - Declarative access rules per collection
  • Webhooks - Trigger external services on data changes

Quick Links

Installation

npm install @baas/js-sdk

Initialize the SDK

import BaasClient from '@baas/js-sdk';

const client = new BaasClient({
  apiBase: 'https://api.b2h.app',
  projectId: 'your-project-id'
});

Basic Usage

// Get a collection
const users = client.collection('users');

// Add a document
const docRef = await users.add({ name: 'John', email: 'john@example.com' });

// Query documents
const results = await users.list({ name: 'John' });

// Real-time updates
const unsubscribe = users.onSnapshot((data) => {
  console.log('Data changed:', data);
});