Typical architectures
Embedding analytics with Toucan AI is flexible and can fit a variety of product and infrastructure needs. Here are the most common architectural patterns for integrating analytics into your application.
1. Client-Side Embedding (Web Components/SDK)
How it works:
Your application loads Toucan AI’s web components (e.g.,
<tc-dashboard>,<tc-ai-assistant>) directly in the frontend.You generate a secure token (server-side) for each user/session.
The token is passed to the embedded component, which authenticates and loads the appropriate dashboards or assistants.
Best for:
SaaS products and web apps that want fast, interactive analytics with minimal backend changes.
Scenarios where user authentication and context are managed by your app.
Benefits:
Quick to implement.
Fully interactive and responsive.
Supports row-level security and user-specific data.
2. Backend-Driven Embedding (API Integration)
How it works:
Your backend communicates with Toucan AI’s API to generate tokens, manage user access, or fetch data.
The frontend uses these tokens to embed dashboards or assistants, or renders analytics data fetched from the API.
Best for:
Applications with complex authentication, multi-tenancy, or advanced data governance needs.
Scenarios where you want to pre-process or filter data before embedding.
Benefits:
Maximum control over data flow and security.
Easier to integrate with custom business logic or legacy systems.
3. Hybrid Approach
How it works:
Combines client-side embedding for interactivity with backend API calls for advanced use cases (e.g., custom data transformations, audit logging, or dynamic token generation).
Best for:
Products that need both rapid embedding and deep integration with backend systems.
Security & Deployment Considerations
Token Generation: Always generate tokens server-side to protect your API keys and enforce security.
Row-Level Security: Use token attributes to restrict data access per user or tenant.
Branding & Theming: Embedded components can be styled to match your application’s look and feel.
Deployment: Toucan AI supports both SaaS and self-hosted deployments (Docker, Helm).
Example Architecture Diagram

Choose the architecture that best fits your product’s needs—Toucan AI is designed to be flexible, secure, and easy to integrate.
Last updated
