Infinitely scaling factory contract?

I am wondering is there any sort of information or tutorial or code base for how to create infinitely scalable app on ICP ?

What I need to have is:
Some kind of “factory” contract that deploys other contracts from it’s code and then stores references to those deployed contracts in it’s own memory (storage). This is fine until there are like thousands and thousands of deployed contracts this way. At some point this factory contract will not be able to store references to contracts it deployed due to storage limitations, making it impossible to deploy and store references to deployed contracts anymore (ie: not infinitely scalable).
What’s the way around this problem? I was thinking of something in terms of factory contract also deploying “storage” type contracts that act as storage for the deployed contract references and then pulling the data from these through the factory contracts when required to access any of the deployed contracts. However this might cause issues with a lot of inter-canister calls. What is the best (only) proper way of doing this ?

Also - is there a way of knowing how much (exactly) storage does one reference to a deployed smart contract take, or to put it more clearly - is there an easy way of calculating how much memory any kind of “chunk” of data we’re about to save into the smart contract is going to take, other than actually testing each value based on what it is and then manually testing exact size of it? ie: if value given is a string, we need to count how many characters it has, times bytes size per character etc etc. This would get very tedious to do with different data structures like objects with multiple different types of fields

https://taggr.top/#/post/5487

Any insight into actual code Taggr is using?

Nope, sorry. Maybe try contacting the dev directly.