It was overcast, and Hoi An’s colours softened like a watercolour painting. I paused for the requisite photo of the red Japanese Bridge, the city’s landmark. It hung elegantly between grey clouds and the shimmering canal, a memory from the 1700s when this Vietnamese city was an international trading port.

Yet as I raised my camera, I wasn’t imagining the picturesque past, but rather a questionable future.

Vietnam is in danger. Rising sea levels pose a huge threat to this coastal country. In less than 100 years much of southern Vietnam’s Mekong Delta – the heart of the nation’s rice production – could go the way of Atlantis. The Ministry of Natural Resources and Environment predicts that the ocean will swallow more than a third of the region by the year 2100, taking a swath of Ho Chi Minh City with it. Halfway up the coast from the Mekong Delta, Hoi An’s prognosis is better, but it’s not immune. The city sits where the Thu Bon River meets the South China Sea. Its inhabitants are already used to hauling furniture upstairs during seasonal floods.

Vietnam is in danger.

With a dire forecast and limited resources, Vietnam doesn’t have a lot of options. In 2015, then Minister of the Environment Nguyen Minh Quang told the press that the country’s best bet was to plant more mangrove trees.

Mangroves are the climate superheroes of the arboreal world. They grow in swamps along the coasts: thin trunks and tangled, spidery roots submerged in dark, briny water. The roots filter saltwater and can expand eroded coastlines. They also create natural storm barriers and protect agricultural land from saltwater infiltration. And on top of everything else, mangroves are atmospheric vacuum cleaners, pulling unparalleled amounts of carbon dioxide from the air.

"The organic carbon stocks stored in mangrove ecosystems are three to five times larger than other forest types," confirmed Sigit Sasmito, a researcher with the Center for International Forestry Research and Charles Darwin University in Australia.

With a dire forecast and limited resources, Vietnam doesn’t have a lot of options.

However, Vietnam has lost more than half its mangrove forests since the 1940s, largely to aquafarming and urban development. It’s the eternal conundrum of environmentalism in developing economies: eat now or breathe later?

Clearing land for shrimp farms might be beneficial in the short term. But intact forests are hugely profitable to the fishing industry at large: by keeping salinity levels in check, mangrove forests promote tremendous biodiversity, which means more kinds of fish to catch.

"It is estimated that the value of mangrove swamps for Vietnamese inshore fishing equal up to $440 million each year,” said Dr Christian Henckes, director of the Deutsche Gesellschaft für Internationale Zusammenarbeit’s (GIZ) coastal restoration programmes in Vietnam.

But such big, impersonal numbers aren’t necessarily compelling to small communities. So international organisations like GIZ seek to make preservation profitable on a local level.

In Hoi An, a group called Mangroves for the Future (MFF) has made strides awarding grants to local conservation projects. MFF has been active in the Hoi An area since 2013, working to turn it into an eco-destination to help protect the mangrove palm forest that separates Hoi An from the sea.

Mangrove palms, also called Nipa palms, are a unique part of the mangrove biosphere: they are the only palm adapted to salty coastal waters. While not as effective as regular mangrove trees, mangrove palms are still efficient carbon-dioxide filters and protect the shoreline from storm damage and erosion. Their feathery, fronded tops rise high above the water, creating a dense forest where locals cast for small fish and squid.

That forest is also home to the commune of Cam Thanh, whose fishermen navigate the flooded trees in traditional woven boats called thuyền thúng. Increasingly, thuyền thúng also carry tourists. MFF has helped Cam Thanh develop an eco-tour programme for travellers to visit the forest with fishermen in their boats. The project increases both ecological awareness and local incomes, making the forest invaluable to Cam Thanh’s economic future.

But this plan only involves the men of the village, and impact of projects greatly increases when the whole community is involved. So MFF has also funded grants to help local women turn their houses into eco-homestays.

Not every house is eligible to become a homestay. The rules are strict, not just environmentally but also culturally. For example, there must be at least two generations living in the house in order to help guests learn the culture and history of the community through a shared living experience. Visitors work alongside the family in the fields, take boats into the mangrove palm forest and participate in cooking classes and family activities.

Like many local projects, it’s small-scale. The first two homestay houses opened in March 2017, and two more are currently getting certified.

One of the challenges MFF faces in growing preservation efforts is that many Cam Thanh residents lack a sense of urgency. Locals are more concerned about maintaining their way of life and feeding their families. The distant threat of environmental change is harder to take seriously.

“People talk a lot about climate change, but the threat is not very clear,” said Huyen Tran Ngo, project director for Cam Thanh’s Women’s Union.

I asked Samito and Henckes whether mangroves were a solution for Vietnam’s sea-level crisis or just a stop-gap measure. Neither was willing to be unequivocal, but both agreed that mangroves were part of the answer.

It will be decades before anyone knows Vietnam’s chances against the sea.

I contemplated this from the Japanese Bridge in Hoi An while watching raindrops spatter against the water below. Inside the covered bridge I found a shrine to the God of Weather, with spent sticks of incense from other peoples’ prayers. I thought of how exposed this vulnerable community was, how its history and culture might be lost to rising tides. It will be decades before anyone knows Vietnam’s chances against the sea.

So I offered my own prayer to the capricious god: that this beautiful place would still be attracting travellers ‒ and their cameras ‒ in 100 years.

Join over three million BBC Travel fans by liking us on Facebook, or follow us on Twitter and Instagram.

If you liked this story, sign up for the weekly bbc.com features newsletter called "If You Only Read 6 Things This Week". A handpicked selection of stories from BBC Future, Earth, Culture, Capital and Travel, delivered to your inbox every Friday.