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
- rejected
Every transaction with a value greater than 1000 should be rejected.
- Bun: A fast JavaScript runtime that is used for running the
anti-fraud
andtransaction
services. - Elysia: A framework used for building the application's web services.
- Apache Kafka: The event streaming platform used to handle messaging between services.
- Drizzle: An ORM (Object-Relational Mapping) tool used for interacting with the database.
- PostgreSQL: The relational database used for storing transaction data.
Pre-requisites
To be able to start development the application make sure that you have the following pre-requisites installed:
- Bun
curl -fsSL https://bun.sh/install | bash
- Docker and Docker Compose installed
- K6 (optional)
Running the app
To be able to start development the application make sure that you have the following pre-requisites installed:
- Clone repository:
git clone https://github.com/vsantos1711/elysia-transaction-validate.git && cd elysia-transaction-validate
- Start the Kafka using Docker Compose:
docker compose up
- Run the
anti-fraud
service:cd anti-fraud && bun install && bun run dev
- Run the
transaction
service:cd transaction && bun install && bun run dev
-
URL:
/transaction
-
Method:
POST
-
Request Body:
{ "accountExternalIdDebit": "string", "accountExternalIdCredit": "string", "tranferTypeId": 1, "value": 1 }
k6 run scripts/k6.js