Skip to content

feat: search for streamers, streams, and categories #369

@davedumto

Description

@davedumto

Overview

StreamFi currently has no way to search for a specific creator or stream. This is a core discovery feature — without it, new users have no path to finding content they care about.

Search scope

Query type Example Result
Creator username alice Profile card + live status
Stream title valorant ranked Matching live streams
Category / tag gaming Streams + creators in category

API

GET /api/search?q={query}&type={all|users|streams|categories}&limit=10

Requires pg_trgm extension for fuzzy matching:

CREATE EXTENSION IF NOT EXISTS pg_trgm;
CREATE INDEX users_username_trgm ON users USING gin(username gin_trgm_ops);
CREATE INDEX creators_title_trgm ON creators USING gin(stream_title gin_trgm_ops);

Users:

SELECT username, avatar, is_live, follower_count, bio
FROM users
WHERE username ILIKE '%' || $1 || '%'
ORDER BY is_live DESC, follower_count DESC
LIMIT $2

Live streams:

SELECT u.username, u.avatar, c.stream_title, c.category, c.tags
FROM users u JOIN creators c ON c.user_id = u.id
WHERE u.is_live = true
  AND (c.stream_title ILIKE '%' || $1 || '%'
       OR c.category ILIKE '%' || $1 || '%'
       OR $1 = ANY(c.tags))
LIMIT $2

UI

Global search bar

  • In main navbar (desktop) and explore page (mobile)
  • Cmd+K / Ctrl+K keyboard shortcut opens overlay
  • Debounced input (300ms) triggers API call

Search overlay / dropdown

  • Sections: "Live Now", "Creators", "Categories"
  • Each result: avatar/thumbnail, name, live dot indicator
  • Click → navigate to /{username} or /browse/category/{title}
  • Empty state: "No results for '{query}'"
  • Loading: skeleton rows

Dedicated /search page

  • Full results with tabs: All / Creators / Live Streams / Categories
  • Shareable URL (/search?q=alice)
  • Direct navigation from external links

New components

  • components/search/SearchBar.tsx — input with Cmd+K support
  • components/search/SearchOverlay.tsx — dropdown results
  • app/search/page.tsx — full search results page

Acceptance criteria

  • pg_trgm extension and indexes in migration script
  • Search API returns users and live streams for a query
  • Global search bar in navbar with Cmd+K shortcut
  • Debounced live dropdown with "Live Now" / "Creators" sections
  • Dedicated /search page with tabbed results
  • Query reflected in URL
  • Empty state + loading skeleton
  • Mobile full-screen overlay

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions