Cursor Rules Templatestemplate

Retail Inventory Cursor Rules Template for Markdown Dashboards

Cursor Rules Template for building inventory markdown dashboards for retail chains using Cursor AI. Stack: Next.js/TypeScript frontend, Node.js API, PostgreSQL data store, with safe, testable rules.

.cursorrules templatecursor rules templateretail inventoryinventory dashboardsmarkdown dashboardsNext.jsTypeScriptPostgreSQLCursor AI rulesdata governanceretail analytics

Target User

Frontend and Backend developers building inventory markdown dashboards for retail chains with Cursor AI

Use Cases

  • Define a deterministic pipeline to render inventory dashboards in Markdown from SQL queries
  • Enforce data safety, redaction, and RBAC in Cursor AI outputs
  • Enable reproducible markdown dashboards for leadership and store operations

Markdown Template

Retail Inventory Cursor Rules Template for Markdown Dashboards

// Cursor Rules Template for Retail Inventory Dashboards
[Framework] Next.js (TypeScript) + Node.js API Routes
[Database] PostgreSQL
[Cache] Redis (optional)

Framework Role & Context:
You are Cursor AI assistant specialized in generating inventory markdown dashboards for retail chains. Your prompts must drive deterministic, testable outputs and safe data access. The environment is a Next.js frontend with a Node.js API layer and a PostgreSQL data store. All generated content should be markdown-ready for dashboards.

Code Style and Style Guides:
Use TypeScript, ESLint, and Prettier settings aligned with the repository. All code blocks must be valid TypeScript/SQL and safe to paste into the project. Ensure strong typing and explicit any usage avoidance.

Architecture & Directory Rules:
Root: .cursorrules and a dedicated directory structure under frontend and backend as described in the template. Do not create unnecessary folders. Keep data access isolated in the backend layer.

Authentication & Security Rules:
JWT-based session handling for API routes; avoid exposing secret keys. Use environment variables for secrets. Enforce RBAC: roles like admin, analyst, viewer.

Database and ORM patterns:
Use PostgreSQL with parameterized queries. No ORM is required for this template unless your stack uses one; if using an ORM, configure strict typings and query logging. Centralize SQL in a data access layer and avoid ad-hoc queries.

Testing & Linting Workflows:
Include unit tests for data access (mocked DB), integration tests for API routes, and end-to-end checks for markdown rendering. Run ESLint and Prettier in CI. Use Jest for unit tests and Playwright for end-to-end tests.

Prohibited Actions and Anti-patterns:
Do not embed secrets in code blocks. Do not rely on dangerous dynamic SQL without parameterization. Do not bypass authentication checks. Do not generate dashboards that surface PII without redaction.

Overview

The Cursor rules configuration is a structured, copyable set of guardrails and prompts that guide Cursor AI in producing inventory markdown dashboards for retail chains. This template targets a stack consisting of a Next.js/React frontend (TypeScript), a Node.js API layer, and a PostgreSQL data store. The rules ensure safe data access, deterministic rendering, and repeatable outputs suitable for leadership dashboards.

Directly use the contained .cursorrules block to bootstrap your project in a single paste at the project root.

When to Use These Cursor Rules

  • Building inventory, promotions, and markdown-based recommendations dashboards from PostgreSQL data.
  • Ensuring data access safety, redaction, and RBAC across the dashboard rendering pipeline.
  • Integrating Cursor AI into a Next.js/TypeScript project with a Node.js backend and Markdown rendering.

Copyable .cursorrules Configuration

// Cursor Rules Template for Retail Inventory Dashboards
[Framework] Next.js (TypeScript) + Node.js API Routes
[Database] PostgreSQL
[Cache] Redis (optional)

Framework Role & Context:
You are Cursor AI assistant specialized in generating inventory markdown dashboards for retail chains. Your prompts must drive deterministic, testable outputs and safe data access. The environment is a Next.js frontend with a Node.js API layer and a PostgreSQL data store. All generated content should be markdown-ready for dashboards.

Code Style and Style Guides:
Use TypeScript, ESLint, and Prettier settings aligned with the repository. All code blocks must be valid TypeScript/SQL and safe to paste into the project. Ensure strong typing and explicit any usage avoidance.

