What problem does it solve?
Template-bff codifies backend-for-frontend Server Action and Route Handler practices so the ui/ layer never bypasses Supabase abstractions, validation contracts, or standardized action results, eliminating scattered business logic and inconsistent data flows.
Core Features & Use Cases
- BFF decision tree clarifies when to favor Server Actions versus Route Handlers for streaming, webhooks, mutations, and data fetching needs.
- Server Action pattern demands Zod validation through
@template/contracts, delegation of business logic to @template/core, and returning ActionResult<T> so components can react predictably.
- Route Handler guidance covers SSE and webhook orchestration with proper headers, streaming flow, and error handling while keeping business logic centralized.
- Critical checklist enforces the prohibition of direct Supabase imports, inline schemas, cross-calling actions, and missing error handling across all server-side logic in ui/.
Quick Start
Request template-bff to implement a Server Action that validates input with @template/contracts, delegates to @template/core, and returns an ActionResult so UI components can handle success or failure predictably.