Autumn of Learning Sale is live now!Claim Up to 50% Off
💼

Production Portfolio Project Builder

1-Click GitHub Portfolio Generator

🌱 Build an impressive real-world streaming project repository with architecture diagrams and code to showcase on your resume.

Included Stack:
Apache Kafka 3.8KRaft QuorumConfluent Schema RegistryApache FlinkPython 3.11Docker
Includes README with verified KafkaKraft badges & Mermaid diagrams
# kafka-fraud-detection-engine
> **Production-Grade Real-Time Payment Fraud Detection Engine**  
> Architected by **Alex Morgan** | Built with **KafkaKraft Labs**

[![KafkaKraft Verified Architecture](https://img.shields.io/badge/KafkaKraft-Verified_Architecture-00b4d8?style=for-the-badge&logo=apachekafka)](https://labs.kafkakraft.com)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg?style=for-the-badge)](https://opensource.org/licenses/MIT)

## 📌 Architecture Overview
This streaming pipeline processes high-throughput credit card authorization events, validates payloads against a centralized **Confluent Schema Registry (Avro)**, performs sub-second windowed anomaly detection using **Apache Flink**, and safely quarantines suspicious transactions to a **Dead Letter Queue (DLQ)**.

```mermaid
flowchart LR
    P["Payment Gateway (Producer)"] -->|Avro Payload| K["Kafka KRaft Topic: payment-transactions"]
    K -->|Continuous Stream| F["Apache Flink SQL (1-Min Tumbling Window)"]
    F -->|Legitimate| S["PostgreSQL Database Sink"]
    F -->|Fraud Velocity > 3| DLQ["Dead Letter Queue (DLQ): fraud-alerts"]
    SR["Confluent Schema Registry"] -.->|Schema Contract| P
    SR -.->|Avro SerDe| F
```

## 🚀 Quickstart
```bash
# 1. Spin up KRaft Cluster, Schema Registry, and Flink
docker compose up -d

# 2. Install Python Dependencies
pip install confluent-kafka fastavro requests

# 3. Start Streaming Ingestion
python src/producer.py

# 4. Launch Fraud Evaluation Consumer
python src/consumer.py
```