Cursor Rules Template: BI SaaS with Data Connectors, Charts, Dashboards, SQL Editor and AI Explanations
Copyable .cursorrules configuration page for Cursor AI: BI SaaS with data connectors, charts, dashboards, SQL editor and AI explanations.
Target User
Developers building BI SaaS using Cursor AI
Use Cases
- Connect external data sources via data connectors
- Build charts and dashboards
- Provide an interactive SQL editor for users
- Offer AI-generated explanations for queried data
- Enforce secure data access and auditing
Markdown Template
Cursor Rules Template: BI SaaS with Data Connectors, Charts, Dashboards, SQL Editor and AI Explanations
// Cursor rules configuration for BI SaaS
framework: 'Node.js (Express) + React (TypeScript) + PostgreSQL'
context: 'BI SaaS with data connectors, charts, dashboards, a SQL editor, and AI explanations using Cursor AI'
codeStyle: 'TypeScript, ESLint, Prettier'
architecture: 'Monorepo: apps/frontend, apps/backend, packages/connectors, packages/ui, libs/db'
authentication: 'JWT with access scopes; OAuth 2.0 for admin'
database: 'PostgreSQL; use pg with prepared statements; avoid string concatenation to prevent SQL injection'
orm: 'Use raw SQL via pg; optional lightweight ORM for simple models'
testingLinting: 'Jest for unit tests; Supertest for API tests; Playwright for E2E; ESLint + Prettier in CI'
antiPatterns: 'Do not interpolate user input into SQL; Do not bypass auth; Do not trust client data; Do not ship credentials; Do not expose raw secrets'Overview
Cursor rules configuration for our BI SaaS stack aligns Cursor AI with a modern data analytics platform. This template targets a Node.js (Express) backend, a React/TypeScript frontend, and PostgreSQL, with data connectors, charts, dashboards, a SQL editor, and AI explanations. The direct answer: paste the copyable .cursorrules block below into your project root to enforce consistent engineering and AI-assisted development for this stack.
When to Use These Cursor Rules
- Starting a BI SaaS project with data connectors and dashboard capabilities.
- Standardizing how AI explanations are generated for charts and queries.
- Enforcing architecture boundaries between frontend, backend, and connectors.
- Implementing secure data access, testing, and linting workflows from day one.
Copyable .cursorrules Configuration
// Cursor rules configuration for BI SaaS
framework: 'Node.js (Express) + React (TypeScript) + PostgreSQL'
context: 'BI SaaS with data connectors, charts, dashboards, a SQL editor, and AI explanations using Cursor AI'
codeStyle: 'TypeScript, ESLint, Prettier'
architecture: 'Monorepo: apps/frontend, apps/backend, packages/connectors, packages/ui, libs/db'
authentication: 'JWT with access scopes; OAuth 2.0 for admin'
database: 'PostgreSQL; use pg with prepared statements; avoid string concatenation to prevent SQL injection'
orm: 'Use raw SQL via pg; optional lightweight ORM for simple models'
testingLinting: 'Jest for unit tests; Supertest for API tests; Playwright for E2E; ESLint + Prettier in CI'
antiPatterns: 'Do not interpolate user input into SQL; Do not bypass auth; Do not trust client data; Do not ship credentials; Do not expose raw secrets'
Recommended Project Structure
my-bi-saas/
├── apps/
│ ├── frontend/ # React + TypeScript UI for dashboards, charts
│ └── backend/ # Node + Express API with SQL editor endpoints
├── packages/
│ ├── connectors/ # Data connectors to external sources
│ ├── ui/ # Shared UI components
│ └── db/ # DB schema and migrations
├── tests/
│ └── e2e/ # Playwright tests
└── scripts/ # CI/CD and tooling
Core Engineering Principles
- Explicit data access via parameterized queries and clear data access layers.
- Explicit boundaries between backend, frontend, and connectors.
- Cursor AI is an assistant; validate outputs before presenting to users.
- Security by default: least privilege, auditing, and RBAC at the API layer.
- CI/CD with lint, test, and build gates; deterministic builds.
- Typed contracts across services; avoid runtime type drift.
Code Construction Rules
- Use TypeScript end-to-end (frontend and backend).
- Frontend: React with typed components; UI for charts, dashboards, and SQL editor.
- Backend: Node.js + Express; expose REST endpoints for connectors and SQL editor features.
- PostgreSQL as the primary data store; parameterize all user inputs; avoid dynamic SQL creation.
- Data connectors implemented as services under packages/connectors with clear interfaces.
- Tests: unit tests for data transforms; integration tests for connectors; E2E tests for login, connectors, and SQL editor.
- Linting and formatting enforced via ESLint and Prettier in CI.
- Do not use full-ORMs that obscure SQL; prefer explicit SQL with a thin layer over pg.
Security and Production Rules
- JWTs with short expiry; rotate refresh tokens; validate scopes per endpoint.
- RBAC enforcement at backend for datasets and dashboards.
- TLS in transit; encryption at rest where applicable; secure DB access.
- Redact PII in logs; avoid leaking credentials; use environment-based secrets management.
- Rate limiting and input validation; guard data connectors against misuse.
- Audit trails for data exports and connector activity.
Testing Checklist
- Unit tests for data transformation and business rules.
- API tests for backend endpoints, including authentication and authorization.
- E2E tests for login, data connectors, chart creation, and SQL editor queries.
- Connector mocks for reliable CI; verify error handling and retry logic.
- Static type checks and linting in CI; ensure reproducible builds.
Common Mistakes to Avoid
- Overusing heavy ORMs that hide SQL and reduce visibility into queries.
- Exposing raw data or internal schema to the frontend without proper filtering.
- Skipping tests for data connectors or SQL execution paths.
- Weak authentication for admin connectors or data export endpoints.
- Inconsistent time zone handling in dashboards and SQL results.
- Not parameterizing SQL queries or not validating input on the backend.
Related Cursor rules templates
Explore adjacent Cursor rules templates for similar stacks, workflows, and production constraints.
- KPI Dashboard Builder — Cursor Rules Template for Cursor AI
- Cursor Rules Template — Real Estate Dashboard with Cash Flow, ROI, and Analytics
- Cursor Rules Template: Manufacturing Execution Dashboard (NestJS + PostgreSQL)
- Cursor Rules Template: Customer Success Platform with Health Scores, Renewals, NPS and AI Churn
FAQ
What is the Cursor Rules Template for BI SaaS?
This template defines Cursor AI rules for building a BI SaaS with data connectors, charts, dashboards, a SQL editor, and AI explanations. It provides explicit constraints, architecture boundaries, and recommended practices so developers can paste a copyable .cursorrules block into their project root and start coding with guidance.
Which stack does this template cover?
The template targets a Node.js (Express) backend, a React + TypeScript frontend, and PostgreSQL as the data store. It includes data connectors, a SQL editor component, charting, dashboards, and AI explanation features powered by Cursor AI.
How do I integrate data connectors and the SQL editor?
Connectors live in packages/connectors and expose a consistent interface for querying external sources. The SQL editor runs server-side queries via the backend API using parameterized SQL; all user input is validated and sanitized before execution.
How is security ensured in production?
Security is enforced by RBAC, token-based authentication, scoped access, TLS, encryption at rest, safe logging, and strict input validation. Data connectors are sandboxed, and audit trails capture connector usage and data access events.
How can I customize AI explanations in dashboards?
AI explanations are exposed via a dedicated service that analyzes query results and generates human-readable insights. You can tailor the explanation templates and confidence scoring per dataset, ensuring users receive relevant, explainable AI outputs.