feat: add Farcaster Snaps 2.0 support as cast embeds#707
Conversation
Snaps are server-driven JSON UIs that render interactively in the feed. This adds detection via content negotiation (Accept header) and rendering via @farcaster/snap's SnapCard component, integrated into the existing embed pipeline as a fallback before OpenGraph previews. New files: - app/api/snap/fetch/route.ts - content negotiation proxy for snap detection - app/api/snap/submit/route.ts - proxy for authenticated snap POST requests - src/hooks/queries/useSnapFetch.ts - React Query hook for snap data - src/common/components/Embeds/SnapEmbed.tsx - snap rendering with SnapCard Modified: - OpenGraphImage.tsx - checks for snap support in parallel with OG metadata https://claude.ai/code/session_01FhvcmpoTVXYiaGXG5RFoQo
Build our own 16 snap components using herocast's existing shadcn/ui primitives and Tailwind, eliminating the @neynar/ui dependency while keeping @farcaster/snap for validation/schemas and @json-render/react for the rendering engine and state management. New files: - src/common/components/Snap/useSnapColors.tsx - color palette hook - src/common/components/Snap/catalog.ts - json-render catalog renderer - src/common/components/Snap/SnapView.tsx - main orchestrator (replaces SnapCard) - src/common/components/Snap/components/ - 16 snap component implementations Changed: - SnapEmbed.tsx - uses SnapView instead of SnapCard - OpenGraphImage.tsx - updated type import - Removed @neynar/ui dependency https://claude.ai/code/session_01FhvcmpoTVXYiaGXG5RFoQo
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Claude finished @hellno's task —— View job Code Review for Farcaster Snaps 2.0 SupportI'll review this PR covering code quality, security, performance, and best practices. Let me analyze the implementation systematically. Todo List:
🔒 Security AnalysisAPI Routes Security - Good practices identified:
|
Snaps are server-driven JSON UIs that render interactively in the feed.
This adds detection via content negotiation (Accept header) and rendering
via @farcaster/snap's SnapCard component, integrated into the existing
embed pipeline as a fallback before OpenGraph previews.
New files:
Modified:
https://claude.ai/code/session_01FhvcmpoTVXYiaGXG5RFoQo