Architecture & Directory Rules:
Root: .cursorrules and a dedicated directory structure under frontend and backend as described in the template. Do not create unnecessary folders. Keep data access isolated in the backend layer.

Authentication & Security Rules:
JWT-based session handling for API routes; avoid exposing secret keys. Use environment variables for secrets. Enforce RBAC: roles like admin, analyst, viewer.

Database and ORM patterns:
Use PostgreSQL with parameterized queries. No ORM is required for this template unless your stack uses one; if using an ORM, configure strict typings and query logging. Centralize SQL in a data access layer and avoid ad-hoc queries.

Testing & Linting Workflows:
Include unit tests for data access (mocked DB), integration tests for API routes, and end-to-end checks for markdown rendering. Run ESLint and Prettier in CI. Use Jest for unit tests and Playwright for end-to-end tests.

Prohibited Actions and Anti-patterns:
Do not embed secrets in code blocks. Do not rely on dangerous dynamic SQL without parameterization. Do not bypass authentication checks. Do not generate dashboards that surface PII without redaction.

Recommended Project Structure

/inventory-dashboard
  /frontend
    /src
      /components
      /pages
      /dashboards
      /markdown
      /lib
      /styles
      tsconfig.json
  /backend
    /src
      /controllers
      /routes
      /db
      /services
      /migrations
  /data
    /migrations
    /seeders
  /tests
  /scripts

Core Engineering Principles

  • Declarative, typed rules to minimize ambiguity in Cursor AI outputs.
  • Single source of truth for inventory data and dashboard rendering.
  • Idempotent, reproducible instructions with clear data access boundaries.
  • Security-by-default with RBAC and token-based authentication.
  • Observability through structured logs and test coverage.

Code Construction Rules

  • TypeScript-first; define interfaces for data shapes used in dashboards.
  • Use parameterized SQL and a dedicated data-access layer; avoid raw string concatenation.
  • Markdown rendering must be deterministic and text-based; do not embed HTML in data fields.
  • Keep UI components pure and side-effect-free where possible.
  • Document every data transformation in code comments and update the cursor rules accordingly.

Security and Production Rules

  • Store secrets in environment variables; rotate tokens regularly.
  • Minimize data exposure in dashboards; redact PII by default.
  • Enforce TLS in all endpoints and use secure cookies for sessions.
  • Audit logs for data access and dashboard rendering.

Testing Checklist

  • Unit tests for data access and utilities; mock DB connections.
  • Integration tests for API routes, authentication, and authorization.
  • End-to-end tests for markdown rendering and dashboard outputs.
  • CI checks for linting, type checking, and test suite.

Common Mistakes to Avoid

  • Assuming live data scrapes are instantaneous; include caching and pagination.
  • Using ad-hoc SQL outside of the data-access layer.
  • Exposing secrets or PII in Markdown outputs.
  • Skipping tests or not validating data shapes before rendering.

FAQ

What is a Cursor Rules Template for retail inventory dashboards?

A Cursor Rules Template provides a structured set of prompts, guardrails, and conventions that guide Cursor AI to generate inventory markdown dashboards for retail chains. It ensures consistent data access, safe AI behavior, and reproducible markdown outputs suitable for leadership dashboards.

Which stack does this template cover?

This template targets a Next.js (TypeScript) frontend with a Node.js backend and PostgreSQL data store. It assumes a Redis cache optional layer and focuses on safe data access, typed interfaces, and a declarative pipeline for rendering inventory dashboards from SQL queries.

Can I reuse this template for non-markdown dashboards?

Yes, but the template emphasizes markdown-based outputs. You can adapt the cursor rules to also drive HTML or React components, provided you maintain a clear separation between data access, rendering, and presentation logic.

How do I validate the Cursor rules with real data?

Use a mock data layer in unit tests, run integration tests against a staging PostgreSQL instance, and verify that markdown outputs match expected templates. Include assertion checks for data shapes, field presence, and redaction rules.

What are the security considerations?

Enforce RBAC, store secrets in environment variables, use TLS, and redact PII by default. Implement token rotation and monitor access logs to detect unusual dashboard render activity.

Related implementation resources: AI Use Case for Carpentry Shops Using Inventory Tools To Track Wood Stock Levels and Auto-Order Common Sizes and Embedding architectural patterns in workspace definitions to reduce model technical debt: practical CLAUDE.md and Cursor workflows.