Self-hosted analytics for React Native Expo apps running inside your own Convex deployment: session tracking, custom events, screen views, and error reporting w
npm install @sprout-convex/analyticsSprout Analytics is a Convex component that adds session tracking, custom event tracking, screen tracking, user identification, and error capture to React Native Expo apps without any external ingestion service or third-party database. It ships an Expo SDK, a Convex component with batched HTTP ingest, sharded rollup counters, and fingerprinted error issues, plus a CLI that wires everything into an existing Convex and Expo project in one command. Your analytics data stays entirely within your own Convex deployment.
Sprout Analytics provides an Expo SDK and a Convex component that wires directly into an existing Convex and Expo project. Running bunx sprout init generates the component mount, HTTP ingest route, write key, and root layout hooks in one pass. The SDK exports track, screen, identify, and captureException, all backed by an offline-durable queue that retries with exactly-once delivery.
Sprout Analytics captures uncaught JS errors and fatal exceptions automatically after initSprout runs, and exposes captureException for errors your code catches explicitly. Errors are fingerprinted into issues with open, resolved, and ignored workflow states, breadcrumbs, and stack traces, all stored inside your own Convex deployment with no data sent to external services.
Sprout Analytics manages session boundaries automatically using AppState listeners, starting a new session after a configurable foreground gap (default 30 minutes). The useSproutScreenTracking hook placed in your expo-router root layout autocaptures navigation events as screen views, and the screen function is available for manual calls when a view does not correspond to a route change.
Sprout Analytics bundles a prebuilt dashboard UI into the published package. Running bunx sprout dashboard from your project root serves the dashboard on http://127.0.0.1:4321, reading your Convex URL from .env or .env.local and prompting for the app slug and dashboard key if they are not set as environment variables. No separate hosting or deployment is needed.
No. Sprout Analytics runs entirely inside your own Convex deployment. The Expo SDK batches and sends events to an HTTP ingest endpoint you register on your own Convex site URL, and all data is stored in your Convex database. No third-party ingestion service is involved.
The Sprout Analytics SDK maintains an offline-durable event queue backed by AsyncStorage. Events that cannot be flushed immediately are persisted locally and retried with exactly-once delivery semantics. The queue survives app kills and is picked up again on the next initSprout call, with configurable batch size, queue size, and flush interval.
Sprout Analytics requires an existing Expo app with Convex already configured and npx convex dev working. It also requires expo-router for automatic screen autocapture, and expo-device, expo-constants, and @react-native-async-storage/async-storage, which are standard in a typical Expo project. Manual screen tracking with the screen function still works without expo-router.
The sprout init CLI command handles the wiring automatically: it mounts the Sprout component in convex/convex.config.ts using app.use, registers a POST /sprout/ingest route in convex/http.ts via Sprout.registerRoutes, generates a write key, and adds initSprout and useSproutScreenTracking to the Expo root layout. Any step it cannot automate is printed as a code snippet to apply manually.
The Sprout dashboard is designed to run on localhost and is protected only by a shared dashboard key, not per-user authentication. The sprout dashboard command warns before binding to any address other than 127.0.0.1, and the README explicitly recommends keeping it on localhost. It is intended as a local developer tool, not a hosted shared service.