Initial commit

This commit is contained in:
Shaw_Consulting committed 2026-06-25 12:29:03 -07:00
commit b035ed1763
49 files changed
+3170

No files matched your search

+18
View File
@@ -0,0 +1,18 @@
---
description: REST API design — routes, responses, versioning, and validation
globs: **/api/**/*.{ts,js,py,go},**/routes/**/*.{ts,js,py}
alwaysApply: false
---
# REST API Design
- Use nouns for resources (`/users`, `/orders`), HTTP verbs for actions.
- Plural resource names. Nested resources only when truly parent-scoped (`/users/{id}/orders`).
- Return consistent JSON envelopes: `{ data, error, meta }` or match existing project pattern.
- Paginate list endpoints: `limit`, `offset` or cursor-based. Include total count when cheap.
- Version breaking APIs (`/v1/`, `/v2/`) — never break clients silently.
- Validate request bodies with a schema (Zod, Pydantic, etc.) before business logic.
- Use `201 Created` + `Location` header on resource creation.
- Use `204 No Content` for successful deletes with no body.
- Document error response shapes. Same error format across all endpoints.
- Rate-limit public and auth endpoints.