···4455<img src="https://cachet.dunkirk.sh/emojis/ycombinator/r" height="175" align="right" alt="ycombinator logo">
6677-A Slack bot that tracks when you make it to the front page of Hacker News, made with ๐ @ [Hack Club](https://github.com/hackclub)
77+> ### Your personal Hacker News success tracker ๐ ๐ ๐
88+> A slack bot that tracks when you make it to the front page of Hacker News; developed with ๐ @ [Hack Club](https://github.com/hackclub)
99+>
1010+> โ ๏ธ **Highly optionated / mad teenager rants at computer warning** - From "I wish I had this" to "now we all do"
81199-## ๐ Features
1212+## ๐ฅ What it does
10131111-- **Front Page Tracking**: Get notified when your posts reach the Hacker News front page
1212-- **#1 Post Alerts**: Special notifications when your post reaches the coveted #1 position
1313-- **Leaderboard History**: Track how your posts perform over time with rank and point history
1414-- **Web Dashboard**: View all currently tracked stories and their stats
1515-- **Individual Story Pages**: View detailed information about any story using HN-compatible URLs
1616-- **User Verification**: Securely link your HN account with Slack using verification phrases
1414+HN Alerts watches Hacker News for you and anyone else that chooses to trust your instructions to run `/hn-alerts-link`, notifying you through Slack when:
17151818-## ๐ง Development Setup
1616+- Your posts appear on the front page (top 30)
1717+- Your posts climb the rankings
1818+- Your posts reach the coveted #1 position ๐
1919+- Any significant changes to your post's performance
19202020-### Prerequisites
2121-2222-- [Bun](https://bun.sh/) (JavaScript runtime and package manager)
2323-- PostgreSQL database
2424-- Ngrok for local development with Slack
2121+The dashboard provides:
2222+- Real-time position tracking with historical graphs
2323+- Performance metrics (peak position, time on front page, comment activity)
2424+- Leaderboard of all tracked stories
2525+- Detailed analytics for each post's journey
2626+- An excellent caching mechanism (this took me so very long to implement)
25272626-### Local Development
2828+## ๐ง Dev
27292828-1. Clone the repository:
3030+You can launch the bot locally with bun
29313032```bash
3131-git clone https://github.com/taciturnaxolotl/hn-alerts.git
3232-cd hn-alerts
3333+bun install
3434+bun dev
3335```
34363535-2. Install dependencies:
3737+you will also need to launch an ngrok tunnel and update your dev slack manifest to point to the ngrok tunnel
36383739```bash
3838-bun install
4040+bun ngrok
3941```
40424141-3. Create a `.env` file with the following variables:
4343+you also need to create a `.env` file with the following keys
42444345```bash
4446SLACK_BOT_TOKEN="xoxb-xxxxx-xxxxx-xxxxx-xxxxx"
···4648SLACK_CHANNEL="C08KX2YNN87"
4749NODE_ENV="dev"
4850SENTRY_DSN="https://xxxxxx@xxxxxx.ingest.us.sentry.io/xxxx"
4949-DATABASE_URL="postgres://user:password@host:5432/table_name"
5051```
51525252-4. Initialize the database schema:
5353+Don't forget to initialize your database:
53545455```bash
5556bun db:push
5657```
57585858-5. Start the development server:
5959-6060-```bash
6161-bun dev
6262-```
6363-6464-6. In a separate terminal, launch ngrok to expose your local server:
6565-6666-```bash
6767-bun ngrok
6868-```
6969-7070-7. Update your Slack app's manifest in `manifest.dev.yaml` to point to your ngrok URL
7171-7259## ๐ฑ Slack Commands
73607461- `/hn-alerts-link your_username` - Link your Hacker News account
7575-- `/hn-alerts-link verify` - Verify your Hacker News account
6262+- `/hn-alerts-link verify` - Verify your Hacker News account (post the challenge code to your HN profile)
7663- `/hn-alerts-link unlink` - Remove your linked account
7764- `/hn-alerts-link help` - Show command help
78657979-## ๐งฐ Tech Stack
8080-8181-- [Bun](https://bun.sh/) - JavaScript runtime and package manager
8282-- [Slack Edge](https://github.com/slack-edge/slack-edge) - Slack API client
8383-- [Drizzle ORM](https://orm.drizzle.team/) - Database ORM
8484-- [Sentry](https://sentry.io/) - Error tracking
8585-- [Cron](https://github.com/kelektiv/node-cron) - Scheduled tasks
8686-8766## ๐ License
88678989-The code is licensed under `MIT`! See the [LICENSE.md](LICENSE.md) file for more details.
6868+The code is licensed under `MIT`! That means MIT allows for free use, modification, and distribution of the software, requiring only that the original copyright notice and disclaimer are included in copies.
90699170<p align="center">
9271 <img src="https://raw.githubusercontent.com/taciturnaxolotl/carriage/master/.github/images/line-break.svg" />
+4-4
public/index.html
···5050 <meta property="og:title" content="HN Alerts Dashboard" />
5151 <meta
5252 property="og:description"
5353- content="Real-time monitoring and analytics for Hacker News stories. Track performance metrics and get alerts for trending posts."
5353+ content="Your personal Hacker News tracker! Get notified when your posts hit the front page and track their performance in real-time!"
5454 />
5555 <meta property="og:image" content="/public/og.png" />
5656 <meta
5757 property="og:image:alt"
5858- content="HN Alerts - Real-time Hacker News Monitoring"
5858+ content="a screenshot of the app with graphs for my friend cyao's ice pi!"
5959 />
6060 <meta property="og:image:width" content="1200" />
6161 <meta property="og:image:height" content="630" />
···6666 <meta name="twitter:title" content="HN Alerts Dashboard" />
6767 <meta
6868 name="twitter:description"
6969- content="Real-time monitoring and analytics for Hacker News stories. Track performance metrics and get alerts for trending posts."
6969+ content="Your personal Hacker News tracker! Get notified when your posts hit the front page and track their performance in real-time!"
7070 />
7171 <meta name="twitter:image" content="/public/og.png" />
7272 <meta
7373 name="twitter:image:alt"
7474- content="HN Alerts - Real-time Hacker News Monitoring"
7474+ content="a screenshot of the app with graphs for my friend cyao's ice pi!"
7575 />
76767777 <link
+6-8
public/item.html
···6262 />
6363 <meta
6464 property="og:description"
6565- content="Detailed analytics and performance tracking for individual Hacker News stories. View engagement metrics, rankings, and real-time data."
6666- id="og-description"
6565+ content="Real-time monitoring and analytics for Hacker News stories. Track performance metrics and get alerts for trending posts."
6666+ content="Your personal Hacker News tracker! Get notified when your posts hit the front page and track their performance in real-time!"
6767 />
6868 <meta property="og:image" content="/public/og.png" />
6969 <meta
7070 property="og:image:alt"
7171- content="HN Alerts - Story Performance Tracking"
7272- id="og-image-alt"
7171+ content="a screenshot of the app with graphs for my friend cyao's ice pi!"
7372 />
7473 <meta property="og:image:width" content="1200" />
7574 <meta property="og:image:height" content="630" />
···8483 />
8584 <meta
8685 name="twitter:description"
8787- content="Detailed analytics and performance tracking for individual Hacker News stories. View engagement metrics, rankings, and real-time data."
8888- id="twitter-description"
8686+ content="Real-time monitoring and analytics for Hacker News stories. Track performance metrics and get alerts for trending posts."
8787+ content="Your personal Hacker News tracker! Get notified when your posts hit the front page and track their performance in real-time!"
8988 />
9089 <meta name="twitter:image" content="/public/og.png" />
9190 <meta
9291 name="twitter:image:alt"
9393- content="HN Alerts - Story Performance Tracking"
9494- id="twitter-image-alt"
9292+ content="a screenshot of the app with graphs for my friend cyao's ice pi!"
9593 />
96949795 <link