API Reference
Complete API documentation for React hooks and storage adapters.
Comprehensive documentation for all honolytics APIs, organized by functionality.
React Hooks API
React hooks for building analytics dashboards with caching, polling, and error handling.
- Core Hooks —
useAnalytics,HonolyticsProvider, anduseConfig - Metric Slice Hooks —
useTotals,useTimeseries,useTopPages, etc. - Hook Types & Behaviors —
THookResponse, caching, and polling behavior
Storage API
Storage adapters for persisting analytics data without external APIs.
- Local Storage — Browser localStorage adapter ✅ Production Ready
- IndexedDB — Browser IndexedDB adapter ✅ Production Ready
- PostgreSQL — PostgreSQL database adapter ⚠️ Needs Testing
- Turso — Turso SQLite adapter ⚠️ Needs Testing
- SQLite — SQLite adapter ❌ Not Implemented
- Storage Types & Interface —
TAdapter,TEvent, and type definitions
Quick Reference
Basic Usage
import { HonolyticsProvider, useAnalytics } from 'honolytics'
// HTTP Mode
<HonolyticsProvider apiKey="key" endpoint="/api/metrics">
<App />
</HonolyticsProvider>
// Storage Mode
<HonolyticsProvider storageMode={true}>
<App />
</HonolyticsProvider>
// In components
const { data, loading, error, refetch } = useAnalytics()Storage Setup
import { initStorage, local, postgres } from 'honolytics/storage'
// Browser storage
await initStorage(local())
// Database storage
await initStorage(postgres({ url: 'postgresql://...' }))Implementation Status
| Component | Status | Notes |
|---|---|---|
| React Hooks | ✅ Complete | Full implementation with caching, polling, error handling |
| Local Storage | ✅ Complete | Production-ready browser storage |
| IndexedDB | ✅ Complete | Production-ready browser database |
| PostgreSQL | ⚠️ Partial | Implementation complete, needs testing |
| Turso | ⚠️ Partial | Implementation complete, needs testing |
| SQLite | ❌ Stub | Requires better-sqlite3 dependency |
| Backend API | ❌ Missing | No /metrics endpoint implementation |
| Tracking SDK | ❌ Missing | No event tracking implementation |