How would you design the architecture for an app that needs to function perfectly while offline and sync when reconnected?