The Problem
Frappe Insights addresses the gap between operational data in Frappe Framework apps and the reporting tools needed to extract value from it. Teams typically resort to hand-written SQL or external BI tools that require duplicating data. Insights provides a self-hosted BI layer that connects directly to existing databases—MySQL, PostgreSQL, DuckDB, BigQuery—with a visual query builder and dashboarding interface.
What This Does
This is a fork of frappe/insights (1006 stars upstream) with 544 files. The backend (insights/) is a Python/Frappe application that manages data sources, query execution, and user permissions. The frontend (frontend/src2/) is a Vue 3 + TypeScript SPA handling the query builder, chart configuration, and dashboard layout.
Key modules: insights_data_source_v3 manages database connections and query execution via Ibis; insights_table_v3 handles table metadata; frontend/src2/query/Query.vue is the visual query builder; frontend/src2/charts/ contains chart rendering and configuration components.
How It Is Wired
Execution starts in frontend/index.html → frontend/src2/main.ts, which mounts the Vue app. The frontend communicates with the Frappe backend through frontend/src2/helpers/resource.ts, which wraps Frappe's REST API. The backend entry points are Frappe doctypes—insights_data_source_v3 and insights_table_v3—that handle HTTP requests and route to ibis_utils.py for query compilation and execution.
The import graph shows 191 internal modules with 297 edges. Three hubs carry the widest blast radius:
frontend/src2/helpers/index.ts— imported by 16 modules, exports shared utilitiesinsights/utils— imported by 14 modules, backend helpersinsights/insights/doctype/insights_table_v3/insights_table_v3— imported by 14 modules
All three sit inside circular dependency cycles, along with frontend/src2/charts/chart.ts and frontend/src2/query/query.ts. Breaking these cycles requires extracting shared types or deferring imports; the cost of not doing so is that changes to any hub ripple unpredictably.
How To Use It
Setup: The repo has pyproject.toml (Python backend) and frontend/package.json (Vue frontend). Docker Compose exists at docker/docker-compose.yml. The README documents production deployment via Frappe's easy-install script:
wget https://frappe.io/easy-install.py
python3 ./easy-install.py deploy --project=insights_prod_setup
Configuration: Backend configuration follows Frappe conventions (site config in sites/). Frontend uses Vite with config at frontend/vite.config.js; environment variables go in frontend/.env. No custom env vars are documented in the repo.
Running it: For development, the backend runs as a Frappe bench app; the frontend runs via yarn dev in frontend/. Neither command is documented in the README, so exact flags are not verifiable from this repo alone.
Real-World Use
A typical deployment: a Frappe ERPNext instance plus a PostgreSQL analytics database. Insights connects to both as data sources, builds a query joining Sales Order and Payment Entry tables, and publishes a dashboard showing revenue by region. Non-technical users interact with the dashboard without SQL access to production data.
Code Health & Issues
Static analysis found 187 issues (88 high, 99 medium) across 5 categories. The most significant:
- High - Import cycles (18 instances):
frontend/src2/helpers/index.ts,insights/insights/doctype/insights_table_v3/insights_table_v3.jsand.pyparticipate in circular imports. Fix: extract shared types or invert dependencies. - High - Deep nesting (21 instances):
insights/insights/doctype/insights_table_v3/insights_table_v3.jsreaches indentation depth 11. Fix: early returns and guard clauses. - Medium - Broad exception handling (11 instances):
insights_table_v3.py,insights_data_source_v3.pycatchExceptionindiscriminately. Fix: catch specific exceptions. - Medium - Oversized files (2 instances):
ibis_utils.pyanddata_warehouse.pyexceed 900 lines each. - Medium - Hub modules (8 instances):
frontend/src2/helpers/index.tshas 16 dependents.
The 9-item security audit flags two high-severity issues: unpinned GitHub Actions (docker/setup-qemu-action@v3, etc.) and CI workflows that never invoke the 36 test files. Medium issues include missing token permissions, no Dependabot, no dependency vulnerability scanning, a 6.1MB preview.gif in git, and a postinstall script in package.json. 16 of 40 declared dependencies are multiple major versions behind current.
The Bottom Line
Frappe Insights is a functional BI tool with a solid feature set and active upstream maintenance, but this fork carries real technical debt: circular imports, oversized backend modules, and CI that doesn't run its own tests. It's suitable for teams already on Frappe who need embedded analytics and can invest in addressing the import cycles and CI gaps before relying on it in production.