opentrends
Health Pass
- License — License: MIT
- Description — Repository has a description
- Active repo — Last push 0 days ago
- Community trust — 69 GitHub stars
Code Pass
- Code scan — Scanned 12 files during light audit, no dangerous patterns found
Permissions Pass
- Permissions — No dangerous permissions requested
No AI report is available for this listing yet.
Open-source information radar for people and AI: first-hand AI & tech news, the same story merged across outlets, daily summaries in 8 languages, plus an API and MCP server for agents.
OpenTrends
OpenTrends is an open-source AI trend-reading app for following first-party
information across technology, AI, product, finance, crypto, Chinese web
platforms, and developer communities.
It is designed to track hundreds of primary sources, translate them into the
reader's native language, and quickly summarize what changed so you can read
global first-hand information without switching context across sites and
languages.
Features
- Curated topic pages designed for hundreds of first-party and official sources
- RSS, RSSHub, Hacker News, GitHub Trending, Reddit, Product Hunt, Zhihu, Juejin,
NewsNow, Kickstarter, Crowd Supply, and Qwen Research adapters - AI translation for reading source material in your native language
- Fast AI summaries that condense noisy source updates into a readable brief
- Cross-language topic pages for following global information flows without
losing the original source context - Source status endpoints and per-source refresh behavior
- Hot trend page caching through the runtime cache/KV layer plus in-memory
request caching - Native Cloudflare D1, KV, and Queues runtime
- Alchemy-managed local Cloudflare development and deployment
- Built for agents too: a public JSON API, the digest as structured data
(/api/trends/:topic/summary?format=json),llms.txt, an agent skill and an
MCP server (packages/mcp)
Repository Layout
opentrends/
├── apps/
│ ├── server/ # Hono API, trend adapters, source refresh, summaries
│ ├── web/ # TanStack Start frontend
│ └── fumadocs/ # Documentation app experiments
├── packages/
│ ├── api/ # oRPC router layer
│ ├── auth/ # Better Auth config
│ ├── config/ # Shared TypeScript config
│ ├── db/ # Drizzle schema, migrations, dev DB helpers
│ ├── env/ # Shared env validation
│ ├── infra/ # Cloudflare/Alchemy deployment entrypoint
│ ├── mcp/ # MCP server over the public API (opentrends-mcp)
│ └── ui/ # Shared shadcn/ui components and styles
└── docs/ # Design and implementation notes
Requirements
- Bun 1.3.x
- A Cloudflare account (only required for cloud deployment)
Local Development
Install dependencies:
bun install --frozen-lockfile
cp apps/server/.env.example apps/server/.env.local
cp apps/web/.env.example apps/web/.env.local
cp packages/infra/.env.example packages/infra/.env.local
Set BETTER_AUTH_SECRET to a random local value. Alchemy also needsALCHEMY_PASSWORD to encrypt local state; inject it through a password manager
or a temporary environment variable and never commit it. The Cloudflare values
in the infra example are local Miniflare placeholders with no cloud access.
Start the local Cloudflare stack:
bun run dev
The API runs on http://localhost:3000.
The web app runs on http://localhost:3001.
Alchemy creates local D1, KV, and Queues resources and applies the fresh D1
schema to an empty database. No PostgreSQL data is imported.
Environment
Server env is validated in packages/env/src/server.ts.
At minimum, configure:
BETTER_AUTH_SECRETBETTER_AUTH_URLCORS_ORIGIN
Optional trend and summary settings include:
RSSHUB_BASE_URLSLLM_BASE_URLLLM_API_KEYLLM_MODELLLM_TRANSLATION_MODELLLM_ENABLE_THINKINGTRENDS_REFRESH_SCHEDULERGA4_PROPERTY_ID,GA4_SERVICE_ACCOUNT_JSON(secret),STATS_API_KEY
(secret),STATS_SITE_HOSTS: the read-only site statistics endpoint below.
The first three must all be set; otherwise/api/stats/*answers 503{"error":"stats_not_configured"}and nothing else changes.
Alchemy injects VITE_SERVER_URL into the web app. Optionally configure:
VITE_SITE_URLVITE_AI_EVENTS_URL: an AI events calendar linked from the header for
Chinese readers. Unset, the header has no events link.VITE_GA_MEASUREMENT_ID,VITE_AHREFS_ANALYTICS_KEY: site analytics.
Unset, no analytics script is loaded. GA4 runs only on the host ofVITE_SITE_URLand skips visitors who send Do Not Track or Global Privacy
Control.
Site statistics for bots (optional)
A server-to-server, read-only view of Google Analytics 4 so a bot can report
daily numbers. Send Authorization: Bearer <STATS_API_KEY>; responses areCache-Control: private, no-store and have no CORS headers.
GET /api/stats/daily?date=YYYY-MM-DD&site=opentrends|aievents|all: one
document for a day.datedefaults to yesterday in Asia/Shanghai.GET /api/stats/range?start=&end=&site=: daily series of the totals, at
most 92 days.GET /api/stats/realtime: active users in the last 30 minutes, in total
and by page (no per-event breakdown; use/dailyfor events).
Daily response, trimmed:
{
"date": "2026-12-04", "site": "all", "complete": false,
"dataFreshness": "provisional",
"summary": ["All sites had 120 users, ..."],
"notes": ["Visitors who block analytics ... are not counted ..."],
"totals": { "users": 120, "newUsers": 90, "sessions": 150, "pageViews": 400,
"engagedSessions": 105, "engagementRate": 0.7, "averageEngagementSeconds": 30 },
"comparison": { "previousDay": {}, "sevenDayAverage": {},
"changeVsPreviousDay": { "users": 0.2 }, "changeVsSevenDayAverage": {} },
"topPages": [{ "path": "/", "pageViews": 90, "users": 70, "averageEngagementSeconds": 42.9 }],
"traffic": { "channels": [], "bySessionSource": [{ "source": "aievents", "sessions": 30, "users": 25 }] },
"countries": [], "devices": [], "events": [{ "event": "page_view", "count": 400, "users": 120 }],
"choiceDimension": true, "eventChoices": { "change_layout": [{ "choice": "stream", "count": 5, "users": 4 }] },
"outboundClicks": [{ "domain": "github.com", "clicks": 7, "users": 5 }],
"crossSiteFunnel": { "openAiEventsClicksOnOpentrends": 5,
"aieventsSessionsFromOpentrends": 12, "opentrendsSessionsFromAievents": 30 },
"scrollDepthDimension": true, "scrollDepth": [{ "percent": 25, "count": 30, "users": 28 }]
}
Rates are fractions from 0 to 1; change* values are fractions of the
baseline (0.2 is +20%, null when the baseline is 0). Lists are sorted by
count, descending. complete: false means GA4 may still add data (it can take
24 to 48 hours); finished days are cached for 30 days, recent ones for an hour,
realtime for 60 seconds. The property is shared with other sites, so every
report is limited to the hosts in STATS_SITE_HOSTS (defaultopentrends=opentrends.io,www.opentrends.io;aievents=aievents.yytyyf.com).eventChoices, eventLinkAreas and scrollDepth need the event parameterschoice, link_area and percent_scrolled registered as event-scoped custom
dimensions in GA4 Admin; without them the blocks are omitted and the matching*Dimension flag is false. Errors: 401 bad key, 400 bad parameters, 502ga4_auth_failed, ga4_permission_denied or ga4_quota.
Caching
Trend pages use a short in-memory cache and the shared hot cache/KV abstraction
in apps/server/src/trends/cache/hot-cache.ts. Source snapshots are stored
through the source cache layer.
There is no checked-in bootstrap data cache. Runtime data should be generated
by refresh jobs or requests and stored through the configured cache/storage
backend.
Useful Commands
bun run dev # Start local D1, KV, Queues, API, and web
bun run db:generate # Generate a Drizzle migration
bun run check-types # Typecheck workspaces
bun test # Run tests
bun run check # Run Ultracite/Biome checks
bun run build # Build workspaces
Deployment
The Cloudflare/Alchemy entrypoint is packages/infra/alchemy.run.ts. Runbun run cloudflare:login, inject production configuration securely, then runbun run --filter @opentrends/infra deploy. When WEB_CUSTOM_DOMAIN orAPI_CUSTOM_DOMAIN is configured, Alchemy manages the corresponding Cloudflare
Custom Domain, DNS and TLS certificate in CLOUDFLARE_ZONE_ID. WithWEB_CUSTOM_DOMAIN=opentrends.io, it also provisions www.opentrends.io and a
308 redirect to the HTTPS main domain, preserving paths and query strings.
See www deployment verification before deploying.
License
MIT
Reviews (0)
Sign in to leave a review.
Leave a reviewNo results found