Tojin Yashiki was the walled and gated compound that housed Chinese merchants and sailors in Nagasaki between 1689 and 1859.
The Dutch had been confined earlier, and the Chinese compound was larger and held many more people. however they were held under less strict conditions and there were also large numbers of ethnic Chinese who were "naturalized citizens" and who were often the officials charged with guarding and controlling Tojin Yashiki.
The Dojin-do was constructed within the compound by ship owners in 1691, the fist shrine built within the compound.
It enshrines Tu Di Gong, a kind of Daoist tutelary land deity of a specific location. It seems to be the equivalent of what in my area is called Omoto and what in the
Izumo area is called Kojin, and was a very popular deity among the Chinese.
The shrine burned down in a great fire of 1784 but was rebuilt with donation from the great Chinese temples in Nagasaki, Sofukuji, Kofukuji, and Fukusaiji, temples which the residents of Tojin Yashiki could visit as long as guarded.
The shrine was dismantled down to its foundations in 1950 but was restored in 1977.