# hn-search

> Full-text search over 49M Hacker News items using Neon Postgres BM25

hn-search is an open-source Next.js application that provides real-time full-text search across ~49 million Hacker News stories, comments, jobs, and polls. Instead of relying on external search platforms like Elasticsearch or Algolia, it runs native BM25 ranking directly inside Neon Lakebase Postgres using SQL-over-HTTP. It serves as a practical architectural reference for high-performance, in-database text search on large Postgres datasets.

Website: https://github.com/rishi-raj-jain/hn-search

## What it is for

- Search the full Hacker News archive including stories, comments, and polls
- Study how to implement native BM25 full-text ranking directly inside PostgreSQL
- Learn database optimization patterns like partial indexes and SQL-over-HTTP with serverless Postgres

## Features

- In-database BM25 ranking using Neon Lakebase Postgres
- Type-specific partial BM25 and GIN indexes to prevent ranking candidate exhaustion
- Stateless SQL-over-HTTP database querying via Neon serverless driver
- Streaming UI built with Next.js App Router and React Server Components
- Typo tolerance and auto-correction using pg\_trgm and fuzzystrmatch
- Background sync cron job pulling new Hacker News items regularly

## Pricing

Open source

## Details

- Type: GitHub repo
- Category: [Development](https://xiry.app/topics/development.md)
- Open source: yes
- Platforms: Web, Self-hosted
- For: Postgres developers, backend engineers, and Next.js developers exploring in-database search architectures.
- Alternative to: Algolia HN Search
- Tags: postgres, bm25, nextjs, full text search, neon, hackernews, sql

## Why it was saved

- [@rishi_raj_jain_, 14 September 2026](https://x.com/rishi_raj_jain_/status/2099387257354584289): Lets you read or copy the implementation of a fast search stack: Neon Postgres, in-database BM25 via Lakebase Search, SQL-over-HTTP, pg\_prewarm, partial indexes, Vercel deployment.

## Related

- [hnfaster](https://xiry.app/resources/hnfaster): Fast full-text search across 49M Hacker News items using Postgres BM25 (Web app, Free)
- [Supabase Stripe Wrapper](https://xiry.app/resources/supabase-stripe-wrapper): PostgreSQL foreign data wrapper to query and write Stripe data via SQL (Web app, Open source)
- [Natural Language Postgres](https://xiry.app/resources/natural-language-postgres): Query a Postgres database with natural language and visualize results. (Web app, Open source)
- [Natural Language Postgres Guide](https://xiry.app/resources/natural-language-postgres-guide): Build a Next.js app to query PostgreSQL using natural language (Article or course, Free)
- [shadcn/ui](https://xiry.app/resources/shadcn-ui-1902): Copy-paste React UI components built with Tailwind CSS and Radix primitives. (Website, Open source)
- [Efferd](https://xiry.app/resources/efferd): Pre-built, responsive shadcn/ui blocks and layouts for React applications (Web app, Freemium)

Updated 10 October 2026. Page: https://xiry.app/resources/hn-search

Make your own library: Xiry takes your saved reels, tweets, Reddit bookmarks and Watch Later videos, makes them searchable and pulls the useful stuff out, like this library. It's invite-only for now; join the waitlist at https://xiry.app/#waitlist.
