Core Principles
Use SDK Actions for Cross-Client Compatibility
Always use official SDK functions instead of static URLs. Static URLs can break cross-client compatibility and may leave users unable to complete actions in your Mini App.Avoid using direct HTML links (
<a href="">
, <Link href="">
) or static URLs in your Mini App. These approaches don’t work consistently across different clients and can create poor user experiences.External Navigation
Opening External URLs
Usesdk.actions.openUrl()
to safely open external websites in the client’s in-app browser:
App.tsx
Composing Casts
Usesdk.actions.composeCast()
instead of composer intent URLs:
App.tsx
Best Practices
1. Prioritize SDK Actions
Before implementing any navigation or linking functionality:- Check if an official SDK action exists for your use case
- Use the SDK action instead of crafting custom URLs
- Test across multiple clients to ensure compatibility
2. Handle Unsupported Features Gracefully
When using features that may not be supported in all clients:App.tsx
3. Avoid Client-Specific URLs
Don’t hardcode URLs specific to particular clients (like Warpcast URLs). Instead, use SDK actions that work across all supported clients.Common Patterns
Navigation Buttons
NavigationComponent.tsx
Conditional Navigation
ConditionalNavigation.tsx
Migration Guide
If your Mini App currently uses static URLs or direct links, update them using these patterns:Current Implementation | Recommended SDK Action |
---|---|
<a href="https://external.com"> | sdk.actions.openUrl('https://external.com') |
window.open('https://farcaster.com/~/compose?text=...') | sdk.actions.composeCast({ text: '...', embeds: [...] }) |
Farcaster-specific deeplinks | Use appropriate SDK action |
Direct profile links | Use SDK actions for profile navigation when available |