How to store variables (best practices)

Have you read about using file storage for context? see:
https://nodered.org/docs/user-guide/context
and this might help: