Back to prompts
Web DevelopmentClaudeGPT-4

Next.js API route + Supabase

Generates a typesafe Next.js API route that talks to Supabase.

Variables

Prompt(live preview)

Write a Next.js 14 App Router API route at app/api/{{route_path}}/route.ts that does the following:

{{behavior}}

Requirements: TypeScript strict, use the @supabase/ssr server client with cookies, validate input with zod, return proper HTTP status codes, handle errors gracefully, never expose internal error messages to the client. Include the zod schema. Assume the supabase server client helper is at lib/supabase/server.ts.

Comments

No comments yet. Be the first to share your experience with this prompt!

Sign in to leave a comment.