An intelligent financial transaction analysis system built with the Mastra framework and Cloudflare Vectorize. This application can analyze bank statements, extract transaction data, and provide semantic search capabilities over financial records.
The Mastra Finance AI demonstrates how to:
- 🔍 Analyze Financial Transactions: Extract and categorize transactions from bank statements
- 🧠 Generate Smart Summaries: Create Hebrew and English summaries using OpenAI
- 📊 Vector Search: Find similar transactions using semantic embeddings
- ☁️ Scale with Cloudflare: Leverage Cloudflare Vectorize for serverless vector storage
- 🎯 Intelligent Categorization: Automatically classify transaction types and categories
- Node.js 18+
- OpenAI API key
- Cloudflare account with Vectorize access
-
Clone and Install:
git clone <repository-url> cd mastra-finance-home-ai npm install
-
Environment Configuration:
cp .env.example .env # Edit .env with your API keys -
Required Environment Variables:
OPENAI_API_KEY=your_openai_api_key CF_ACCOUNT_ID=your_cloudflare_account_id CF_API_TOKEN=your_cloudflare_api_token VECTOR_STORAGE_MODE=cloudflare
-
Test Setup:
node test-cloudflare.js
-
Start Development:
npm run dev
- Transaction Analyzer: Processes bank statements and extracts transaction data
- Vector Search: Semantic search over transaction embeddings
- Cloudflare Vectorize: Serverless vector database for scalable storage
- OpenAI Integration: GPT-4 for analysis and text-embedding-3-small for vectors
The application uses Cloudflare Vectorize exclusively for vector storage:
- Production-Ready: Serverless vector database built for scale
- Global Performance: Edge-optimized for low latency worldwide
- Zero Maintenance: No infrastructure to manage or maintain
-
Environment Setup Guide - Complete setup instructions
-
Database Information - Vector storage details
Test your setup with the included scripts:
# Test Cloudflare Vectorize connection
node test-cloudflare.js
# Test full transaction analysis flow
node test-full-flow.cjsThe application uses Cloudflare Vectorize exclusively for all vector operations including storage, similarity search, and metadata filtering.
The application uses OpenAI's text-embedding-3-small (1536 dimensions) for generating vector embeddings of transaction summaries.
The application is designed to work seamlessly in:
- Local Development: Full functionality with Cloudflare Vectorize
- Cloudflare Workers: Native integration with Vectorize
- Cloud Platforms: Serverless-ready architecture
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
For help and support:
- Check the Environment Setup Guide
- Review the Cloudflare Vectorize documentation
- Test your setup with the provided test scripts