import { userService } from '@/lib/appwrite/services';
// Search by username
const users = await userService.searchUsers('alice');
// Get by exact username
const user = await userService.getUserByUsername('alice');
// Get by wallet
const user = await userService.getUserByWallet('0x123...');
// Check username availability
const available = await userService.isUsernameAvailable('newname');import { messagingService } from '@/lib/appwrite/services';
// Get or create direct conversation
const conversation = await messagingService.getOrCreateDirectConversation(
currentUserId,
targetUserId
);
// Get user's conversations
const conversations = await messagingService.getUserConversations(userId);import { giftingService } from '@/lib/appwrite/services';
// Get available gifts
const gifts = giftingService.getAvailableGifts();
// Get gifts by category
const emojiGifts = giftingService.getGiftsByCategory('emoji');
const cryptoGifts = giftingService.getGiftsByCategory('crypto');
// Get gifts by rarity
const legendaryGifts = giftingService.getGiftsByRarity('legendary');
// Send a gift
await giftingService.sendGift(
conversationId,
senderId,
'unicorn', // giftId
'Happy birthday!' // optional message
);import { userService, giftingService } from '@/lib/appwrite/services';
// Profile QR code
const profileQR = userService.generateQRCodeData('alice', '0x123...');
// Payment QR code
const paymentQR = giftingService.generatePaymentQRCode({
recipientAddress: '0x123...',
amount: '10',
token: 'USDC',
chain: 'polygon',
recipientUsername: 'alice'
});
// Generate shareable link
const link = userService.generateProfileLink('alice');
// Returns: https://yourapp.com/chat?username=aliceimport { useUrlHandler } from '@/hooks/useUrlHandler';
// In your component
useUrlHandler({
currentUserId: user.id,
onChatCreated: (conversationId) => {
// Navigate to chat
setSelectedConversation(conversationId);
},
onPaymentRequest: (paymentData) => {
// Open payment dialog
setPaymentRequest(paymentData);
}
});<NewChatModal
open={showNewChat}
onOpenChange={setShowNewChat}
currentUserId={currentUser.id}
currentUsername={currentUser.displayName}
onChatCreated={(conversationId) => {
// Handle new chat
}}
/><QRCodeDialog
open={showQR}
onOpenChange={setShowQR}
data={qrData}
title="Scan to Chat"
description="Share this QR code with others"
/><EnhancedGiftDialog
open={showGifts}
onOpenChange={setShowGifts}
recipientUsername="alice"
recipientWallet="0x123..."
onSendGift={async (giftId, message) => {
await messagingService.sendGift(conversationId, senderId, giftId, 10, 'GIFT', message);
}}
onSendCrypto={async (amount, token, chain) => {
// Handle crypto transaction
}}
/>-
By Username
- Click "New Chat" button
- Type username in search (e.g., @alice)
- Click on user from results
- Chat opens instantly!
-
By QR Code
- Click "New Chat"
- Click "Show QR"
- Share QR with friend
- They scan and chat starts!
-
By Wallet
- Click "New Chat"
- Switch to "Wallet" tab
- Paste wallet address
- Click to start chat
-
By Link
- Share link:
https://app.com/chat?username=alice - Others click link
- Chat opens automatically!
- Share link:
- Open a chat
- Click gift icon
- Choose "Gifts" tab
- Filter by rarity (optional)
- Click on a gift
- Add optional message
- Click "Send Gift"
- Open a chat
- Click gift icon
- Choose "Crypto" tab
- Select blockchain
- Select token
- Enter amount
- Click "Send Now" or "Generate QR"
- Look at conversation list
- Find "Your Name (Me)" at top
- Click to open
- Test all features here!
- Perfect for demos
- Click "New Chat"
- Click "Show QR" button
- Options appear:
- Copy Link: Copy profile URL
- Show QR: Display QR code
- Share: Native share dialog
- Share with anyone!
?username=alice → Start chat with @alice
?wallet=0x123... → Find user by wallet and chat
?to=0x123... → Recipient address
&amount=10 → Amount to send
&token=USDC → Token symbol
&chain=polygon → Blockchain
&message=For coffee → Optional message
?qr=<base64_data> → Process QR code data
❤️ Heart, 🌹 Rose, ⭐ Star, 🔥 Fire, ✨ Sparkles, 🎉 Party, 🎈 Balloon, 🌻 Sunflower, 🍒 Cherry, ☕ Coffee, 🐱 Cat, 🐶 Dog
💎 Gem, 👑 Crown, 🏆 Trophy, 🎂 Cake, 🍾 Champagne, 🌈 Rainbow, 🍫 Chocolate, 🚀 Rocket, 🎁 Gift Box, 🪄 Magic
🦄 Unicorn, 🐉 Dragon, 🔮 Crystal Ball, 💸 Money Wings, 💰 Money Bag, ⚡ Lightning, 🌙 Moon
🔥🦅 Phoenix, 💍 Diamond Ring
ETH, USDC, USDT, DAI
MATIC, USDC, USDT
BNB, USDC, USDT
ETH, USDC, USDT
AVAX
SOL, USDC, USDT
- Pre-create a self-chat to show features instantly
- Have QR codes ready for quick scanning
- Show legendary gifts for wow factor
- Demonstrate URL sharing for viral potential
- Highlight multi-chain support for crypto audience
- Use emoji gifts for fun, relatable demos
- Check username spelling
- Ensure user has created an account
- Try searching by wallet address
- Ensure good lighting
- Hold steady
- Check QR code quality setting
- Check internet connection
- Verify recipient is valid
- Ensure conversation exists
- Check URL is complete
- Ensure user is logged in
- Try refreshing page
- Username search: Debounced 300ms
- QR generation: Unlimited (client-side)
- Messages: Per Appwrite limits
- Conversations: Per Appwrite limits
- Always validate usernames before creating conversations
- Use QR codes for in-person sharing
- Test with self-chat before demoing
- Cache gift catalog for performance
- Handle errors gracefully with toast notifications
- Deep link for social sharing to increase virality
Ready to demo! All features are integrated and working. Start with self-chat to familiarize yourself with the interface, then share your profile QR to get others chatting!