CashGuard - AI-Powered Currency Authentication

💡 Inspiration

Counterfeit currency remains a persistent problem worldwide, affecting businesses and individuals alike. We wanted to create an accessible tool that leverages modern AI to help anyone quickly verify bill authenticity using just their smartphone camera.

🎯 What it does

CashGuard is a mobile-first web application that:

  • Scans currency bills using your device camera
  • Validates authenticity using dual AI models: Google Gemini Vision API for detailed security feature analysis, plus a custom Vertex AI classifier for real/fake detection
  • Provides instant feedback with confidence scores and detected security features
  • Stores scan history securely in Firebase with user-specific access control
  • Tracks analytics to understand usage patterns and improve accuracy

🛠️ How we built it

Frontend: Built with Next.js 14 (App Router) and React 18, styled with Tailwind CSS for a modern, responsive UI. We implemented camera access with automatic image compression to optimize performance.

AI Integration:

  • Connected to Google AI Studio's Gemini API for vision-based currency analysis
  • Trained a custom bill classifier using Vertex AI for binary real/fake classification
  • Combined both models for higher accuracy and detailed insights

Backend: Leveraged Firebase for authentication (Google Sign-In), Firestore for scan history, Storage for images, and Analytics/Performance monitoring.

Deployment: Containerized with Docker and deployed to Google Cloud Run for serverless, auto-scaling infrastructure.

📚 What we learned

  • How to optimize mobile camera workflows for real-time image capture
  • Prompt engineering techniques for Gemini Vision API to extract specific security features
  • Implementing Firebase security rules to protect user data
  • Cloud Run deployment patterns for Next.js applications
  • Rate limiting and API key security best practices

🚧 Challenges we faced

  1. Mobile camera optimization: Getting reliable camera access across different browsers and devices required extensive testing
  2. Firebase auth domains: Cloud Run deployment initially broke authentication; solved by programmatically adding authorized domains
  3. Image processing: Balancing compression quality vs. file size for fast uploads without losing security feature details
  4. Rate limiting: Implemented proper throttling to prevent API abuse while maintaining good UX

🚀 What's next

  • Expand currency support beyond USD
  • Improve classifier accuracy with more training data
  • Add offline mode for basic validation
  • Implement collaborative reporting for suspicious bills

Built With

  • docker
  • firebase-analytics
  • firebase-authentication
  • firebase-firestore
  • firebase-storage
  • google-ai-studio
  • google-cloud-run
  • google-gemini-ai
  • next.js
  • react
  • tailwind-css
  • typescript
  • vertex-ai
Share this project:

Updates