api-backend

api-backend is a cursor rule for Cursor from chooomedia/keymoji. It costs 0 tokens per session (660 once invoked), scanned A, original, MIT.

A set of rules for handling APIs, n8n workflows, Google Sheets, stored data, and user accounts in Keymoji.

In plain words
What is it for?
It is for adding login and account flows, reading or updating Google Sheets, calling webhooks, preparing API data, and showing loading or error states.
Why use it?
It reduces duplicate requests, unsafe account operations, hardcoded service addresses, and unclear error handling.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit It is for adding login and account flows, reading or updating Google Sheets, calling webhooks, preparing API data, and showing loading or error states.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/chooomedia/keymoji/api-backend
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/chooomedia/keymoji

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 api-backend

README.md
[![agentmods](https://agentmods.dev/badge/rules/chooomedia/keymoji/api-backend/github.svg)](https://agentmods.dev/rules/chooomedia/keymoji/api-backend)
Your own site
<a href="https://agentmods.dev/rules/chooomedia/keymoji/api-backend"><img src="https://agentmods.dev/badge/rules/chooomedia/keymoji/api-backend/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 api-backend

Your own site · 80×15
<a href="https://agentmods.dev/rules/chooomedia/keymoji/api-backend"><img src="https://agentmods.dev/badge/rules/chooomedia/keymoji/api-backend.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 660 The whole file, excluding the scripts and references it only reads on demand.
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.00000 $0.00660
Opus 5.5 $0.00000 $0.00264
Sonnet 5.5 $0.00000 $0.00132
Haiku 4.5 $0.00000 $0.00066

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

Security

Grade A, and why

api-backend 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/api-backend.mdc · 66 lines

How it starts

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

API, Backend & Storage Patterns

API Calls — Pflichtregeln

  • IMMER cachedFetch / cachedFetchAccount aus utils/apiCache.js
  • KEINE direkten fetch() Calls außer in apiCache.js
  • KEINE doppelten API-Calls — Daten zwischen Komponenten weitergeben
  • IMMER try/catch mit user-freundlichen Error Messages
  • IMMER Loading States
  • secureLoginWithMagicLink() — Login initiieren
  • secureVerifyOTP() / secureVerifyMagicLink() — Code verifizieren
  • Session Validation vor jeder Account-Operation
  • Cross-Tab Communication via BroadcastChannel

Account Management

  • accountStore.js — einziger Ort für Account-Operationen
  • syncAccountData() nach Login/Update aufrufen
  • currentAccount Store = Single Source of Truth
  • Vor jedem API-Call: prepareMetadataForAPI() aus metadataCleaner.ts

n8n / Google Sheets

  • WEBHOOKS aus config/api.js verwenden — nie URLs hardcoden
  • Actions: "get" / "read" = read-only (kein Sheets-Write), "update" / "create" = Upsert
  • Google Sheets Spalten (Top-Level, NICHT in metadata):
    • userId, email, tier, createdAt, lastLogin, profile, dailyUsage, metadata, status
  • metadata JSON enthält: settings, updatedAt, updatedVia, lastSettingsSave
  • profile JSON enthält: name, avatar
  • dailyUsage JSON: { date, used, storyUsed, limit, lastReset }

localStorage / Storage

  • IMMER storageHelpers aus config/storage.js
  • IMMER STORAGE_KEYS Konstanten — nie String-Literals
  • DAILY_USAGE_HISTORY = lokale Chart-History (kein API-Feld!)
  • Quota-Exceeded-Errors immer abfangen

Daily Usage / Chart

  • dailyUsageStore.js — Zähler für heute, API-Sync
  • userDataStore.js — persistDailyUsageToHistory() nach jedem Increment
  • Chart liest aus localStorage.DAILY_USAGE_HISTORY — kein metadata.usageHistory
  • action: "update" sendet dailyUsage als Top-Level Feld, NICHT in metadata

Performance

  • cachedFetch mit TTL für alle API-Calls
  • Debouncing für User Input
  • Lazy Loading für große Komponenten
  • $derived für abgeleitete Werte, $effect für Side Effects

Read the full file on GitHub · 66 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 · 66 lines · 0 tokens per session scan A 489d4c988db7

Subscribe to this mod's changes

api-backend is a cursor rule published in the GitHub repository chooomedia/keymoji (2 stars, last pushed 3mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 660 tokens. 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.