DegenFeed is built on a modern edge computing stack. The frontend runs on Next.js (Cloudflare Pages), the API on Cloudflare Workers, and caching on Cloudflare KV. This architecture provides global low-latency access with zero server management.
┌==========================================================================┐
│ Users │
│ Browser (Desktop/PWA) / API Clients │
└=============================┬============================================┘
│ HTTPS
▼
┌==========================================================================┐
│ Cloudflare Pages (Edge) │
│ ┌====================================================================┐ │
│ │ Next.js 15 / React 19 │ │
│ │ Shell Layout │ Feed Pages │ Docs │ Settings │ Auth │ News │ │
│ └====================================================================┘ │
└=============================┬============================================┘
│ /api/*
▼
┌==========================================================================┐
│ Cloudflare Worker (65 endpoints) │
│ │
│ ┌==============┐ ┌==============┐ ┌==============┐ ┌============┐ │
│ │ Feed Router │ │ Auth Service │ │ Search │ │ KV Cache │ │
│ │ (ranking, │ │ (SIWE, │ │ (cross- │ │ (feed, │ │
│ │ dedup, │ │ OAuth, │ │ protocol) │ │ rate │ │
│ │ filtering) │ │ session) │ │ │ │ limiting) │ │
│ └======┬=======┘ └======┬=======┘ └======┬=======┘ └============┘ │
│ │ │ │ │
│ ▼ ▼ ▼ │
│ ┌==================================================================┐ │
│ │ Provider Layer │ │
│ │ Nostr │ Farcaster │ Lens │ Bluesky │ Mastodon │ Lemmy │ │
│ │ Threads │ Reddit │ RSS │ GotoSocial │ │
│ └==================================================================┘ │
└=============================┬============================================┘
│
┌====================┼====================┐
▼ ▼ ▼
┌==============┐ ┌==============┐ ┌==================┐
│ Nostr │ │ Farcaster │ │ External APIs │
│ Relay Pool │ │ Hub (gRPC) │ │ Lens / Bluesky │
│ (10 relays) │ │ + REST │ │ / Mastodon │
└==============┘ └==============┘ └==================┘
Every feed request goes through a carefully orchestrated pipeline that balances speed, freshness, and reliability.
Provider adapters fetch posts from each protocol in parallel. Nostr uses WebSocket relay subscriptions, Farcaster uses gRPC Hub connections, and others use REST APIs. Each provider caches raw data in KV for 60 seconds.
Raw posts are normalized into UnifiedPost objects. The pipeline applies spam filtering, niche classification, content type detection, and 11-layer deduplication. Ranked posts are cached in KV with a 30-second TTL.
The frontend receives ranked posts via JSON responses. Client-side IndexedDB caches feed data for offline support. SSE (Server-Sent Events) enables real-time updates for the stream endpoint.
DegenFeed uses a Turborepo monorepo managed with pnpm. The structure separates concerns cleanly into application, worker, and package layers.
apps/webNext.js 15 App Router frontend (Cloudflare Pages)workers/apiCloudflare Worker with 65+ endpointspackages/typesUnifiedPost, UnifiedIdentity, Protocol typespackages/feed-coreNormalization, 11-layer dedup, spam, niches, language detectionpackages/feed-providers10 protocol adapter implementationspackages/ranking7-factor transparent scoring enginepackages/identityCross-protocol handle resolutionpackages/authSIWE + Solana + Nostr/Farcaster/Lens sign-inpackages/storageIndexedDB client with 10 object storespackages/uiReact components (PostCard, ComposeModal, etc.)packages/nostr-sdkNostr SDK (NIP-01/05/19/46 + RelayPool)packages/farcaster-sdkHub client + protobuf signingpackages/lens-sdkLens API v2 GraphQL clientpackages/bluesky-sdkAT Protocol XRPC clientpackages/mastodon-sdkGotoSocial/Mastodon REST clientpackages/rss-sdkRSS/Atom with 6 source adapterspackages/threads-sdkThreads AT Protocol wrapperCloudflare KV is used for distributed caching, session storage, and rate limiting. Two KV namespaces provide global consistency across all worker isolates.
| Key Pattern | TTL | Purpose |
|---|---|---|
| feed_cache:{key} | 30s | Aggregated feed response cache |
| provider_cache:{p}:{key} | 60s | Per-protocol raw data cache |
| post:{protocol}:{id} | 1h | Individual post O(1) lookup |
| ratelimit:{ip}:{window} | 5s | Rate limit tracking window |
| session:{id} | 24h | User session data |
| prefs:{userId} | 1h | User preferences (ranking weights, filters) |
| circuit:{provider} | 2min | Circuit breaker state per provider |
11 layers prevent the same content from appearing multiple times in your feed, even when cross-posted across multiple protocols.
DegenFeed deploys to Cloudflare’s edge network. The frontend uses Cloudflare Pages (via @cloudflare/next-on-pages) and the API runs as a Cloudflare Worker.
# Build and deploy frontend
pnpm build
npx wrangler pages deploy apps/web --project-name degenfeed-web
# Deploy API worker
npx wrangler deploy workers/api/src/index.ts --name degenfeed-api
# Deploy both (from root)
pnpm run deployEvery post is scored by a transparent 7-factor model. Each component is exposed in the API response so users can see exactly why a post appears where it does.
12-hour half-life exponential decay. Posts decay to 50% score after 12 hours.
log(1 + likes + 2x reposts + 3x replies + 4x quotes). Log scaling prevents viral domination.
keywordRelevance x nicheRelevance x platformRelevance. 200+ crypto terms + 60 tech/AI terms.
sourceQuality (followerCount-based) + followed-author boost (+1.2).
Penalizes repeat authors. -0.2 per extra post after 3, capped at -0.8.
Protocol tier weight. Nostr/Farcaster/Lens/Lemmy = 1.0, Threads = 0.7, RSS = 0.6.
Engagement rate-of-change vs previous snapshot. Trending-now posts get up to 3x boost.
Multiplier for very recent content: 2.0x for <15min, 1.5x for <1h, 1.2x for <2h.
1.2x multiplier for posts with image or video embeds.
Penalty for low-effort posts: single-word (0.3x), emoji-spam (0.2x), all-caps (0.3x).
?sort=new to bypass ranking entirely and see chronological order.Architecture questions? [email protected]