Real-time crypto alerts: watch X accounts for keywords (official X filtered stream), price targets on Binance, and get notified on Telegram, Discord, email or SMS.
- Next.js 16 (App Router, Node runtime) with long-running background workers in
src/instrumentation.ts - Better Auth (email/password + Google) on Postgres
- Supabase (Postgres + PostgREST) accessed server-side with the service role key
- X API v2 filtered stream (pay-per-use), Binance REST + WebSocket, Telegram Bot API
- Optional: OpenAI for tweet sentiment, Resend for email, Telnyx for SMS
- Active social alerts are turned into X stream rules, one per watched account:
from:handle (kw1 OR "two words") -is:retweet -is:reply -is:quote. Keywords of every user watching the same account are merged into one rule. - X pushes only the posts matching a rule. Each delivered post is billed by X (about $0.005).
We request
created_atandreferenced_tweetsonly, no user expansions. - The pipeline claims the tweet id in
processed_tweets(survives restarts, no double notify), matches per alert with word-boundary keyword matching, runs optional AI sentiment, notifies. - Cost locks: plan limits (
src/lib/config/plan-limits.ts) cap watched accounts, keywords per alert, replies opt-in, monthly delivered posts per user (counted per delivered post inuser_stream_usage, which is what X bills) and monthly SMS (Telegram takes over past the quota);X_STREAM_MONTHLY_POST_CAPis a global kill switch, size it to the sum of paying quotas;X_STREAM_MAX_RULESstays under the 1000-rule pay-per-use limit.
Price alerts are evaluated by a single server worker (src/lib/services/price/price-alert-worker.ts)
fed by one Binance WebSocket; dashboards subscribe to it over SSE (/api/alerts/stream).
cp .env.example .envand fill in the values. Never commit.env.npm install- Create the auth tables first, then the app tables:
npx @better-auth/cli migrate npx supabase migration up
- Register the Telegram webhook (needs a public https URL and
TELEGRAM_WEBHOOK_SECRET):npm run telegram:webhook -- https://your-domain.com
npm run dev
The X stream and the price worker start with the server. They need a persistent Node process (one X connection per project), not a serverless deployment.
| Command | Purpose |
|---|---|
npm run dev / build / start |
Next.js |
npm test |
Vitest + msw suite (tests/): X stream, price worker, SSE, webhook |
npm run type-check |
tsc --noEmit |
npm run lint |
oxlint |
npm run telegram:webhook -- <url> |
Register the Telegram webhook (--info to inspect) |
In development, POST /api/ingest/tweets lets you push fake tweets through the pipeline without X
(disabled in production).
| | Free | Pro | Premium |
| Price | 0 € | 9 € | 39 € |
|---|---|---|---|
| Alerts (social + price) | 2 | 10 | 50 |
| X accounts watched | 1 | 5 | 25 |
| Keywords per alert | 3 | 10 | 20 |
| Matched tweets / month | 40 | 500 | 3000 |
| SMS / month | 0 | 30 | 150 |
| Replies and quotes | no | no | yes |
| Channels | Telegram | all | all |
| REST API | no | no | yes |
Limits live in src/lib/config/plan-limits.ts and are enforced server-side.