Skip to content

feat: M7 — Firecrawl web search and article reader within the free tier - #7

Merged
EliseuSantos merged 2 commits into
feat/m6-polishfrom
feat/m7-firecrawl
Jul 10, 2026
Merged

feat: M7 — Firecrawl web search and article reader within the free tier#7
EliseuSantos merged 2 commits into
feat/m6-polishfrom
feat/m7-firecrawl

Conversation

@EliseuSantos

Copy link
Copy Markdown
Owner

Stacked on #6 (M6 polish). Merge order: #1 → … → #6 → this.

What

Adds the web as a content source via Firecrawl, engineered around the free plan (1,000 credits/month, no rollover; search = 2 credits per 10 results, scrape = 1 credit/page, 2 concurrent):

  • Worker proxy: GET /proxy/firecrawl/search?q= and GET /proxy/firecrawl/scrape?url= (bearer-auth'd, optional FIRECRAWL_API_KEY → 503 without it, same https-only/private-host rules as the RSS proxy).
  • Hard monthly budget in D1 (proxy_usage, migration 0002): guarded atomic increment that fails closed — past the ceiling the endpoints answer 429 without touching the API; cache hits never charge; a new month starts clean. Ceiling configurable via FIRECRAWL_MONTHLY_CREDITS.
  • Credit-saving caches: 6h per normalized search query, 7 days per article (Cache API seam, cache-hit proven in tests to skip both fetch and charge).
  • Connector web in the registry (article kind, fetch-injectable, failures → empty).
  • UI: web filter chip in the library with calm notes ('busca na web não configurada.' / 'limite mensal de busca atingido — renova no próximo mês.'); in-app reader at /library/read (minimal markdown rendering, 65ch measure, Literata) with 'abrir original →'; web content attached to topics and global-search hits route to the reader.

Tests

  • 13 new bun tests: wire-format mapping, cache-hit charges nothing, 429 exactly at the ceiling without an API call, month rollover, private-host blocklist, connector fixtures
  • Cypress 28 specs green — new web-content-loop.cy.ts (4): stubbed search → attach → in-app reader renders markdown → calm over-budget note

🤖 Generated with Claude Code

EliseuSantos and others added 2 commits July 10, 2026 15:03
- /proxy/firecrawl/search (2 credits, 6h cache) and /scrape (1 credit,
  7d cache), optional FIRECRAWL_API_KEY (503 absent)
- proxy_usage table (migration 0002): guarded monthly counter, cache
  hits never charge, 429 past the ceiling, new month starts clean
- FakeD1 now applies every migration; migrate tests track latest version

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ted)

- worker: /proxy/firecrawl/search (2 credits, 6h cache) and /scrape
  (1 credit, 7d cache); optional FIRECRAWL_API_KEY; monthly counter in
  d1 (proxy_usage) fails closed with 429, cache hits never charge
- connectors: 'web' source (article kind) via the authed proxy
- pwa: web filter chip + calm 503/429 notes, /library/read clean reader
  (minimal markdown render, 65ch, Literata), web content routed to the
  reader from topics and global search
- e2e web-content-loop.cy.ts (4 specs); deploy/readme/architecture docs

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@EliseuSantos
EliseuSantos merged commit 89c9724 into feat/m6-polish Jul 10, 2026
1 check passed
@EliseuSantos
EliseuSantos deleted the feat/m7-firecrawl branch July 10, 2026 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant