The developing world is embarking on a massive infrastructure boom. And China wants to build it—and bankroll it.

On Thursday, Chinese officials announced the latest infrastructure megaproject—a $12 billion contract to build a railway stretching more than 850 miles (1,400 kilometers) along the coast of Nigeria. It was China's single-biggest overseas contract, according to state media.

With its domestic economy cooling, China is investing heavily outside its borders in multibillion dollar infrastructure projects, launching new financing plans to help developing countries pay for them.

Much of that investment will be geared toward transportation projects like the Nigerian railway, as developing countries seek to put in place the capacity needed to keep up with increased flows of people and goods brought by economic growth.

Much like the 19th century railroad expansion that opened up the American West, many of these projects are designed to expand growth to inland regions with little access. More recently, China's three-decade economic transformation started with coastal manufacturing hubs served by ports that provided gateways to international trade.

In the past decade, China has spent tens of billions of dollars building tens of thousands of miles of roads and railways to expand economic opportunity to hundreds of millions of Chinese inland workers.

Read MoreDid China just grant one-of-a-kind trade status?



Other developing countries, including Brazil and India, now face the same transportation challenges, according to a recent report by KPMG.

"A large proportion of jobs exist close to the coast, and governments need to enfranchise those living in other parts of the country, in order to maintain their legitimacy and ensure that each region is treated fairly," the report said.