Build a Next.js API route that lets developers search and filter the climate tech project database.
GET /api/climate-projects?q=&category=&language=&minStars=&needsContributors=&limit=20&cursor=
Database table climate_projects:
id uuid PK, name text, description text, repo_url text,
category text, primary_language text, stars integer,
has_good_first_issues boolean, last_commit_at timestamptz,
created_at timestamptz
Query behavior:
name and description using PostgreSQL to_tsvector('english', name || ' ' || description) — add a GIN indexcategory (exact match), primary_language (exact match), minStars (>=), needsContributors (maps to has_good_first_issues = true)q is provided, otherwise stars DESCcursor is an opaque base64-encoded {id, stars} pair{ projects: Project[], total: number, nextCursor: string | null }Validate all query params with zod. Return 400 with descriptive error on invalid params.
Include the Drizzle migration for the climate_projects table with proper indexes.
No contributions yet.