KBAISE/ for lovable
Library
Docs

Connect your app to Cube

about 10 minBuildingchecked 9d agoOfficial page
The short version

Connect your Lovable app to Cube to display metrics and dashboards defined by your data team. Cube handles the database queries and calculations so your app reads consistent business numbers.

Anyone who wants to display data warehouse metrics or build reporting dashboards in Lovable using pre-defined metric models.

Do this, in order

  1. 1

    Get your Cube deployment host without 'https://' and copy your CUBEJS_API_SECRET from your Cube Cloud settings or environment variables.

    Lovable needs the host to send requests and the secret to continuously create authorized access tokens.

  2. 2

    Go to Connectors in your Lovable dashboard, select Cube, and click Connect.

    This opens the connection configuration form.

  3. 3

    Choose 'Connect with your API secret', paste your deployment host and API secret, and optionally add a JSON security context under Advanced settings if your data model restricts access by tenant or role.

    This provides the required credentials and configures data access rules for the connection.

  4. 4

    Set sharing permissions (keep it private or share with your workspace) and click Connect.

    Lovable will verify the connection by reading your Cube data model.

  5. 5

    Open your Lovable project chat and ask Lovable to link your project to the Cube connection.

    Your app must be linked to the connection before it can run queries against your data model.

Paste this into your project

Connect to our Cube data model and build an interactive company metrics dashboard. Fetch the available measures and views, display monthly revenue and total order count over the past 12 months in charts, and provide a status filter dropdown to refine the numbers.

Words decoded

Cube
An analytics platform that sits between your database and your apps to provide a single, consistent definition of business metrics.
Semantic layer
A shared dictionary of metric definitions (like 'monthly revenue') so every report calculates the number the exact same way.
Measure
A quantitative business metric that can be calculated or aggregated, such as revenue, count of orders, or active users.
Dimension
A category or grouping used to break down measures, like country, product category, or month.
Security context
Extra metadata sent with queries (like a customer ID or user role) that tells Cube which data rows to show or hide.

Where people get stuck

  • Do not paste your Cube API secret or token into the chat prompt or app code; enter it only in the secure connector setup form.
  • Do not rely on the security context for access control if your Cube deployment has CUBEJS_DEV_MODE=true enabled, as it bypasses security checks.
  • Remember that all users of your published app share the single security context configured on the connection.
  • If using an API token instead of the API secret, tokens that expire in under 7 days will be rejected, and queries will break whenever the token expires.

The short version, steps, decoder and prompt on this page are written automatically from Lovable's own documentation and can lag or misread it. The official page is always the authority.