Blue card and child birth in another EU state

Hello everyone, I have a question regarding blue card and child birth. I'm a blue card holder currently leaving and working in Malta. Me and my wife are planning to move to another EU state (Latvia) to give birth to our baby (I will keep my job since can work remotely). Once born he/she won't have any documents there. How do we go about that? Can we get maltese residence permit being there or should we apply for a Latvian visa for the baby to avoid any problems in airports on our way back?

PS: I'm aware of 90 days limit we have outside Malta.

Afaik you will need a passport, for my son we could get by post from the UK or we went to the Latvian embassy here in Malta and they gave us a temp travel permit so we can apply for his passport there in Latvia (ended up being the easiest option).  And for his SA citizenship we had to go to Rome twice.

It's a nightmare, but passport in his nationality is going to be needed before you can travel (or permit if your country supports issuing such)

Thank you for your reply. I asked around and it seems to be not a problem with getting Russian passport for baby being in Latvia. This takes a week or so. It seems they allow to be there until it's ready. Now the interesting part is what to do next. We sure can go to Russia. Then get a Maltese travel visa there for the baby. Then return to Malta and finally get a residence permit, but this sounds to much travelling with the little one. Plus the best would be to stay in Latvia for another month or two for the mother and the baby to have some rest after birth. I guess we will need to apply for a visa D there...

My baby at 13 months have had 21 flights. They are easy :)

But yeah you should ask the Maltese what they expect when you come in with a kid who is yours and you are resident here. Might be easier than you think