The Read Hacker News directory and the Telegram bot behind @hacker_news_feed, built and served from one Bun/TypeScript project.
You can preview the directory without bot credentials or a database.
Bun/TypeScript with SQLite, targeting a small Hetzner cloud machine shared with designernewsbot.
The old Python version ran on Google App Engine.
Uses the Hacker News API to check top stories every 10 minutes and post stories scoring 150 or more.
Uses the Telegram Bot API sendMessage method.
Uses an internal shortener at readhacker.news.
/s/<id> redirects to articles; /c/<id> redirects to Hacker News discussions.
- Install Bun 1.4.4, clone this project, and run
bun install --frozen-lockfile. - Register a bot with BotFather and make it an administrator of your channel.
- Copy
.env.exampleto.env. SetTELEGRAM_BOT_TOKEN,TELEGRAM_CHAT_ID,DATABASE_URL, andBASE_URL; adjustPORTas needed. External environment values override the project-root.env; local/mode env files are not loaded. - For a new installation, run
bun run db:initonce. It refuses to overwrite an existing database. - Run
bun run build:prod, thenbun run startfor HTTP and schedulebun run cronevery 10 minutes from the project root, using a non-overlap lock. There is no HTTP/cronendpoint. - Keep this bot's database on persistent storage, shared by HTTP and cron
but separate from designernewsbot. Use SQLite-aware backups and exclude
databases and
.envfrom deployment copies. Serve public traffic through an HTTPS reverse proxy.
Use a separate database, BASE_URL=http://localhost:8080, and a test
channel such as @hacker_news_feed_st.
Run bun run dev, bun run test for offline tests, and
bun run check for typechecking.
Site source lives in app/ and builds into static/, served by the bot's HTTP server.
bun run site:dev # preview on http://localhost:9000; rebuilds on edits
bun run build:prod # build static/ before starting the HTTP serverFor a different domain, set SITE_ORIGIN when building:
SITE_ORIGIN=https://directory.example bun run build:prod. It sets the site's
canonical URL and is separate from the bot's BASE_URL; builds do not read .env.