(CNN) A deadly earthquake that reduced buildings to rubble in West Java, Indonesia has once again exposed the dangers of living in poorly built homes in one of the most seismically active zones on the planet.
Since Monday's quake, survivors have been sleeping rough or in shelters away from homes vulnerable to collapse as aftershocks rattle buildings already compromised by the 5.9-magnitude quake that killed at least 310 people, according to the head of country's National Agency for Disaster Management (BNPB).
A further 24 people remain missing, Lieutenant General Suharyanto said Friday.
The shallow depth of the earthquake -- just 10 kilometers (6 miles) -- added to the pressure on structures across West Java, where more than a million people were exposed to very strong tremors, according to the United States Geological Survey (USGS).
Visiting the site on Tuesday, Indonesian President Joko Widodo promised that damaged homes -- more than 56,000 of them -- would be rebuilt to be earthquake-resistant.
"The houses affected by this earthquake are required to use earthquake-resistant building standards by the Minister of Public Works and Public Housing," he said. "These earthquakes happen every 20 years. So the houses should be earthquake-resistant."
But in a developing nation where about 43% of the population live in rural areas, in largely unsafe and poorly constructed homes, the task of making earthquake-resistant buildings remains a huge challenge.
As of Thursday, more than 61,000 people were displaced, according to the National Agency for Disaster Management (BNPB) -- and experts say the damage could have been mitigated by proper infrastructure.
Indonesia, an archipelago nation of more than 270 million people, sits along the Ring of Fire -- a band around the Pacific Ocean where most active volcanoes lie and most earthquakes happen as tectonic plates push against each other, causing tremors.
Of the 310 people killed in Monday's quake, at least 100 were children, many of whom were in school when the quake struck. A 6-year-old boy was pulled alive from the rubble of his home two days later, but many others weren't so lucky.
The quake shook the foundations of buildings, causing the concrete structures to collapse and roofs to cave in. Photos showed broken scraps of metal, timber and bricks. Most of the people killed were crushed or trapped beneath debris, according to West Java's governor, Ridwan Kamil. Others were killed in landslides.
Cleo Gaida Salima said when she heard about the quake, she tried to phone her mother in Cugenang, Cianjur, but when she failed to answer, she decided to drive there from her home in Bandung by motorbike.
The journey -- about 65 kilometers (40 miles) -- usually takes less than two hours. But with roads completely blocked by landslides, it took her 24.
"All the houses were covered with dirt and mud," she said, adding that she was reunited with her family who survived the quake.
"We all cried with emotion and happiness," she said. "Our whole family immediately ran out to save themselves. The earthquake was very strong."
In Indonesia, houses were traditionally constructed from organic building materials including timber, bamboo and thatched grasses, owing to the hot and humid climate in the country.
These were considered to be sustainable homes, and largely durable in the event of an earthquake. However, increased deforestation and the high cost of timber led people to choose alternative materials, according to a 2009 study about post-disaster reconstruction in Indonesia from The Architectural Science Association.
More and more homes were built of brick and concrete, and while the facade may have appeared modern, underneath, the construction was poorly held together, the study said.
Moreover, the low quality of concrete and the poor steel reinforcing makes these structures increasingly susceptible to collapsing during a quake -- while causing maximum injury owing to the weight of the materials, the report said.
Earthquake-resistant structures are designed to protect buildings from collapse and can work in two ways: by making buildings stronger, or by making them more flexible, so they sway and slide above the shaking ground rather than crumbling.
Architects have been developing this technology for decades, and engineers often adapt materials and techniques local to the region.
Architect Martijn Schildkamp, founder and director of Smart Shelter Consultancy, said his company helped to build about 20 schools in earthquake-prone Pokhara, in Nepal's central region, seven years before a major quake.
When the quake hit in 2015, more than 8,000 people were killed, but the schools, made from traditional techniques and materials from the landscape, like rubble stone masonry, did not crumble.
"Our schools did not collapse," he said. "They suffered just some cosmetic damage."
He said in developed countries like Japan, knowledge, infrastructure and money are readily available to build earthquake-resistant buildings, but the high cost of building such structures makes it more difficult in developing countries.
In Nepal, many people build their homes with mud mortar, which is very brittle, Schildkamp said. "If it is completely unreinforced, there's no extra strengthening in the building. This is what will collapse very easily," he said.
Schildkamp's team used cement mortar and inserted horizontal reinforcement poles into the structure to strengthen it, instead of vertical ones.
Building regulations should prevent the proliferation of shoddily built structures, but in some countries not enough is being done by governments to enforce the rules, Schildkamp said.
"We need knowledge and strategy in these countries. And we need governments to make these building codes mandatory," he said.
In West Java, hope is fading of pulling more people alive from the quake debris.
Aftershocks are also complicating efforts, and residents are now living in fear the next disaster could once again topple their unstable homes.
While President Widodo said the government would provide compensation of up to about $3,200 each for owners of heavily damaged homes, many families in Cianjur lost everything. And now, they face the nearly impossible task of rebuilding.