S
SaavanCloud
Sign InGet Started

Saavan Cloud Developer Reference

Architecture, endpoints, SDK guides, and compliance specifications for Saavan Cloud.

1. Quickstart Guide

Get up and running with Saavan Cloud in under 3 minutes.

# 1. Install the official TypeScript SDK
npm install @saavan/client-js

# 2. Connect to your project
import { createClient } from "@saavan/client-js";

const saavan = createClient({
  apiUrl: "http://localhost:8080", // or https://api.saavancloud.com
  apiKey: "YOUR_PROJECT_ANON_PUBLIC_KEY"
});

2. PostgreSQL 18 & Row-Level Security

Saavan Cloud maps relational tables to high-performance REST APIs via the Database Gateway (`/api/v1/data/:table`). Every query is strictly authorized against the calling project's Row-Level Security (RLS) policies.

// Insert record under project RLS role
const { data, error } = await saavan
  .from("tenant_documents")
  .insert({ name: "Q4 Roadmap", content: "Architecture Plan" });

// Query with filters
const { data: docs } = await saavan
  .from("tenant_documents")
  .select("*")
  .eq("name", "Q4 Roadmap");

3. Authentication & JWT Tokens

User authentication uses Argon2id password hashing (RFC 9106) and issues signed JWT access tokens with 15-minute expiration alongside rotating 30-day refresh tokens.

  • POST /api/v1/auth/signup — Register new developer account
  • POST /api/v1/auth/login — Authenticate credentials and receive token pair
  • POST /api/v1/auth/refresh — Rotate expired access tokens securely
  • GET /api/v1/auth/user — Verify claims and profile

4. S3 Object Storage

Create private and public buckets to store media, user uploads, and invoices with SHA-256 integrity verification.

// Upload file via JavaScript SDK
const file = new File(["Hello Saavan"], "hello.txt", { type: "text/plain" });

const { data: upload } = await saavan.storage
  .from("my-bucket")
  .upload("documents/hello.txt", file);

5. Real-Time WebSockets & CDC

Realtime CDC automatically detects database mutations in PostgreSQL and fans them out through NATS JetStream to WebSocket clients.

// Subscribe to live table updates over WebSocket
const channel = saavan
  .channel("tenant_documents")
  .on("postgres_changes", { event: "*" }, (payload) => {
    console.log("Database event:", payload);
  })
  .subscribe();

6. Indian GST Invoicing (SAC 998315)

Entering a GSTIN is strictly optional. Individual developers and unregistered businesses can subscribe and receive standard receipts without entering a GST number.

Registered Indian companies can provide their 15-digit GSTIN (e.g. 27AABCS1429B1ZB) to receive compliant tax invoices with Input Tax Credit (ITC) breakdown:

  • Intra-state (Maharashtra): CGST 9% + SGST 9%
  • Inter-state (All other states): IGST 18%
  • SAC Code: 998315 (Hosting and IT Infrastructure Provisioning Services)