RuleStack

Configs

Stacks

Compare

Diff

RuleStack

Configs

Stacks

Compare

Diff

Read API

RuleStack

Configs

Stacks

Compare

Diff

Read API

Configs/Cursor rules/VictorGoic0/Math-Tutoring-App

Cursor rule

.cursor/rules/api-patterns.mdc

Express API conventions (Math Tutoring App)

Cursor rules

Quality

73/100

Scores the file, not the repository.

Length

318 words

8 headings · 1 code blocks

Repository

0

— · pushed 112 days ago

Last changed

3 days ago

First indexed 3 days ago.
VictorGoic0/Math-Tutoring-App/.cursor/rules/api-patterns.mdcRawGitHub
1---
2description: Express API conventions (Math Tutoring App)
3globs: api/**/*.js
4alwaysApply: false
5---
6 
7# API Patterns — `api/`
8 
9Stack: **Express** (CommonJS **`.js`**), **Vercel AI SDK** (`ai`, `@ai-sdk/openai`), deployed as **Vercel** serverless. **No database in this API** — persistence is **Firebase** from the **webapp** only.
10 
11## Folder layout (actual)
12 
13```
14api/
15 server.js ← Express app, CORS, JSON, mounts routes, error handler
16 index.js ← Vercel entry; re-exports app
17 routes/
18 chat.js ← POST /chat, SSE streaming, tool schemas (Zod)
19 services/
20 promptService.js ← System prompt / message building
21 contextManager.js ← Conversation context helpers (if used)
22 src/lib/
23 logger.js ← Pino singleton; pino-http attaches `req.log` per request (see server.js)
24 src/config/ ← Centralized env (Phase 4 — read REFACTOR_RUNBOOK.md)
25```
26 
27There is **no** `middleware/` or `prisma/` here. Do not add Prisma or hand-written SQL migrations to this project.
28 
29## Responsibilities
30 
31- **`routes/`** — Thin HTTP: validate inputs, call `services/`, set status codes, stream SSE. Avoid huge inline prompt strings; keep them in `services/promptService.js` (or dedicated modules under `services/`).
32- **`services/`** — Business-ish logic: prompt construction, helpers. No Firebase Admin for Firestore user data (removed by design); optional context utilities only.
33- **`server.js`** — App wiring only; avoid new domain logic here.
34 
35## LLM & streaming
36 
37- Use the **Vercel AI SDK** patterns already in `routes/chat.js` (`streamText`, tools, Zod `inputSchema`).
38- **OpenAI API key** must stay **server-side** only (`OPENAI_API_KEY`).
39 
40## Environment variables
41 
42- **Do not** scatter new `process.env` reads — the refactor runbook centralizes config under **`api/src/config/`** (Phase 4). Until then, follow existing patterns and Oxlint overrides documented in the runbook.
43 
44## Logging
45 
46- Import **`api/src/lib/logger.js`** for startup and process-level logs; in routes use **`req.log`** from **pino-http** (registered first in `server.js`).
47- Never use `console.*` in application code.
48 
49## Errors
50 
51- Prefer consistent JSON error shapes for new routes; match existing `{ error, message }` style in this codebase unless a refactor standardizes on another shape.
52 
53## SSE
54 
55- Chat streaming uses `text/event-stream` and `data: …` lines as already implemented; preserve headers (`Content-Type`, `Cache-Control`, `Connection`) when touching streaming code.
56 

Sections

  • API Patterns — `api/`
  • Folder layout (actual)
  • Responsibilities
  • LLM & streaming
  • Environment variables
  • Logging
  • Errors
  • SSE

What it covers

setupcode-stylearchitecturesecurityapido-not

Stack — with the evidence

typescript

(1.00)

node

(0.70)

react

(0.70)

express

(0.70)

vite

(0.70)

javascript

(0.50)

Glob targeting

  • api/**/*.js

Format

Cursor rules

The most expressive format here. Many small .mdc files, each with frontmatter declaring when it should load, so a rule about migrations only enters context when a migration is open. Costs the most to maintain and only one editor reads it.

What the corpus says about it

Repository

Owner
VictorGoic0
Language
—
License
—
Archived
no

All configs in this repo

Also in VictorGoic0/Math-Tutoring-App

Diff this repo’s formats

One 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?

The other instruction files in this repository
RepositoryFormatStackCoversScoreChanged
VictorGoic0/Math-Tutoring-App.cursor/rules/linting.mdc · 0Cursor rulestypescriptnode+4lint-formatstyledo-notagent-behaviour68/1003 days ago
VictorGoic0/Math-Tutoring-App.cursor/rules/one-pr-at-a-time.mdc · 0Cursor rulestypescriptnode+4git16/1003 days ago
VictorGoic0/Math-Tutoring-App.cursor/rules/react-patterns.mdc · 0Cursor rulestypescriptnode+4stylearchdo-not69/1003 days ago
VictorGoic0/Math-Tutoring-App.cursor/rules/react-readability.mdc · 0Cursor rulestypescriptnode+4styleuido-not57/1003 days ago
Diff against .cursor/rules/linting.mdc Diff against .cursor/rules/one-pr-at-a-time.mdc Diff against .cursor/rules/react-patterns.mdc Diff against .cursor/rules/react-readability.mdc

Similar configs

Same format, overlapping stack, ranked by quality.

Same format, overlapping stack, ranked by quality
RepositoryFormatStackCoversScoreChanged
hiromaily/go-crypto-wallet.cursor/rules/typescript.mdc · 126Cursor rulesgobun+5setupbuildtestlint-format+6100/1003 days ago
TechSquidTV/Hermes.cursor/rules/10-hermes-api.mdc · 45Cursor rulestypescriptpytest+15testlint-formatstylearch+5100/1003 days ago
markstev/mark-starter.cursor/rules/frontend.mdc · 0Cursor rulestypescriptturborepo+14setuptestlint-formatstyle+699/1003 days ago
Allymahmoud/case-intake-platform.cursor/rules/frontend.mdc · 0Cursor rulestypescriptturborepo+13setuptestlint-formatstyle+799/1003 days ago
dodgecfr/combatfilms-webapp.cursor/rules/frontend.mdc · 0Cursor rulestypescriptturborepo+15setuptestlint-formatstyle+799/1003 days ago
deifos/clipmira-subtitles.cursor/rules/frontend.mdc · 1Cursor rulestypescriptnextjs+5setuptestlint-formatstyle+799/1003 days ago
langflow-ai/langflow.cursor/rules/docs_development.mdc · 153kCursor rulespythonnode+16setupbuildtestlint-format+797/1003 days ago
TechSquidTV/Hermes.cursor/rules/20-hermes-api-tests.mdc · 45Cursor rulestypescriptpytest+15teststyletesting-strategysecurity+397/1003 days ago
RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack

RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack

RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack