Add search and filters to your app: a Claude + Replit + Supabase stack

The struggle: Users cannot find anything in your app once it holds more than a few dozen records.

What you end up with: A working search box and a few filters on your app's list, tested on a copy of your data before real users see it.

Claude turns your users' real searches into a short spec. Replit Agent plans and builds the screen, and Supabase's built-in full-text search finds words fast. You test on a copy of the data and keep a rollback point.

Tools: Claude, Replit, Supabase. Level: Pro. Time: 2 hours.

Use it if

  • Your app has a list or table that keeps growing
  • Users ask where things are
  • Your data is already in Supabase

Skip it if

  • Your data has fewer than a few dozen records: a sorted list is enough
  • You need typo-proof or AI search: that is a bigger project

The method

  1. Write the search spec from real questions (Claude: Chat)

    List five things users have really looked for and the columns that hold the answers. Paste your table columns, never user data. Claude proposes which fields to search, which to filter and the sort order.

    Prompt to copy:

    I have an app with a table called [table] with these columns: [list columns and types]. Users have tried to find: [five real searches]. Propose: which columns the search box should cover, which two or three filters matter, the default sort, and what to show when nothing matches. Keep it under 200 words and list questions if my columns are unclear. Do not ask for or use real user data.

    You get: A short spec of search fields, filters and sort order.

    Tip: Choose filters from what people actually ask, not from every column you have.

  2. Mark a safe point first (Replit: Checkpoints)

    Open the Agent tab, note the latest checkpoint and test the list screen once so you know what works today. Checkpoints hold your files and a snapshot of the database, but a rollback leaves the database alone unless you pick Database under Additional rollback options, and that covers the development database only. Export a copy of the table anyway.

    You get: A known good state to return to.

    Tip: Rollback does not touch your production database, so keep your own data copy as well.

  3. Plan the change before any edit (Replit: Plan mode)

    Paste the spec and ask Agent for a plan only: which files change, whether the database needs a change and what could break. Read it before approving. Plan Mode needs the Core plan or above: on the free Starter plan, ask for a plan in a normal message and tell it not to edit.

    Prompt to copy:

    Read this search spec and write a plan, without editing anything: [paste spec]. List the files you will change, whether the database needs a new column or index, and what could break on the existing list screen. Keep the change small and do not touch login or payments.

    You get: A plan you can approve or shrink.

    Tip: If the plan touches login or payments, ask for a smaller one.

  4. Make the database search fast (Supabase: Full-text search)

    Ask Claude for SQL that adds a generated tsvector column over the fields you chose and a GIN index on it, as Supabase's full-text search guide describes. Read it, then run it on a copy of your database first.

    Prompt to copy:

    Write SQL for Postgres on Supabase for table [table]: add a generated tsvector column fts built from [columns], then a GIN index on it. Add a comment line explaining each statement. Do not drop or change existing columns. Then list how to undo it.

    You get: A new search column and index, tested on the copy.

    Tip: Search several columns through one generated column, because the JavaScript client's textSearch works on one column at a time.

  5. Build the search box and filters (Replit: Replit Agent)

    Approve the plan and ask Agent to add the search box using textSearch on the new column plus the filters from the spec. Test the five real searches and the empty result before moving on.

    Prompt to copy:

    Approved. Add the search box and filters from the plan. Use the fts column with the Supabase textSearch filter in websearch mode. Show a clear message when nothing matches. Do not change other screens. Tell me which files changed.

    You get: Working search and filters in the preview.

    Tip: Type quotes and a minus sign in your search test: websearch mode supports them.

  6. Test with realistic volume (Claude: Chat)

    Ask Claude for a test list: slow cases, odd characters, empty search, many results. Run it on the copy with as many rows as production, and publish only after it passes and a person reviews the change.

    Prompt to copy:

    Write a test checklist for the search and filter feature on [table]: very common words, quotes, minus signs, accents, empty search, filter plus search, a thousand or more rows. For each, say what a pass looks like. Add three ways I can tell the search is slow.

    You get: A test list and a go or no-go decision.

    Tip: Test with the volume you expect in a year, not today.

Where this goes wrong

  • The search runs on your database, so an index on the wrong column does nothing: test every query you promised.
  • Do not paste real user data, passwords, API keys or connection strings into a prompt: columns and made-up examples are enough.
  • A schema change affects live data. Run it on a copy first and keep a way to undo it.
  • Plan Mode needs Replit Core or above, and Replit's checkpoint page does not say which plans include checkpoints, so check yours before you rely on them.

Swap a tool

  • Lovable instead of Replit: If your app is built in Lovable, give it the same spec and ask for a plan first.

Sources

More like this

Updated . Written with AI help and checked by an independent review step, as described in our editorial standards.