Cursor Rules TemplatesCursor Rules Template

Cursor Rules Template: Tutoring Centers Student Performance Dashboards

Cursor Rules Template for building student performance analytics dashboards for tutoring centers using Python FastAPI backend, PostgreSQL, and React frontend.

.cursorrules templatecursor rules templatecursor rulesCursor AItutoring centers dashboardstudent performance dashboardfastapipostgresqlsqlalchemyreact

Target User

Developers building tutoring-center dashboards with Cursor AI

Use Cases

  • Build a student performance analytics dashboard for tutors
  • Define metric calculations and cohort filters
  • Enforce data access controls and audit trails
  • Automate data ingestion pipelines for dashboard freshness

Markdown Template

Cursor Rules Template: Tutoring Centers Student Performance Dashboards

Overview


Direct answer: This Cursor rules configuration provides a complete, copyable set of Cursor AI instructions to build and maintain student performance analytics dashboards for tutoring centers. It targets a Python FastAPI backend with SQLAlchemy ORM, PostgreSQL as the data store, and a React frontend. It enforces secure data access, consistent data modeling, and observable metrics.


The template is designed for Cursor AI integration in a full stack comprised of a FastAPI backend, PostgreSQL data layer, and a React user interface. It prioritizes metric correctness, data governance, and repeatable CI/CD workflows for analytics dashboards used by tutors and admins.


When to Use These Cursor Rules



- When you need consistent student-performance metrics across multiple tutoring centers.

- When you require role-based access to sensitive student data via JWT/OAuth2 guards.

- When you want a clear separation between data modeling (ORM) and business logic (services).

- When you want to automate tests, linting, and API contract verification in CI/CD.

- When you need a reproducible project structure suitable for rapid dashboard iteration.


Copyable .cursorrules Configuration


Framework Role & Context
You are Cursor AI configured to assist in building a tutoring-centers student performance analytics dashboard. Stack: Python 3.11, FastAPI backend, SQLAlchemy ORM, PostgreSQL, React frontend. Ensure data integrity, auditability, and secure access controls. Output should be actionable, code-ready, and placement-ready for project root.

Code Style and Style Guides
Follow PEP8, Black formatting, and isort for imports. Use type hints (from typing import List, Optional) and Pydantic models for input validation. Document endpoints and data models with docstrings. Do not mix frontend and backend concerns; maintain a clean separation of concerns.

Architecture & Directory Rules
Backend: FastAPI-based API layer with services separating business logic. ORM models under backend/app/models, schemas under backend/app/schemas, and API routes under backend/app/api. Frontend: React-based UI under frontend/src with components, pages, and hooks. Database: PostgreSQL accessed via SQLAlchemy ORM.

Authentication & Security Rules
Use OAuth2PasswordBearer or JWT-based tokens. Do not embed secrets in code. Validate requests with dependency injection. Enforce least privilege: users access only allowed metrics and resources. Rotate secrets and use environment variables.

Database and ORM patterns
Define clear SQLAlchemy models for Student, Center, Course, Session, Assessment, and Metrics. Use relationships for joins and lazy loading. Implement repository/services pattern for data access; avoid raw SQL in business logic. Use migrations (Alembic) for schema changes.

Testing & Linting Workflows
Unit tests with pytest, API tests with httpx, and integration tests for data access. Lint with flake8/ruff. Run tests on CI; require green builds before deployment. Include test fixtures for sample centers, students, and metrics.

Prohibited Actions and Anti-patterns for the AI
Do not generate SQL via string concatenation; avoid N+1 query patterns; do not bypass authentication; do not access secrets; avoid hard-coding production URLs in code. Do not generate monolithic endpoints; prefer paginated, filtered queries.
Recommended Project Structure


tutoring-dashboard/
  backend/
    app/
      main.py
      api/
      core/
      models/
      schemas/
      services/
    tests/
    requirements.txt
  frontend/
    src/
      components/
      pages/
      hooks/
    package.json
    vite.config.js
Core Engineering Principles



- Explicit data contracts between backend APIs and frontend components.

- Strong typing and schema validation with Pydantic and SQLAlchemy models.

- Secure defaults: authentication, authorization, and secrets management.

- Separation of concerns: data access, business logic, and presentation.

- Observability: metrics, logs, and tracing for dashboard queries.

- Test-driven approach: unit, integration, and end-to-end tests.

- Deterministic deployments with CI/CD and migrations.


Code Construction Rules



- Use SQLAlchemy ORM for all data access; avoid raw SQL unless necessary and parameterize every query.

- Define explicit Pydantic models for request/response data shapes.

- Place business logic in services; keep API routes thin.

- Store credentials and secrets in environment variables; load via pydantic settings.

- Ensure idempotent data ingestion pipelines and idempotent API endpoints where appropriate.

- Do not bypass authentication or perform privilege escalation in endpoints.

- Write tests that cover common and edge-case metric calculations.


Security and Production Rules



- Implement JWT-based authentication with short-lived tokens and secure storage.

- Validate inputs; sanitize outputs to prevent leakage of sensitive data.

- Use parameterized queries to avoid SQL injection.

- Limit API rate and enforce proper CORS configurations for front-end.

- Enable HTTPS in production; log security events and rotate keys regularly.


Testing Checklist



- Unit tests for models and utility functions.

- Integration tests for API endpoints with a test database.

- Data integrity tests for key metrics (averages, trends, cohorts).

- UI smoke tests for critical dashboards.

- CI checks: lint, type checks, unit tests, and migration integrity.


Common Mistakes to Avoid



- Mixing data access with business logic in endpoints.

- Ignoring data privacy requirements for student data.

- Hard-coding environment-specific values in code.

- Using non-exportable secrets or exposing database credentials in logs.

- Skipping migrations during schema changes, leading to drift.



Related implementation resources: AI Use Case for Test Prep Centers Using Excel To Analyze Mock Exam Scores and Pinpoint Individual Student Weaknesses.




FAQ


What is a Cursor rules template?


A Cursor rules template is a copyable configuration that guides Cursor AI in how to build, validate, and maintain a stack-specific set of rules for a project. It encodes roles, constraints, and workflows so the AI can produce consistent, safe, and operational outputs for a tutoring-centers analytics dashboard.


Which stack does this template cover?


This template targets a Python 3.11 backend with FastAPI and SQLAlchemy, PostgreSQL as the data store, and a React frontend. It integrates Cursor AI with tooling for testing, linting, and deployment, ensuring secure access to student data.


How do I use this template in my project?


Copy the contained .cursorrules block into the project root as .cursorrules. The Cursor Editor will parse the rules and apply the framework, architecture, and security constraints to your backend and frontend components.


What security considerations are included?


The template enforces JWT-based authentication, role-based access, and parameterized queries. Secrets reside in environment variables with proper rotation and auditing, reducing the risk of credential leakage in dashboards.


What metrics can I customize for tutoring centers?


Metrics focus on student progress, session frequencies, course completions, average scores, and attendance patterns. The rules guide metric calculations, cohort filters, and data transformations to ensure accurate dashboards and actionable insights.

Overview

Direct answer: This Cursor rules configuration provides a complete, copyable set of Cursor AI instructions to build and maintain student performance analytics dashboards for tutoring centers. It targets a Python FastAPI backend with SQLAlchemy ORM, PostgreSQL as the data store, and a React frontend. It enforces secure data access, consistent data modeling, and observable metrics.

The template is designed for Cursor AI integration in a full stack comprised of a FastAPI backend, PostgreSQL data layer, and a React user interface. It prioritizes metric correctness, data governance, and repeatable CI/CD workflows for analytics dashboards used by tutors and admins.

When to Use These Cursor Rules

  • When you need consistent student-performance metrics across multiple tutoring centers.
  • When you require role-based access to sensitive student data via JWT/OAuth2 guards.
  • When you want a clear separation between data modeling (ORM) and business logic (services).
  • When you want to automate tests, linting, and API contract verification in CI/CD.
  • When you need a reproducible project structure suitable for rapid dashboard iteration.

Copyable .cursorrules Configuration

Framework Role & Context
You are Cursor AI configured to assist in building a tutoring-centers student performance analytics dashboard. Stack: Python 3.11, FastAPI backend, SQLAlchemy ORM, PostgreSQL, React frontend. Ensure data integrity, auditability, and secure access controls. Output should be actionable, code-ready, and placement-ready for project root.

Code Style and Style Guides
Follow PEP8, Black formatting, and isort for imports. Use type hints (from typing import List, Optional) and Pydantic models for input validation. Document endpoints and data models with docstrings. Do not mix frontend and backend concerns; maintain a clean separation of concerns.

Architecture & Directory Rules
Backend: FastAPI-based API layer with services separating business logic. ORM models under backend/app/models, schemas under backend/app/schemas, and API routes under backend/app/api. Frontend: React-based UI under frontend/src with components, pages, and hooks. Database: PostgreSQL accessed via SQLAlchemy ORM.

Authentication & Security Rules
Use OAuth2PasswordBearer or JWT-based tokens. Do not embed secrets in code. Validate requests with dependency injection. Enforce least privilege: users access only allowed metrics and resources. Rotate secrets and use environment variables.

Database and ORM patterns
Define clear SQLAlchemy models for Student, Center, Course, Session, Assessment, and Metrics. Use relationships for joins and lazy loading. Implement repository/services pattern for data access; avoid raw SQL in business logic. Use migrations (Alembic) for schema changes.

Testing & Linting Workflows
Unit tests with pytest, API tests with httpx, and integration tests for data access. Lint with flake8/ruff. Run tests on CI; require green builds before deployment. Include test fixtures for sample centers, students, and metrics.

Prohibited Actions and Anti-patterns for the AI
Do not generate SQL via string concatenation; avoid N+1 query patterns; do not bypass authentication; do not access secrets; avoid hard-coding production URLs in code. Do not generate monolithic endpoints; prefer paginated, filtered queries.

Recommended Project Structure

tutoring-dashboard/
  backend/
    app/
      main.py
      api/
      core/
      models/
      schemas/
      services/
    tests/
    requirements.txt
  frontend/
    src/
      components/
      pages/
      hooks/
    package.json
    vite.config.js

Core Engineering Principles

  • Explicit data contracts between backend APIs and frontend components.
  • Strong typing and schema validation with Pydantic and SQLAlchemy models.
  • Secure defaults: authentication, authorization, and secrets management.
  • Separation of concerns: data access, business logic, and presentation.
  • Observability: metrics, logs, and tracing for dashboard queries.
  • Test-driven approach: unit, integration, and end-to-end tests.
  • Deterministic deployments with CI/CD and migrations.

Code Construction Rules

  • Use SQLAlchemy ORM for all data access; avoid raw SQL unless necessary and parameterize every query.
  • Define explicit Pydantic models for request/response data shapes.
  • Place business logic in services; keep API routes thin.
  • Store credentials and secrets in environment variables; load via pydantic settings.
  • Ensure idempotent data ingestion pipelines and idempotent API endpoints where appropriate.
  • Do not bypass authentication or perform privilege escalation in endpoints.
  • Write tests that cover common and edge-case metric calculations.

Security and Production Rules

  • Implement JWT-based authentication with short-lived tokens and secure storage.
  • Validate inputs; sanitize outputs to prevent leakage of sensitive data.
  • Use parameterized queries to avoid SQL injection.
  • Limit API rate and enforce proper CORS configurations for front-end.
  • Enable HTTPS in production; log security events and rotate keys regularly.

Testing Checklist

  • Unit tests for models and utility functions.
  • Integration tests for API endpoints with a test database.
  • Data integrity tests for key metrics (averages, trends, cohorts).
  • UI smoke tests for critical dashboards.
  • CI checks: lint, type checks, unit tests, and migration integrity.

Common Mistakes to Avoid

  • Mixing data access with business logic in endpoints.
  • Ignoring data privacy requirements for student data.
  • Hard-coding environment-specific values in code.
  • Using non-exportable secrets or exposing database credentials in logs.
  • Skipping migrations during schema changes, leading to drift.

Related implementation resources: AI Use Case for Test Prep Centers Using Excel To Analyze Mock Exam Scores and Pinpoint Individual Student Weaknesses.

FAQ

What is a Cursor rules template?

A Cursor rules template is a copyable configuration that guides Cursor AI in how to build, validate, and maintain a stack-specific set of rules for a project. It encodes roles, constraints, and workflows so the AI can produce consistent, safe, and operational outputs for a tutoring-centers analytics dashboard.

Which stack does this template cover?

This template targets a Python 3.11 backend with FastAPI and SQLAlchemy, PostgreSQL as the data store, and a React frontend. It integrates Cursor AI with tooling for testing, linting, and deployment, ensuring secure access to student data.

How do I use this template in my project?

Copy the contained .cursorrules block into the project root as .cursorrules. The Cursor Editor will parse the rules and apply the framework, architecture, and security constraints to your backend and frontend components.

What security considerations are included?

The template enforces JWT-based authentication, role-based access, and parameterized queries. Secrets reside in environment variables with proper rotation and auditing, reducing the risk of credential leakage in dashboards.

What metrics can I customize for tutoring centers?

Metrics focus on student progress, session frequencies, course completions, average scores, and attendance patterns. The rules guide metric calculations, cohort filters, and data transformations to ensure accurate dashboards and actionable insights.