The best way to implement device database

With v0.19 you can store global variables so they are available after restarts see https://nodered.org/docs/user-guide/context
especially the section on context stores