You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CryptoAlert is a Next.js web app that monitors cryptocurrency and stock prices and sends Telegram notifications when user-configured alert conditions are met.
Cooldown: prevents repeated notifications. If an alert fires at 10:00 with a 60-minute cooldown, the next earliest it can fire again is 11:00, regardless of how often the cron runs.
API Routes Reference
Method
Path
Auth
Description
POST
/api/auth/start
none
Create auth token, return Telegram deep link
GET
/api/auth/telegram
Telegram hash
OAuth callback — set session cookie
GET
/api/auth/poll
none
Poll token verification status
POST
/api/telegram/webhook
Bot token
Handle Telegram updates (/start, /alerts)
GET
/api/search
session
Search coins via CoinGecko
GET
/api/stock-search
session
Search stocks via Finnhub
GET
/api/stock-lookup
session
Look up stock via Finnhub
POST
/api/cron/check-alerts
x-cron-secret
Evaluate alerts, send notifications
The /portfolio page (server component) fetches all lots for the user, resolves live prices via getStockPrices, aggregates lots into positions, and passes computed metrics to PortfolioClient.
Shared Modules
shared/api/supabase.ts
supabase — browser/RSC client (anon key)
getAdminClient() — server-only client (service role key, bypasses RLS)
searchStocks(query) — search US common stocks, 60s cache
lookupStock(ticker) — returns { symbol, name } via /stock/profile2, 5min cache
getStockPrices(symbols[]) — parallel /quote calls per symbol, cached 120s; usd_1h_change is always 0 (not needed for display)
getStockHourlyChanges(symbols[]) — parallel /stock/candle calls (1h resolution, last 2 hours); no cache — used by cron only for tickers with active 1h alerts
NotificationLog — read-only table of sent notifications
features/portfolio
AddLotForm — modal dialog for adding or editing a purchase lot; includes stock search via /api/stock-search
HoldingsTable — desktop table + mobile cards; positions grouped by stock with expandable lot rows; shows shares, avg cost, current price, market value, unrealized P&L
PortfolioSummary — three-card summary row: total value, total cost, total P&L