akankshar-oy/cdc-pipeline ? reverse-engineered prompt
Reverse engineered prompt
Build me a Node.js app that keeps MongoDB in sync with Elasticsearch and Redis in real time.
I want it to watch changes in a MongoDB replica set, so when a document is inserted, updated, or deleted in the products collection, the same change gets reflected in Elasticsearch for search and Redis for cache invalidation. It should be safe to restart without losing its place, so save a checkpoint and resume from it after a crash. If Elasticsearch is down, don’t mark the event done until the write succeeds. For updates, make sure the full document gets indexed, not just the changed fields.
Please include a simple health endpoint that shows whether the pipeline is running and how far behind it is. Set it up so I can run MongoDB, Elasticsearch, and Redis locally with Docker Compose, then start the pipeline with one command. If you need to, look up current docs online for the MongoDB change stream and Elasticsearch bits.
Are you gonna build this?
make sure you review the code using coderabbit