Best approach to store contacts

Hi,
I am creating chat app it’s similar to whatsapp i am usibg ionic native contacts to get all contacts from user’s phone and i will do some functionality to get registered users in my app.
My question is what is the best approach to store contacts from user’s phone i though it might be a json file or i can store it on firebase but i think those 2 options will make a performance issue as it maybe get thousands of contacts. So i want to get all contacts and do my functionality then store the unregistered contacts in some where to avoid performance issue.

Thanks