> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ibex.ajna.cloud/llms.txt
> Use this file to discover all available pages before exploring further.

# Ibex BI Backend

> Go-based metadata and API gateway for the BI UI.

# Ibex BI Backend

The `ibex-bi-backend` is a high-performance Go microservice managing the business intelligence metadata for the platform. It serves as the primary API for the user-facing dashboards.

## Architectural Role

Operating on port `8085`, this service is heavily exposed via Traefik under numerous paths like `/api/metadata`, `/api/dashboards`, `/api/charts`, and `/api/reports`. It sits explicitly between the `ajna_data_platform_ui_lib` (Frontend) and the `ibex-analytics-service` (Query Execution).

## High-Level Working

### Metadata Storage

Instead of relying on Postgres, the BI backend uses an isolated SQLite volume (`/data/ajna-bi-metadata.db`) for peak read performance. This database securely stores definitions for:

* Dashboards and Charts
* Custom Database Connections
* RAG Knowledge Base definitions
* User-created SQL Reports

### Authentication Gateway

Every request entering the BI backend flows through an authorization middleware. This middleware reaches out to the `ibex-identity-service` via `GET /validate` to ensure the attached JWT is valid and has not expired.

### Query Proxying

While the frontend interacts uniquely with the BI backend to request report data, this Go service does not execute SQL itself. It proxies valid, authorized queries down to the `ibex-analytics-service` and streams the JSON response back to the client.
