In the town of Avdiivka, in eastern Ukraine, the near-constant Russian shelling has reduced the city to rubble.

In recent weeks, the assaults have only intensified. By March, only around 1,700 people remained from a prewar population of about 30,000.

Life is precarious. Because of the danger, other civilians have been barred from entering the town, and public workers and children have been given mandatory evacuation orders.

Still, those who remain insist they will stay, moving underground as the bombardments claim yet another piece of their homes.

Once a bedroom community for the nearby city of Donetsk, Avdiivka has long stood at the front line of war.

Beginning in 2014, Ukraine’s fight against Russian-backed separatists played out on their doorsteps as the town became a key defensive position for Ukrainian forces. When the full-scale Russian invasion began in February last year, Avdiivka came under heavy assault.

Serhiy Albertovych, 63, steps carefully across the rubble on the ground floor of the apartment building he calls home. It was bombed in March 2022 and again one year later.

“People used to live here, but they left,” he said. “Today, I’m the only inhabitant of the street.”

He dried moldering bread on the floor in one of the apartments in an attempt to be able to eat it.

He was offered an evacuation but turned it down.

“I’m here alone and I’ll be here until the end, until the end of my life,” he said.

Russian forces have been trying to seize Avdiivka for more than a year, blasting it with artillery strikes and probing the perimeters. In the nine years since war first came here, the area around Avdiivka has become something of a labyrinth of defensive positions.

As Russian troops continue to put pressure on the town’s perimeters, Ukrainian forces have dug in to resist their advance. The fighting remains fierce. On Thursday, military officials said that Russians had attacked in the area using tanks, multiple rocket launchers and artillery. Ukrainian troops had held their positions, they said.

But within what remains of the town, there is another network forged by the last holdouts.

Igor Golotov, 40, has been living in the ruins of the town and volunteering to help other inhabitants survive.

“When they started shelling the city, many people immediately packed up and left,” Mr. Golotov said. “Those who, as they say, had patience, fearlessness, over time it disappeared, as well.”

But, he said, many simply would not leave. They have no money and no idea where to go. It took considerable convincing to encourage his own mother to leave the city. But eventually, she relocated to the relative safety of Vinnytsia, in central Ukraine.

Still, he is amazed at the resilience of the people who have chosen to stay.

“I’m telling you, people have adapted to everything,” Mr. Golotov said. “They have settled down, they are leading their lives. If only there was no shelling — they have everything, they have their everyday life.”

Inna, 57, who did not give her last name, chose to stay behind after her husband and her children were evacuated to care for her father, who is older and sick. He refused to leave, she said, tears creeping into her eyes when she spoke of her children.

At the city’s heart is the once-thriving Avdiivka Coke and Chemical Plant, one of the largest producers of coke, a coal-based fuel, in Europe.

The industrial product is important to steel production, and before the war, more than 4,000 people worked at the plant, which produced 12,000 tons of coke per day.

Now, heavily damaged by Russian bombing, the plant is no longer operational. The factory has been badly damaged by aerial assaults. The furnaces that once blazed have been shut down. A small crew of workers remains for basic maintenance, but it is unknown if the plant will ever be able to reopen.

Many who stayed are former workers at the plant, and some of them are now taking shelter in the basement of the spectral industrial space.

Mykhailo Orlov, 65, is one of just two doctors who remain in the city’s hospital.

“It’s very difficult when there are a lot of injured people, and we don’t have enough staff to help them all at once,” he said. “And everyone does what they can.” The mining company, Metinvest, which owns the main factory and provides aid to the town, regularly sends medicine and other supplies to the hospital.

“Whatever we need, we make a list and send it,” Mr. Orlov said. “That way, for three to four months, we have everything we need.”

It is not just injuries from the conflict.

The hospital treats older patients with diabetes and other chronic illnesses.

“Everyone comes here, and we try to help everyone as much as we can,” he said.

On a recent morning, a woman injured in an artillery attack was helped to the hospital by her son and a neighbor. Her son looked on while Dr. Orlov stabilized the patient for a potential evacuation to the hospital in Pokrovsk, nearly 40 miles away.

Dr. Orlov’s apartment was destroyed, so he lives in the hospital and sleeps only when there are no patients.

“I have to be useful here,” he said. “I’m staying here because it’s my little homeland.”

Megan Specia reported from Kyiv, Ukraine. Gaëlle Girbes is a freelance photographer who occasionally works to provide humanitarian aid in Ukraine. Dmitriy Yatsenko contributed reporting.