architectural-and-structural-rules

architectural-and-structural-rules is a cursor rule for Cursor from mrharishkumar/fastapi-cursor-boilerplate. It costs 559 tokens per session, scanned A, original, MIT.

A rule for organizing the project as a layered Python application, with separate areas for HTTP endpoints, business logic, data access, validation, and configuration.

In plain words
What is it for?
Use it when adding or reviewing FastAPI routes, service logic, database models, validation schemas, connections, and application configuration.
Why use it?
Clear separation makes it easier to find code and change one part without mixing unrelated responsibilities.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit Use it when adding or reviewing FastAPI routes, service logic, database models, validation schemas, connections, and application configuration.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/mrharishkumar/fastapi-cursor-boilerplate/architectural-and-structural-rules
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.

Clone the repo
git clone --depth 1 https://github.com/mrharishkumar/fastapi-cursor-boilerplate

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for architectural-and-structural-rules

README.md
[![agentmods](https://agentmods.dev/badge/rules/mrharishkumar/fastapi-cursor-boilerplate/architectural-and-structural-rules/github.svg)](https://agentmods.dev/rules/mrharishkumar/fastapi-cursor-boilerplate/architectural-and-structural-rules)
Your own site
<a href="https://agentmods.dev/rules/mrharishkumar/fastapi-cursor-boilerplate/architectural-and-structural-rules"><img src="https://agentmods.dev/badge/rules/mrharishkumar/fastapi-cursor-boilerplate/architectural-and-structural-rules/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for architectural-and-structural-rules

Your own site · 80×15
<a href="https://agentmods.dev/rules/mrharishkumar/fastapi-cursor-boilerplate/architectural-and-structural-rules"><img src="https://agentmods.dev/badge/rules/mrharishkumar/fastapi-cursor-boilerplate/architectural-and-structural-rules.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 559 This file is loaded in full into every session.
When invoked 559 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00559 $0.00559
Opus 5.5 $0.00224 $0.00224
Sonnet 5.5 $0.00112 $0.00112
Haiku 4.5 $0.00056 $0.00056

Measured 1mo ago against content hash dbd43caeb86e, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

architectural-and-structural-rules 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 1mo ago.

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/architectural-and-structural-rules.mdc · 65 lines

How it starts

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

Project Architecture & Structure Rules

Project Structure

Core Directory Organization

The project follows a layered architecture with clear separation of concerns:

app/
├── main.py                 # FastAPI application entry point
├── api/                    # API layer
│   └── v1/                 # API versioning
│       ├── api.py          # Main API router aggregation
│       └── endpoints/      # Individual endpoint modules
├── core/                   # Core application configuration
│   └── config.py           # Settings and configuration
├── db/                     # Database layer
│   └── __init__.py         # Database connection and session management
├── models/                 # SQLAlchemy database models
├── schemas/                # Pydantic data validation schemas
└── services/               # Business logic layer

Architectural Principles

1. Layered Architecture

  • API Layer (app/api/): Responsible for handling HTTP requests/responses, routing, and input validation.
  • Service Layer (app/services/): Contains business logic and orchestration.
  • Data Layer (app/models/, app/db/): Manages database models and data access.
  • Core Layer (app/core/): Handles configuration, security, and shared utilities.

2. Modular Endpoint Organization

  • Each feature/domain should have its own endpoint file in app/api/v1/endpoints/.
  • Use descriptive filenames: users.py, products.py, auth.py.
  • Each endpoint file must contain a single APIRouter instance.

3. Model Organization

  • Place SQLAlchemy models in app/models/.
  • Use singular names for model files: user.py, product.py.
  • Each model should reside in its own file for larger projects.

4. Schema Organization

  • Place Pydantic schemas in app/schemas/.
  • Use plural names for schema files: users.py, products.py.
  • Clearly separate request and response schemas.

5. Business Logic

  • Business logic should be placed in app/services/.
  • Services must be stateless and focused on single responsibilities.
  • Utilize dependency injection for database sessions and other dependencies.

Read the full file on GitHub · 65 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. 1mo ago First seen · 65 lines · 559 tokens per session scan A dbd43caeb86e

Subscribe to this mod's changes

architectural-and-structural-rules is a cursor rule published in the GitHub repository mrharishkumar/fastapi-cursor-boilerplate (3 stars, last pushed 1y ago), licensed MIT. It adds 559 tokens to every session, about $0.0022 per session on Opus 5.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.