Skip to content

Real-time Hacker News story stream built with Go, Server-Sent Events (SSE), and Tailwind CSS. Live feed of top, new, best, ask, and show stories with scores and discussion links.

Notifications You must be signed in to change notification settings

smart-developer1791/go-hn-live

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📡 HN Live

Go SSE Tailwind Render

Real-time Hacker News story stream built with Go, Server-Sent Events, and Tailwind CSS.

✨ Features

  • 🔴 Live streaming of Hacker News stories via SSE
  • 📂 Multiple categories: Top, New, Best, Ask HN, Show HN, Jobs
  • 📊 Real-time stats: story count, total points, average score
  • 🎨 Beautiful dark UI with HN orange accents
  • Lightweight single binary deployment
  • 🔗 Direct links to articles and HN discussions

🛠️ Tech Stack

Component Technology
Backend Go + Chi Router
Streaming Server-Sent Events
Frontend Tailwind CSS
API Hacker News Firebase API

🚀 Quick Start

Clone the repository:

git clone https://github.com/smart-developer1791/go-hn-live
cd go-hn-live

Initialize dependencies and run:

go mod tidy
go run .

Open your browser:

http://localhost:8080

📁 Project Structure

go-hn-live/
├── main.go          # Application entry point
├── go.mod           # Go module file
├── render.yaml      # Render deployment config
├── .gitignore       # Git ignore rules
└── README.md        # Documentation

🔌 API Endpoints

Endpoint Description
GET / Main web interface
GET /stream?category=top SSE story stream
GET /health Health check endpoint

Stream Categories

  • top - Top stories (default)
  • new - Newest stories
  • best - Best stories
  • ask - Ask HN posts
  • show - Show HN posts
  • job - Job postings

🌐 Environment Variables

Variable Default Description
PORT 8080 Server port

📡 SSE Event Format

{
  "ID": 12345678,
  "Title": "Show HN: My new project",
  "URL": "https://example.com",
  "Domain": "example.com",
  "By": "username",
  "Score": 142,
  "Comments": 53,
  "TimeAgo": "2 hours ago",
  "HNLink": "https://news.ycombinator.com/item?id=12345678"
}

🎯 Dependencies

github.com/go-chi/chi/v5 - Lightweight HTTP router

Deploy in 10 seconds

Deploy to Render

About

Real-time Hacker News story stream built with Go, Server-Sent Events (SSE), and Tailwind CSS. Live feed of top, new, best, ask, and show stories with scores and discussion links.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages