⚡️ Optimistic UI with @tan_stack Query & #Zustand
⌘ Use store params to handle optimistic cache updates
⌘ Global state for query invalidation to re-fetch data
Code explained in 🧵
Stay tuned for demo source code (free)
#webdev#buildinpublic#uiux#nextjs#reactjs
To solve this issue without downtime:
1. Implement an event-driven architecture using Apache Kafka.
2. Have Microservice A write changes to Kafka before updating its database.
3. Subscribe Microservice B to these events for database updates.
4. Use Change Data Capture (CDC) with Debezium to replicate data from the shared database to separate databases for each service.
5. Gradually migrate with zero downtime:
a. Replicate data
b. Shift reads
c. Shift writes to the new system
This approach ensures consistency between services, eliminates the shared database, and enables scalability.