Coder Social home page Coder Social logo

isaacssemugenyi / petstore-kafka Goto Github PK

View Code? Open in Web Editor NEW

This project forked from swagger-api/petstore-kafka

1.0 0.0 0.0 1.41 MB

A demo site built on top of Kafka topics

License: Apache License 2.0

Shell 0.27% JavaScript 46.10% TypeScript 44.42% CSS 0.53% Nix 0.76% Makefile 5.32% HTML 2.15% Dockerfile 0.45%

petstore-kafka's Introduction

Petstore Kafka demo site

This is a contrived demo of a petstore with adoptions. It is build on Kafka topics written in Nodejs.

It exists as a functional example for describing with AsyncAPI.

You can see a live demo of this running at https://petstore-kafka.swagger.io

NOTE: Given the way Kafka rebalances and the need for cacheing, it may take a while (a few minutes) for caches to be built, depending on the size of the Topic.

Architecture

  • TODO: Add miro diagram.

  • TODO: Add AsyncAPI definition(s)

  • There is a browser app (SPA) written in Typescript using Create-React-APP, it's found under [[./web-ui]].

  • There is a gateway for serving the SPA and proxying API calls to the other services. It is also under [[./web-ui]] and is a single Caddyfile.

  • There is a Pets service (nodejs + kafka sink). [[./services/pets]]

  • There is a Adoptions service (nodejs + kafka sink). [[./services/adoptions]]

  • There is a Websocket service (nodejs + kafka sink + publishes events). [[./services/websocket]]

  • There is a docker-compose file just for Kafka services. [[./services/kafka]].

  • There is a docker-compose file for the whole stack, [[./docker-compose.yml]].

Developing

To develop, first make sure you have all the dependencies installed.

WARNING: Kafka needs to know its own hostname. Add an entry to your hosts file mapping kafka.local -> 127.0.0.1. Or tweak the docker-compose file to adjust.

A list can be found by running make dependencies. There are optional dependencie for Tmux/inator, which are helpful for spinning up several servers at once each with their own terminal pane. But that does require a little bit of tmux knowledge.

You can launch each service with make dev-{service} where {service} is the name of the service. A list can be seen by running make help.

Alternatively, if you have Tmuxinator install you can run make dev which will launch all services.

All services have hot-reload, but they make require a restart now and then if there are kafka delays/issues.

Building

All services have a Docker image and the entire stack can be brought up with docker-compose up if the images are built and/or already hosted in hub.docker.com.

To build all images, run make build which will build them one-by-one. All builds happen within the Docker context so it isn't required to run yarn run build beforehand.

Alternatively you can build the indidvidual docker images with make build-{service} where {service} is the service. For a full list see make help.

petstore-kafka's People

Contributors

ponelat avatar

Stargazers

Roman 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.