Cursor rule
.cursor/rules/api-routes.mdcFastAPI route conventions for the events API
Cursor rules
Quality
57/100
Scores the file, not the repository.Length
175 words
2 headings · 1 code blocksRepository
0
— · pushed 54 days agoLast changed
3 days ago
First indexed 3 days ago.1234567# API Route Conventions89- Routes are thin: validate input, call a service/store, shape the response.10 No persistence, aggregation, or business logic in a handler.11- Pull dependencies off `app.state` via the `Depends(_helper)` pattern (e.g.12 `_mongo`, `_es`, `_cache`, `_ingestion`); don't reach into globals.13- The events routes declare a Pydantic `response_model` from14 `app/api/schemas.py`; `/health` (a status-code-driven `JSONResponse`) and15 `/metrics` (a loose ops snapshot) are intentionally exempt. Nullable fields are16 **always present** in the response (return explicit `null`, e.g. `total`,17 `bucket`, `computed_at`) for a stable shape.1819# Error → status mapping (be consistent)2021Stores raise native exceptions; the route catches and maps them. Log at the22boundary with the exception type, then raise `HTTPException`.2324| Condition | Status |25|---|---|26| Mongo (source of truth) unavailable | `503` |27| Elasticsearch (derived) unavailable | `502` |28| Queue full (backpressure) | `429` |29| Service shutting down | `503` |3031```python32try:33 events, has_more, total = await mongo.find_events(...)34except PyMongoError as exc:35 logger.error("Mongo query failed (%s): %s", type(exc).__name__, exc)36 raise HTTPException(status_code=503, detail="Event store temporarily unavailable")37```38
Also in jleist-clemson/acheron
Diff this repo’s formatsOne repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| jleist-clemson/acheron.cursor/rules/background-tasks.mdc · 0 | Cursor rules | monorepo | 58/100 | 3 days ago | |
| jleist-clemson/acheron.cursor/rules/elasticsearch-mapping.mdc · 0 | Cursor rules | styletypesdo-not | 58/100 | 3 days ago | |
| jleist-clemson/acheron.cursor/rules/python-standards.mdc · 0 | Cursor rules | lint-formatapido-notdocs | 72/100 | 3 days ago | |
| jleist-clemson/acheron.cursor/rules/testing.mdc · 0 | Cursor rules | testlint-formatstyletesting-strategy | 67/100 | 3 days ago | |
| jleist-clemson/acheronAGENTS.md · 0 | AGENTS.md | testlint-formatstyledo-not+2 | 63/100 | 3 days ago | |
| jleist-clemson/acheronCLAUDE.md · 0 | CLAUDE.md | agent-behaviour | 16/100 | 3 days ago |
Similar configs
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| TechSquidTV/Hermes.cursor/rules/10-hermes-api.mdc · 45 | Cursor rules | testlint-formatstylearch+5 | 100/100 | 3 days ago | |
| TechSquidTV/Hermes.cursor/rules/20-hermes-api-tests.mdc · 45 | Cursor rules | teststyletesting-strategysecurity+3 | 97/100 | 3 days ago | |
| langflow-ai/langflow.cursor/rules/docs_development.mdc · 153k | Cursor rules | setupbuildtestlint-format+7 | 97/100 | 3 days ago | |
| nerds-odd-e/doughnut.cursor/rules/cli.mdc · 49 | Cursor rules | setupbuildteststyle+4 | 96/100 | 3 days ago | |
| pr-pm/prpm.cursor/rules/github-actions-testing.mdc · 121 | Cursor rules | setupbuildstylearch+4 | 93/100 | 3 days ago | |
| pr-pm/prpm.cursor/rules/creating-agents-md.mdc · 121 | Cursor rules | testlint-formatstylearch+7 | 92/100 | 3 days ago | |
| coollabsio/coolify.cursor/rules/coolify-ai-docs.mdc · 60k | Cursor rules | buildteststylearch+5 | 92/100 | 3 days ago | |
| iloveitaly/llm-ide-rules.cursor/rules/general.mdc · 13 | Cursor rules | teststyledo-notagent-behaviour+1 | 92/100 | 3 days ago |
