Here is a source on Wikipedia: https://en.wikipedia.org/wiki/Resident_registration#Germany
"Unlike common belief there is no central administration — except for foreigners (see Central Register of Foreign Nationals (Germany)) — the resident registration is run by 5283 local offices throughout Germany."
For passports, I'd guess that there is a different database.