Skip to content

[Backend] Add a richer search API for discovery #307

@Kaylahray

Description

@Kaylahray

Description

The app can filter posts through the posts endpoint, but there is no dedicated discovery API for combined post, user, and leaderboard search.

User Story

As a user,
I want to search across posts and people from one query,
so that discovery feels intentional instead of fragmented.

Requirements and Context

  • Files: app/app/api/posts/route.ts, app/app/api/leaderboard/route.ts, app/app/api/users/[id]/route.ts
  • Add a discovery endpoint that can search posts, users, and trending topics together
  • Support pagination and ranking options
  • Return normalized results for the frontend search page

Suggested Implementation

// DISCOVERY API
// 1. Accept a query string and optional filters.
// 2. Search posts, users, and leaderboard entries.
// 3. Rank and paginate the combined results.
// 4. Return a single normalized payload.

Acceptance Criteria

  • One API call can return combined search results.
  • Results support pagination and ranking.
  • The frontend can render the payload without extra reshaping.

Submission Guidelines

  • Branch: feat/discovery-api
  • Depends on: current Prisma models and post filters
  • PR: feat(backend): add combined search and discovery endpoint

Metadata

Metadata

Assignees

No one assigned
    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions