Git Product home page Git Product logo

kafka's Introduction


Node.js Kafka Example

Realtime Bitcoin Wallet Tracker Example App with Node.js and Kafka

Features

  • Interact with Kafka through Node.js
  • Produce/consume events to/from topics
  • Use Kafka as a queue and as a publish/subscribe system
  • Kafka with Zookeeper and without Zookeeper using Redpanda
  • Make use of Kafka's partitioning ability

Tech Stack

Usage

Recommended OS: Linux

Requirements: Node.js, Docker, Docker Compose

Setup

Run

  • npx ts-node cli.ts <WALLET_ADDRESS> (Watch a BTC or ETH wallet)
    • npx ts-node cli.ts 34xp4vRoCGJym3xR7yCVPFHoCNxv4Twseo (Watch a BTC wallet)
    • npx ts-node cli.ts 0xBE0eB53F46cd790Cd13851d5EFf43D12404d33E8 (Watch an ETH wallet)

Monitoring

Notes

  • Fetching the balance might stop working at some point, because Blockcypher limits the amount of requests one can send to their API

Cleanup

  • docker-compose -f docker-compose.yaml rm -s -f -v (Stop and remove Docker containers)

Example

  • npm install (Install NPM dependencies)
  • docker-compose -f example.docker-compose.yaml up --build (Start example)
  • docker-compose -f example.docker-compose.yaml rm -s -f -v (Clean example)

Codebase

  • example.ts (Minimal example of using Kafka with Node.js)
  • cli.ts (CLI application to read wallet data in realtime)
  • server.ts (WebSocket server that communicates with CLI and with Kafka)
  • balance.ts (Service, that crawls wallet balance on demand)
  • price.ts (Service, that writes realtime price events to Kafka)

kafka's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.