SDK Overview
The Taruvi SDK provides official client libraries for Python and JavaScript/TypeScript. Build applications faster with type-safe, developer-friendly APIs that handle authentication, data management, storage, functions, and more.
Available SDKs
| Language | Package | Version | Documentation |
|---|---|---|---|
| Python | taruvi | 0.1.6 | PyPI |
| JavaScript/TypeScript | @taruvi/sdk | 1.2.0 | npm |
Installation
- Python
- JavaScript/TypeScript
pip install taruvi
Requirements: Python 3.10 or higher
npm install @taruvi/sdk
Requirements: Node.js 18+ or modern browsers
Quick Example
- Python
- JavaScript/TypeScript
from taruvi import Client
# Initialize client (api_url and app_slug are required)
client = Client(
api_url="https://api.taruvi.cloud",
app_slug="my-app"
)
# Authenticate (returns a NEW client instance — immutable pattern)
auth_client = client.auth.signInWithPassword(
username="alice@example.com",
password="secret123"
)
# Query database (returns {"data": [...], "total": N})
result = auth_client.database.from_("users").filter("status", "eq", "active").execute()
users = result["data"]
# Upload file
auth_client.storage.from_("documents").upload(
files=[("report.pdf", open("report.pdf", "rb"))],
paths=["uploads/report.pdf"]
)
# Execute function
result = auth_client.functions.execute("send-email", params={"user_id": 123})
# Manage users
user = auth_client.users.get("alice")
# Check authorization policies
allowed = auth_client.policy.get_allowed_actions(
{"kind": "datatable", "id": "orders"}
)
# Execute analytics queries
stats = auth_client.analytics.execute("monthly-revenue", params={"year": "2024"})
# Get app settings and roles
settings = auth_client.app.settings()
roles = auth_client.app.roles()
import { Client, Database, Storage, Functions } from '@taruvi/sdk'
// Initialize client
const client = new Client({
apiKey: "site-api-key",
appSlug: "my-app",
baseUrl: "https://api.taruvi.cloud"
})
// Query database
const db = new Database(client)
const users = await db.from("users").filter({ status: "active" }).execute()
// Upload file
const storage = new Storage(client)
await storage.from("documents").upload({
files: [file],
paths: ["uploads/report.pdf"]
}).execute()
// Execute function
const functions = new Functions(client)
const result = await functions.execute("send-email", { params: { user_id: 123 } })
Why Use the SDK?
- ✅ Type-Safe: Full TypeScript and Python type hints for IDE autocomplete
- ✅ Auto Authentication: Handles JWT tokens, API keys, session tokens, and username/password login
- ✅ Error Handling: Comprehensive exception hierarchy with clear messages
- ✅ Performance: Connection pooling, automatic retries, efficient HTTP clients (httpx)
- ✅ Sync & Async: Native sync (default) and async modes — no
asyncio.run()wrappers - ✅ Consistent APIs: Clean, intuitive interfaces across all modules
Available Modules (Python)
| Module | Access | Description |
|---|---|---|
database | client.database | Query builder, CRUD, edges, aggregations, graph traversal |
functions | client.functions | Execute functions, async execution, get results |
storage | client.storage | File upload/download, bucket management, copy/move |
auth | client.auth | Sign in/out, token management, current user |
users | client.users | User CRUD, role assignment/revocation |
secrets | client.secrets | Secret retrieval, batch get, filtered listing |
policy | client.policy | Cerbos authorization checks, filter allowed resources |
analytics | client.analytics | Execute analytics queries |
app | client.app | App roles and settings |
settings | client.settings | Site metadata |
Next Steps
Community & Support
- GitHub: Report bugs or request features
- Python SDK: taruvi-python-sdk
- JavaScript SDK: taruvi-js-sdk
- Documentation: Browse comprehensive guides and tutorials
- Examples: Check out the Examples Cookbook