I am designing a MVP for a simple gamification system for a trampoline park(s).
External company is providing bracelets for customers, then collecting this data in their own web app, where they extract things like "time in air", "number of jumps" etc. in real time from accelerometer readings (x,y,z)
I need to receive this transformed data somehow and display it on a scoreboard (among other things). My problem is with how to integrate their data with my system.
First I considered the simplest possible scenario - one trampoline park and 10 bracelets.
The simplest solution would be to connect my web app with their web app via websocket directly, receive transformed data from bracelets in real time and update the score on my website.
Things start to fall apart when I consider scaling the app to multiple trampoline parks and hundreds/thousands of bracelets
I started researching some integration patterns but this is a very broad area and I am new to things like this. I stumbled upon technology called Apache Kafka, it deals with streaming data (don't know if data from bracelets can be called streaming data, or is it more reserved for things like audio/video streaming for example on twitch or netflix?)
So the basic architecture I came up with is like this (I don't know if it makes any sense, if it's a good use case for Apache Kafka and if it isn't an overkill in my scenario):
- External company collects the data from thousands of bracelets and transforms the data (from "x,y,z" readings to things like "time in air" or "jump occured" etc.)
- Transformed data is being published to Apache Kafka on AWS (each trampoline park has its own topic?)
- I run multiple instances of my web app, one per trampoline park, all of them subscribe for 1 topic each, all of them are connected to the same database (PostgreSQL on AWS), so users can go between different trampoline parks and still have all their data persistent
- I consume data from Apacha Kafka and use it for my internal reasons (eg. calculating current bracelet user score)
So my questions would be:
- Does that architecture make any sense?
- Is this a good use case for Apacha Kafka or is this an overkill? Or maybe there are some better technologies to use? Maybe RabbitMQ is enough?
- Not sure if I should have one central web app to gather data about all trampoline parks or if I should spread it among many smaller apps, one for each trampoline park, but I will still need some central server to coordinate...