https://github.com/caixetadev/kafka-transaction-validator
🍀 golang-kafka microservice for validating financial transactions, built on an event-driven architecture
https://github.com/caixetadev/kafka-transaction-validator
Last synced: 9 days ago
JSON representation
🍀 golang-kafka microservice for validating financial transactions, built on an event-driven architecture
- Host: GitHub
- URL: https://github.com/caixetadev/kafka-transaction-validator
- Owner: Caixetadev
- Created: 2024-01-20T03:43:38.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-01-22T16:09:31.000Z (over 1 year ago)
- Last Synced: 2025-07-06T17:18:25.351Z (9 days ago)
- Language: Go
- Homepage:
- Size: 45.9 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 🍀 kafka-transaction-validator
> :warning: This repository was created to practice using Kafka and is not code to be used in production.## Problem
Every time a financial transaction is created it must be validated by our anti-fraud microservice and then the same service sends a message back to update the transaction status. For now, we have only three transaction statuses:- pending
- approved
- rejectedEvery transaction with a value greater than 1000 should be rejected.
## Adjustments and Improvements
- [ ] balance the load of insert and update in the database
## Requirements
- Go installed and configured
- Docker and Docker Compose installed
- k6 (optional)## How to Run
1. Clone repository:
```bash
git clone https://github.com/Caixetadev/kafka-transaction-validator.git && cd kafka-transaction-validator
```1. Start the services using Docker Compose:
```bash
docker compose up
```2. Run the `anti-fraud` service:
```bash
cd anti-fraud && go run cmd/main.go
```3. Run the `transaction` service:
```bash
cd transaction && go run cmd/main.go
```4. Access the application at: [http://localhost:8080/transaction](http://localhost:8080/transaction).
## API Endpoint
### Create Transaction
- **URL:** `/transaction`
- **Method:** `POST`
- **Request Body:**
```json
{
"accountExternalIdDebit": "string",
"accountExternalIdCredit": "string",
"tranferTypeId": 1,
"value": 1
}## Run k6 test
```bash
k6 run scripts/k6.js
```