Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/itadventurer/kafka-bank-showcase

Showcase demonstrating Credit Card transactions
https://github.com/itadventurer/kafka-bank-showcase

demo kafka showcase

Last synced: 15 days ago
JSON representation

Showcase demonstrating Credit Card transactions

Awesome Lists containing this project

README

        

# Usage

## Running in Play with Docker

https://play-with-docker.com

```sh
git clone https://github.com/azapps/kafka-bank-showcase.git
docker-compose up
```

Setup SSH and Port Forwarding (8080-8084 web services, 9092 Kafka) to your local machine and continue below.

## Running the Showcase (locally)

```sh
docker-compose up
```

### Opening entry service

Open the URL http://localhost:8080 and continue your journey from
there

# Kafka Topics

## `megacard_raw_log`

Raw data that are generated by the megacard producer. Following event types
are supported:

* Transactions
* `transaction`
* Card events
* `add_card`
* `block_card`
* `unblock_card`
* `update_card_limit`
* `cancel_cards`

## `transactions_log`

Contains only transactions. To keep it simple they are in the same
format as in the `megacard_raw_log`.

## `cards_log`

Contains only card events. To keep it simple they are in the same
format as in the `megacard_raw_log`.

# Services

## Entry Service

A container containing nginx + simple HTML file with links to other services.

## Megacard Connector

### Megacard Producer

This service generates random events and produces them on the
`megacard_raw_log` topic.

Following endpoints are supported

* `/`: lists all supported endpoints
* `/produce_transaction`: Generates some transactions and produces it
to the `megacard_raw_log`. Returns all genererated messages.
* `/produce_card`: Generates a set of Card events and produces it to
the `megacard_raw_log`. Returns all genererated messages.

Important files:

* [megacard-connector/src/index.ts](megacard-connector/src/index.ts) → HTTP endpoints
* [megacard-connector/src/transaction_gen.ts](megacard-connector/src/transaction_gen.ts) → Generate transactions
* [megacard-connector/src/card_gen.ts](megacard-connector/src/card_gen.ts) → Generate Card events

### Megacard Transformer

This service subscribes to the `megacard_raw_log` and forwards the
messages regarding Cards to the `cards_log` and messages regarding
transactions to `transactions_log` respectively.

Important files:

* [megacard-connector/src/transformer.ts](megacard-connector/src/transformer.ts) → Transformer

## Card Service

The Card service is a consumer service that stores the current state of
the Cards in a local materialized view (see [Turning the database
inside-out](https://www.confluent.io/blog/turning-the-database-inside-out-with-apache-samza/))
(here: PostgreSQL) and renders the data in a web interface.

### Card Connector

Subscribes to the `cards_log` and updates the internal PostgreSQL database.

Important files:

* [cards-svc/connector/src/index.ts](cards-svc/connector/src/index.ts): Business logic

### Card Web

Display all information for Cards in the internal database.

Important files:

* [cards-svc/web/src/index.ts](cards-svc/web/src/index.ts): Webpage

## Transactions Service

Same as Card Service but for Transactions

### Transactions Connector

Same as Card Connector but for Transactions

Important files:

* [transactions-svc/connector/src/index.ts](transactions-svc/connector/src/index.ts): Business logic

### Transactions Web

Important files:

* [cards-svc/web/src/index.ts](cards-svc/web/src/index.ts): Webpage