Client Libraries
Overview
Cloudillo provides a comprehensive set of TypeScript/JavaScript client libraries for building applications. These libraries handle authentication, API communication, real-time synchronization, and React integration.
Available Libraries
@cloudillo/core
Core SDK for initialization and API access. This is the foundation for all Cloudillo applications.
Key Features:
- App initialization via message bus (
getAppBus()) - Type-safe REST API client
- URL helper functions
- Storage, settings, and media picker APIs
- Camera, document embedding, and CRDT cache management
Install:
@cloudillo/react
React hooks for Cloudillo integration.
Key Features:
useAuth()hook for authentication state (returns tuple)useApi()hook for API client access (returns object)useCloudillo()hook for microfrontend initializationuseCloudilloEditor()hook for CRDT editorsuseInfiniteScroll()hook for pagination
Install:
@cloudillo/types
Shared TypeScript types with runtime validation using @symbion/runtype.
Key Features:
- All data types (Profile, Action, File, etc.)
- Runtime type validation
- Compile-time type safety
- Action type enums
- Type guards and validators
Install:
@cloudillo/rtdb
Real-time database client with Firebase-like API.
Key Features:
- Firebase-like API (familiar to developers)
- Real-time subscriptions
- Type-safe queries
- Batch operations
Install:
@cloudillo/crdt
CRDT document synchronization using Yjs with WebSocket transport.
Key Features:
openYDoc()for collaborative document editing- WebSocket-based Yjs synchronization
- Offline caching and persistence support
Install:
@cloudillo/canvas-tools
React components and hooks for interactive object manipulation in SVG canvas applications.
Key Features:
- Transform gizmo with rotation, scaling, and positioning
- Rotation and pivot handle components
- Gradient picker with presets
- Coordinate and geometry utilities
Install:
@cloudillo/fonts
Font metadata and pairing suggestions for typography systems.
Key Features:
- Curated metadata for 22 Google Fonts
- Pre-defined font pairings (heading + body combinations)
- Helper functions for filtering by category and role
- Full TypeScript support
Install:
Quick Comparison
| Library | Purpose | Use When |
|---|---|---|
| @cloudillo/core | Core functionality | Every app |
| @cloudillo/react | React integration | Building React apps |
| @cloudillo/types | Type definitions | TypeScript projects |
| @cloudillo/crdt | CRDT document sync | Collaborative editing |
| @cloudillo/rtdb | Real-time database | Need structured real-time data |
| @cloudillo/canvas-tools | SVG canvas manipulation | Building drawing/design apps |
| @cloudillo/fonts | Font metadata and pairings | Typography selection UI |
Installation
Minimal Setup (vanilla JS)
React Setup
Full Setup (with real-time features)
Basic Usage
With @cloudillo/core
With @cloudillo/react
With @cloudillo/rtdb
Common Patterns
Pattern 1: Authentication Flow
Pattern 2: API Requests
Pattern 3: Real-Time CRDT
Pattern 4: React Integration
TypeScript Support
All libraries are written in TypeScript and provide full type definitions.
Error Handling
API errors are thrown as standard errors with status codes:
Library Details
Explore each library in detail:
- @cloudillo/core - Core SDK and API client
- @cloudillo/react - React hooks
- @cloudillo/types - TypeScript type definitions
- @cloudillo/crdt - CRDT document synchronization
- @cloudillo/rtdb - Real-time database client
- @cloudillo/canvas-tools - SVG canvas manipulation tools
- @cloudillo/fonts - Font metadata and pairing suggestions
Next Steps
- Getting Started - Build your first app
- REST API - API endpoint reference
- WebSocket API - Real-time features
- CRDT - Collaborative editing