axum

axum is a cursor rule for Cursor from SaynaAI/sayna. It costs 2,160 tokens per session, scanned A, original, Apache-2.0.

A set of development guidelines for Axum 0.8+, a Rust framework for building web servers and APIs, including services that use WebSockets for live two-way communication.

In plain words
What is it for?
Use it when building or reviewing Rust web services with REST endpoints, WebSocket connections, project structure, performance concerns, or security requirements.
Why use it?
It gives a consistent way to organize routes, request handlers, business logic, testing, security, and WebSocket code in Axum applications.

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/saynaai/sayna/axum
Clone the repo
git clone --depth 1 https://github.com/SaynaAI/sayna

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 axum

README.md
[![agentmods](https://agentmods.dev/badge/rules/saynaai/sayna/axum.svg)](https://agentmods.dev/rules/saynaai/sayna/axum)
Your own site
<a href="https://agentmods.dev/rules/saynaai/sayna/axum"><img src="https://agentmods.dev/badge/rules/saynaai/sayna/axum.svg" alt="Measured on agentmods" height="20"></a>
Per session 2,160 This file is loaded in full into every session.
When invoked 2,160 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.02160 $0.02160
Opus 5 $0.01080 $0.01080
Sonnet 5 $0.00432 $0.00432
Haiku 4.5 $0.00216 $0.00216

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

Security

Grade A, and why

axum 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 5d 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/axum.mdc · 172 lines

How it starts

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

Axum Best Practices: A Comprehensive Guide (0.8+)

This guide provides best practices for developing applications using the Axum framework in Rust, enhanced with WebSocket support for building atomic web services. It covers code organization, common patterns, performance, security, WebSocket specifics, testing, pitfalls, and tooling.

Note: This project uses Axum 0.8.x (released January 2025). Minimum Rust version: 1.75.

1. Code Organization and Structure

A clear project layout improves maintainability and scalability. Consider the following structure:

project_root/
├── src/
│   ├── main.rs             # Application entry point (sets up Router + server)
│   ├── lib.rs              # Shared library for core logic
│   ├── routes/             # Route definitions
│   │   ├── mod.rs
│   │   ├── api.rs          # REST endpoints
│   │   ├── ws.rs           # WebSocket routes and upgrade handlers
│   ├── handlers/           # Request handlers and WebSocket message handlers
│   │   ├── mod.rs
│   │   ├── api_handlers.rs
│   │   ├── ws_handlers.rs
│   ├── services/           # Business logic services
│   │   ├── mod.rs
│   │   ├── user_service.rs
│   │   ├── chat_service.rs # WebSocket message routing
│   ├── middleware/         # Tower middleware layers
│   │   ├── mod.rs
│   │   ├── auth.rs
│   │   ├── logging.rs
│   ├── state/              # Shared application state
│   │   ├── mod.rs          # Defines AppState struct (use `State<AppState>` extractor)
│   ├── errors/             # Error types and conversion to responses
│   │   ├── mod.rs
│   │   ├── app_error.rs    # Implements `IntoResponse`
│   ├── utils/              # Utility functions (e.g., DB pool setup)
│   │   ├── mod.rs
│   │   ├── db.rs
├── tests/                  # Integration tests
│   ├── api_tests.rs        # Tests for HTTP endpoints
│   └── ws_tests.rs         # WebSocket integration tests
├── Dockerfile              # Containerization
├── Cargo.toml
└── .env

1.1 Naming Conventions

Read the full file on GitHub · 172 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. 5d ago First seen · 172 lines · 2,160 tokens per session scan A daa95ecbc879

Subscribe to this mod's changes

axum is a cursor rule published in the GitHub repository SaynaAI/sayna (311 stars, last pushed 3mo ago), licensed Apache-2.0. It adds 2,160 tokens to every session, about $0.0108 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-30.