A community based topic aggregation platform built on atproto
1package routes
2
3import (
4 "Coves/internal/api/handlers/discover"
5 discoverCore "Coves/internal/core/discover"
6
7 "github.com/go-chi/chi/v5"
8)
9
10// RegisterDiscoverRoutes registers discover-related XRPC endpoints
11//
12// SECURITY & RATE LIMITING:
13// - Discover feed is PUBLIC (no authentication required)
14// - Protected by global rate limiter: 100 requests/minute per IP (main.go:84)
15// - Query timeout enforced via context (prevents long-running queries)
16// - Result limit capped at 50 posts per request (validated in service layer)
17// - No caching currently implemented (future: 30-60s cache for hot feed)
18func RegisterDiscoverRoutes(
19 r chi.Router,
20 discoverService discoverCore.Service,
21) {
22 // Create handlers
23 getDiscoverHandler := discover.NewGetDiscoverHandler(discoverService)
24
25 // GET /xrpc/social.coves.feed.getDiscover
26 // Public endpoint - no authentication required
27 // Shows posts from ALL communities (not personalized)
28 // Rate limited: 100 req/min per IP via global middleware
29 r.Get("/xrpc/social.coves.feed.getDiscover", getDiscoverHandler.HandleGetDiscover)
30}