steven-tey/chathn

Chat with Hacker News using natural language. Built with OpenAI Functions and Vercel AI SDK.

1,181 stars TypeScript 7 components 8 connections

AI chatbot for querying Hacker News with natural language

User queries flow through OpenAI which calls HN API functions and streams back formatted responses

Under the hood, the system uses 1 feedback loop, 2 data pools, 3 control points to manage its runtime behavior.

Structural Verdict

A 7-component nextjs app with 8 connections. 10 files analyzed. Well-connected — clear data flow between components.

How Data Flows Through the System

User queries flow through OpenAI which calls HN API functions and streams back formatted responses

  1. User Input — User types natural language query in chat interface
  2. Rate Check — API route validates request against Redis rate limit (config: KV_REST_API_URL, KV_REST_API_TOKEN)
  3. OpenAI Processing — OpenAI determines which HN function to call based on user query (config: OPENAI_API_KEY)
  4. Function Execution — Selected function fetches data from Hacker News Firebase API
  5. Response Streaming — OpenAI formats and streams response back to client in real-time

System Behavior

How the system actually operates at runtime — where data accumulates, what loops, what waits, and what controls what.

Data Pools

Rate Limit Store (cache)
Redis store tracking API request counts per IP address
HN Firebase API (database)
External Hacker News story and comment data

Feedback Loops

Delays & Async Processing

Control Points

Technology Stack

Next.js (framework)
React framework with API routes
OpenAI (library)
GPT-4 with function calling for structured interactions
Vercel AI SDK (library)
Streaming chat interface and OpenAI integration
Upstash (infra)
Redis-based rate limiting
Vercel KV (database)
Key-value store for rate limit data
TailwindCSS (library)
Utility-first styling

Key Components

Explore the interactive analysis

See the full architecture map, data flow, and code patterns visualization.

Analyze on CodeSea

Related Nextjs App Repositories

Frequently Asked Questions

What is chathn used for?

AI chatbot for querying Hacker News with natural language steven-tey/chathn is a 7-component nextjs app written in TypeScript. Well-connected — clear data flow between components. The codebase contains 10 files.

How is chathn architected?

chathn is organized into 4 architecture layers: UI Layer, API Layer, Function Layer, Infrastructure. Well-connected — clear data flow between components. This layered structure enables tight integration between components.

How does data flow through chathn?

Data moves through 5 stages: User Input → Rate Check → OpenAI Processing → Function Execution → Response Streaming. User queries flow through OpenAI which calls HN API functions and streams back formatted responses This pipeline design reflects a complex multi-stage processing system.

What technologies does chathn use?

The core stack includes Next.js (React framework with API routes), OpenAI (GPT-4 with function calling for structured interactions), Vercel AI SDK (Streaming chat interface and OpenAI integration), Upstash (Redis-based rate limiting), Vercel KV (Key-value store for rate limit data), TailwindCSS (Utility-first styling). A focused set of dependencies that keeps the build manageable.

What system dynamics does chathn have?

chathn exhibits 2 data pools (Rate Limit Store, HN Firebase API), 1 feedback loop, 3 control points, 2 delays. The feedback loops handle recursive. These runtime behaviors shape how the system responds to load, failures, and configuration changes.

What design patterns does chathn use?

3 design patterns detected: Function Calling, Streaming Responses, Edge Runtime.

Analyzed on March 31, 2026 by CodeSea. Written by .