Skip to Content
Living documentation — last reviewed 2026-05-28
FeaturesInsightsInsights — Code Map

Insights — Code Map

API

  • apps/api/src/insights/insights.module.ts
  • apps/api/src/insights/insights.controller.ts — single GET /organizations/:orgId/insights endpoint.
  • apps/api/src/insights/insights.service.tsgetOrgInsights(orgId) orchestrator, evalCancellationRequests, evalOutstandingDebt, evalAtRiskBilling, evalTasksOverdue.
  • apps/api/src/insights/insights.service.driver.ts — test driver.
  • apps/api/src/insights/insights.service.unit.spec.ts — rule unit tests.
  • apps/api/src/insights/insights.controller.unit.spec.ts — controller-level tests (auth, shape).

Agent surface

  • apps/api/src/ai/agent/tools/leaves/analytics.tools.tsorg_insights action delegates to InsightsService.getOrgInsights.

Web

  • apps/web/src/components/dashboard/insights-widget.tsx (and related) — renders the card grid. The frontend reads the i18n dictionary by id.

i18n

  • apps/web/src/i18n/{en,he,ru}.json under insight.<id>.{title,description}.

Schema

  • libs/db/src/lib/schema/payments.tssubscriptions, cancellation_requests, payment_transactions.
  • libs/db/src/lib/schema/memberships.tsmemberships.
  • libs/db/src/lib/schema/tasks.tstasks.
  • libs/db/src/lib/schema/users.tsusers (read for the at-risk sample).