project-structure

A set of project rules describing the structure and conventions of a React, Vite, and TypeScript application. React is a user-interface library, Vite is a build tool, and TypeScript adds types to JavaScript.

In plain words
What is it for?
Use it when adding routes, features, shared components, providers, or UI components so new code follows the project layout.
Why use it?
It tells the coding agent where files belong and how application code should import and organise them.

Cursor rule for Cursor

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/kws-projects/react-boilerplate/project-structure
Clone the repo
git clone --depth 1 https://github.com/kws-projects/react-boilerplate

Made for: Cursor.

Per session 920 This file is loaded in full into every session.
When invoked 920 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00920 $0.00920
Opus 5 $0.00460 $0.00460
Sonnet 5 $0.00184 $0.00184
Haiku 4.5 $0.00092 $0.00092

Measured yesterday against content hash acc6e02aff5c, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

project-structure scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/rules/project-structure.mdc · 69 lines

How it starts

The opening of the file, as written. The whole thing — 69 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Project Structure

This is a React + Vite + TypeScript app. Use the @/ alias for imports from src (e.g. @/components/ui/Button). Never use long relative paths like ../../../.

Folders (src/)

  • app/ - application shell. App.tsx mounts the router inside the providers; app/providers/ composes global providers (Helmet, React Query, Theme, Direction, i18n); app/router.tsx defines routes (react-router-dom). Add new routes as children of the root layout, pointing at feature pages.
  • components/ - shared, reusable components used across features.
    • components/layout/ - layout components (e.g. RootLayout.tsx with the header and <Outlet />).
    • components/shadcn/ - pristine, vendored shadcn/ui originals. Never import these directly in app code; treat as vendored for easy upgrades.
    • components/ui/ - project-facing components that wrap (re-export or extend) the shadcn/ originals. App code imports only from here. See the add-shadcn-component skill for the full workflow.
  • features/<feature>/ - feature modules. Each feature owns its slice and may contain components/, hooks/, api/, and types/. Features should not import from each other's internals; share via components/, lib/, or hooks/.
  • lib/ - cross-cutting utilities and third-party integration adapters (utils.ts, analytics.ts, monitoring.ts). Wrap external SDKs behind a thin interface here so call sites stay decoupled. Never import @sentry/react or call window.gtag outside of the adapters in lib/.
  • config/ - typed configuration. env.ts is the single source of truth for environment variables; do not read import.meta.env directly elsewhere.
  • i18n/ - i18next config and locales/<lang>/<namespace>.json.
  • hooks/ - shared hooks not tied to a single feature. Includes useAnalytics, useMonitoring, and usePageTracking.
  • types/ - shared TypeScript types. Includes typed GA4 event definitions (analytics.ts), monitoring types (monitoring.ts), and window augmentation (global.d.ts).
  • test/ - global Vitest setup and shared helpers (renderWithProviders). This is distinct from the per-directory __tests__/ folders described below.

Read the full file on GitHub · 69 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 69 lines · 920 tokens per session scan A acc6e02aff5c

Subscribe to this mod's changes

project-structure is a cursor rule published in the GitHub repository kws-projects/react-boilerplate (3 stars, last pushed 2mo ago), licensed MIT. It adds 920 tokens to every session, about $0.0046 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.