# Building a Real-Time AI Fraud Detection System with Spring Kafka and MongoDB

DevFeed: [Building a Real-Time AI Fraud Detection System with Spring Kafka and MongoDB](<https://devfeed.tech/articles/building-a-real-time-ai-fraud-detection-system-with-spring-kafka-and-mongodb-21830.md>)

Original publisher: [Read original article](<https://www.thepolyglotdeveloper.com/blog/2025/04/building-a-real-time-ai-fraud-detection-system-with-spring-kafka-and-mongodb/>)

Author: Tim Kelly

Published: 2025-04-21T15:05:48Z

Content type: tutorial

Language: en

Sources: [Nic Raboy](<https://devfeed.tech/sources/nic-raboy.md>)

Topics: [MongoDB](<https://devfeed.tech/topics/mongodb.md>), [Tutorial](<https://devfeed.tech/topics/tutorial.md>), [Kafka](<https://devfeed.tech/topics/kafka.md>), [Embeddings](<https://devfeed.tech/topics/embeddings.md>), [real-time](<https://devfeed.tech/topics/real-time.md>), [Development](<https://devfeed.tech/topics/development.md>)

Tags: [ai](<https://devfeed.tech/tags/ai.md>), [anomaly-detection](<https://devfeed.tech/tags/anomaly-detection.md>), [artificial-intelligence](<https://devfeed.tech/tags/artificial-intelligence.md>), [building](<https://devfeed.tech/tags/building.md>), [embeddings](<https://devfeed.tech/tags/embeddings.md>), [financial](<https://devfeed.tech/tags/financial.md>), [fraud-detection](<https://devfeed.tech/tags/fraud-detection.md>), [java](<https://devfeed.tech/tags/java.md>), [kafka](<https://devfeed.tech/tags/kafka.md>), [mongodb](<https://devfeed.tech/tags/mongodb.md>), [pipeline](<https://devfeed.tech/tags/pipeline.md>), [real-time](<https://devfeed.tech/tags/real-time.md>), [scalable-architecture](<https://devfeed.tech/tags/scalable-architecture.md>), [synthetic](<https://devfeed.tech/tags/synthetic.md>), [tutorial](<https://devfeed.tech/tags/tutorial.md>), [vector-search](<https://devfeed.tech/tags/vector-search.md>)

## AI overview

This tutorial builds a real-time fraud detection pipeline with MongoDB Atlas Vector Search, Apache Kafka, AI-generated embeddings, and MongoDB Change Streams. It compares new financial transactions with a user's historical transactions and flags potential fraud when no similar transactions exist or similar transactions are already marked as fraudulent.

## Source excerpt

In this tutorial, we'll build a real-time fraud detection system using MongoDB Atlas Vector Search, Apache Kafka, and AI-generated embeddings. We'll demonstrate how MongoDB Atlas Vector Search can be ... The post Building a Real-Time AI Fraud Detection System with Spring Kafka and MongoDB appeared first on DEV.