mvp-ai's picture
download
raw
12 kB
id,category,option,best_for,avoid_when,tradeoffs,tags,last_verified
BE041,Communication,REST,"Public or third-party-consumed APIs where predictable resource-based URLs and HTTP caching semantics matter","Frontend needs to fetch deeply nested/related resources in one round trip — REST tends toward over- or under-fetching there","Universally understood, cacheable by HTTP infrastructure for free, but often requires multiple round trips for nested data","rest|http|public-api",2026-07-03
BE042,Communication,GraphQL,"Frontend-driven product where different clients (web/mobile) need different slices of the same underlying data, avoiding over-fetching","Small API surface, or a team unfamiliar with resolver-level performance pitfalls (N+1 queries)","Clients request exactly the fields they need in one round trip; requires discipline around query complexity limits and resolver batching (DataLoader) to avoid N+1","graphql|frontend-driven|flexible-queries",2026-07-03
BE043,Communication,tRPC,"Full-stack TypeScript monorepo (e.g. Next.js) where the same team owns both client and server and wants end-to-end type safety without codegen","API needs to be consumed by non-TypeScript clients (mobile app in Swift/Kotlin, third-party integrators)","Zero codegen, full type inference from server to client automatically; effectively locks the API to TypeScript-consuming clients only","trpc|typescript|monorepo|type-safety",2026-07-03
BE044,Communication,gRPC,"Service-to-service communication inside a microservices architecture where performance and strict contracts matter more than browser-friendliness","Directly consumed by a browser frontend (needs grpc-web proxy) or public third-party API where REST/GraphQL familiarity matters more","Binary protobuf format is fast and strongly typed across languages, but not natively browser-friendly and less human-debuggable than JSON","grpc|microservices|protobuf|service-to-service",2026-07-03
BE045,Communication,Webhooks (outbound),"Notifying external systems (Stripe-style) or client-configured endpoints when an event happens, without them polling you","Consumer can't reliably run a public HTTPS endpoint to receive callbacks — offer polling or websockets instead","Push-based and efficient for the consumer, but requires you to implement retry/backoff and signature verification for the receiver's trust","webhooks|events|integrations",2026-07-03
BE046,Communication,Webhooks (inbound — Stripe/Shopify/etc.),"Receiving payment/order/auth events from a third-party platform (Stripe, Shopify, Supabase Auth hooks)","Never applicable when integrating with a platform that supports webhooks — always prefer this over polling their API","Requires signature verification (HMAC) on every inbound webhook and idempotent handling since providers retry on timeout","webhooks|stripe|shopify|inbound|security",2026-07-03
BE047,Communication,WebSockets,"Bidirectional, low-latency real-time features: chat, collaborative editing, live cursors, multiplayer state","One-way server-to-client updates only (SSE is simpler), or the feature can tolerate a few seconds of staleness (polling is simpler)","True bidirectional low-latency channel, but requires managing connection state, reconnection, and horizontal-scaling considerations (sticky sessions or a pub/sub backplane)","websockets|realtime|bidirectional",2026-07-03
BE048,Communication,Server-Sent Events (SSE),"One-way streaming updates from server to client: live notifications, LLM token streaming, progress updates","Client needs to send frequent messages back to the server too — use WebSockets instead","Simpler than WebSockets (plain HTTP, auto-reconnect built into the browser API), but strictly one-directional","sse|streaming|llm|notifications",2026-07-03
BE049,Communication,Long Polling,"Real-time-ish updates needed but WebSocket/SSE infrastructure isn't available (older proxies, simple hosting)","Modern hosting supports WebSockets/SSE — those are strictly better when available","Works almost everywhere HTTP works, but is less efficient than SSE/WebSockets and adds latency/complexity in edge cases","long-polling|realtime|fallback",2026-07-03
BE050,Communication,Polling (client-interval),"Simple status checks where near-real-time isn't required (e.g. checking if a background job finished every few seconds)","Update frequency needs to be sub-second, or many clients polling would create meaningful server load — use push instead","Trivial to implement on both ends, but wastes requests when nothing has changed and adds latency equal to the poll interval","polling|simple|background-jobs",2026-07-03
BE051,Async Work,Job Queue + Webhook Callback,"Long-running server-side work (video processing, report generation, bulk import) where the client shouldn't hold a connection open","Work completes in well under a second — a synchronous response is simpler and sufficient","Client gets an immediate 202-style acknowledgment and is notified via webhook/websocket when done, avoiding request timeouts on long work","async|queue|jobs|long-running",2026-07-03
BE052,Async Work,Client Polling a Job Status Endpoint,"Long-running work where the client is a simple frontend without its own webhook receiver, checking `GET /jobs/:id` periodically","A true push channel (websocket/SSE) is already established for the client — prefer pushing the completion event instead","Simple to implement on both sides without extra infrastructure, but has the same staleness/request-volume tradeoffs as any polling pattern","async|polling|job-status",2026-07-03
BE053,Versioning,URL Path Versioning (`/v1/…`),"Public APIs with external consumers who need an explicit, visible contract version they can pin to","Internal-only API where the frontend and backend always deploy together — versioning adds needless ceremony","Most explicit and cache-friendly versioning style; requires maintaining old versions in parallel until consumers migrate off them","versioning|public-api|rest",2026-07-03
BE054,Versioning,No Explicit Versioning (continuous deploy),"Internal API where frontend and backend ship from the same repo/deploy together, so there's never a mismatched-version consumer","Any external or third-party consumer exists — they need a stable contract to build against","Simplest possible approach for internal-only APIs; breaks down the moment an external consumer or a slower-deploying mobile client appears","versioning|internal-api|continuous-deploy",2026-07-03
BE055,Pagination,Cursor-based Pagination,"Large or frequently-changing datasets (feeds, logs) where offset-based pagination would skip/duplicate rows as data shifts","Dataset is small and static enough that offset pagination's simplicity outweighs cursor's correctness benefit","Stable under concurrent inserts/deletes since it anchors to a row, not a position; slightly more complex to implement than offset pagination","pagination|cursor|feeds",2026-07-03
BE056,Pagination,Offset/Limit Pagination,"Small-to-medium, relatively static datasets (admin tables, reports) where jumping to an arbitrary page number matters to users","High-write-volume data where rows shift between page loads — cursor pagination avoids the resulting skip/duplicate bugs","Simple to implement and lets users jump to page N directly, but degrades in both correctness and performance on large, actively-written tables","pagination|offset|admin-tables",2026-07-03
BE057,Bulk Operations,Batch Endpoint (`POST /resource/batch`),"Client needs to create/update many records in one request (bulk import, multi-select actions in a UI)","Individual items in the batch need independent, granular error handling that the client must react to differently per item — consider per-item status in the response either way","Reduces round trips dramatically for bulk actions; response should return per-item success/failure, not just an all-or-nothing result","bulk|batch|import",2026-07-03
BE058,Idempotency,Idempotency Keys,"Payment/order-creation endpoints where a client retry (due to network failure) must not create a duplicate side effect","Endpoint is naturally idempotent already (e.g. a PUT that fully replaces a resource) — no extra key needed there","Client generates a unique key per logical operation and sends it in a header; server deduplicates retries against that key — essential for anything touching money","idempotency|payments|reliability",2026-07-03
BE059,Response Shape,"Envelope Response (`{ data, meta, error }`)","APIs consumed by multiple client types where consistent metadata (pagination info, request id) needs to travel with every response","Extremely simple internal API where the wrapping adds no value and the team prefers bare resource JSON","Consistent shape makes client-side handling predictable across every endpoint, at the cost of one extra level of nesting to unwrap","response-shape|envelope|consistency",2026-07-03
BE060,Response Shape,Bare Resource Response,"Simple, resource-per-endpoint REST APIs where the resource JSON *is* the whole response, no extra metadata needed","API needs to consistently return pagination/request-tracing metadata across endpoints — use an envelope instead","Slightly leaner responses and matches plain REST conventions, but ad-hoc if some endpoints later need to attach metadata","response-shape|rest|simple",2026-07-03
BE061,Auth in APIs,Bearer Token (JWT) in Authorization Header,"Stateless APIs, especially ones consumed by mobile apps or third-party integrators, or serverless/edge functions that shouldn't hold session state","Traditional server-rendered app where cookie-based sessions are simpler and CSRF protections are already in place","Stateless and scales horizontally with zero shared session store, but token revocation before expiry requires an extra mechanism (short expiry + refresh tokens, or a revocation list)","jwt|bearer-token|stateless-auth",2026-07-03
BE062,Auth in APIs,HTTP-only Session Cookie,"Server-rendered or same-origin SPA where the backend sets the session and the browser handles it automatically","Cross-origin API consumed by a mobile app or third-party client where cookies don't travel naturally","Browser handles the token for you (no manual header wiring) and HttpOnly mitigates XSS token theft, but requires CSRF protection and doesn't extend to non-browser clients","cookies|session|same-origin",2026-07-03
BE063,Rate Limiting,Token Bucket per API Key/User,"Public or metered APIs where you need to allow short bursts but cap sustained request rate per consumer","Internal API where all consumers are trusted and rate limiting only protects against bugs, not abuse — a simpler fixed-window limit may suffice","Allows natural burstiness (a user clicking fast) while still enforcing a sustained-rate ceiling; needs a shared store (Redis) across multiple server instances","rate-limiting|token-bucket|public-api",2026-07-03
BE064,Rate Limiting,Fixed Window Counter,"Simple internal protection against runaway loops/bugs calling an endpoint too often, where burst tolerance isn't a design concern","Public-facing API where consumers legitimately need to burst — token bucket is fairer there","Trivial to implement and reason about, but allows a burst right at the window boundary (2x the limit across the boundary) that token bucket avoids","rate-limiting|fixed-window|internal",2026-07-03
BE065,Edge/Serverless,Stateless Handler per Request,"Serverless/edge functions (Vercel, Cloudflare Workers, Supabase Edge Functions) — the deployment model requires this","Long-lived in-memory state or connection pooling is required — use a traditional long-running server process instead, or a connection-pooling proxy (e.g. Supabase's pooler, Cloudflare Hyperdrive)","No server to manage and scales to zero, but every request re-establishes what a long-running process would keep warm (DB connections especially) unless you use a pooler","serverless|edge|stateless|connection-pooling",2026-07-03

Xet Storage Details

Size:
12 kB
·
Xet hash:
21b3d4e94ace4e4ffd1f1a170679c835bb2791d4186bf4bf81aeb3bd2e6328b8

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.