FOR a picture of America’s pre-crisis economy, pay a visit to the south-east corner of Las Vegas. Where the valley begins to rise into the high desert, a Chinese developer has carved the top off a mountain. A wide, empty, road rises into what looks like the remnants of an Inca city. The project, named “Ascaya”, was once America’s biggest excavation site. The idea was to sell the plots to Las Vegas’s elite, whose mansions would enjoy a view over the desert in one direction and the bacchanalia of the Strip ten miles away in the other.

Instead, in 2009, Las Vegas’s economy died. For five years the project appeared doomed to become a monument, carved into rock, to an unsustainable housing boom. Now however, construction has restarted—not just on this site, but on several hundred others at the city’s edge. House prices, like employment, visitor numbers and gambling revenues, are creeping up again. Las Vegas’s economy is recovering—fitfully, but in a way that is more sustainable than its previous boom was. The city, unique though it is, is an exaggerated microcosm of America at large.

Las Vegas is, even by American standards, a new city. In 1971, when Hunter S. Thompson examined the American dream, and a lot of drugs, in Las Vegas, the city was little more than an outpost of seedy casinos baking in the desert. Then, the population of Clark County, which covers the city’s sprawl, was just 290,000. It is now more than 2m. Visitors to the Strip staring out of their skyscraper hotel windows see a vast sprawl of freeways, strip malls and terracotta-roofed suburbs. In most older cities, aeroplanes land at the edge. In Las Vegas, they fly practically into downtown, because the airport was built before the sprawl spread out from it.

The engine of this growth was, and remains, tourism. Among American cities, only Miami and New York attract more foreign tourists, according to Euromonitor International. Domestic tourists too are legion. Before the crisis, hotels on the Strip were routinely blown up to build newer, bigger, replacements. The ground floors of these palaces, with their vast smoky halls of card tables and slot machines, generated some $9.6 billion of revenue in 2014. Over a third of Las Vegas’s workers are employed directly serving visitors. Those jobs, which paid good wages to people of modest education, helped to draw thousands of new workers from surrounding states to live in the desert every year.

When banks’ own gambling on subprime mortgages turned sour and the recession hit in 2008, this machine ground to a halt. The number of tourists dropped precipitously—and those who came spent far less. Revenues tumbled, and population growth fell to almost nothing. “We got crushed” says Jonas Peterson, the head of the Las Vegas Global Economic Alliance, a local business development outfit. At the same time, the city housing bubble, which had been inflated by cheap subprime loans to casino workers, imploded. Property prices plunged by nearly two-thirds; over 70% of Nevada’s homeowners fell into negative equity (see chart). Housing construction, which had been running at 30,000 homes per year—much more than in the whole of New York city—fell to almost a tenth of that.

Patrick McCracken, a 23-year-old construction worker, says that when he left school at 16, just before the crash, he walked straight into a job. Then, labourers without high-school degrees on the Strip made as much as $50 per hour. Shortly afterwards he was laid off, and his father’s construction business went under. He started using drugs and ended up in prison. Unemployment in the city, which had long been below 5%, rose to 14%. Casinos stopped construction, laid workers off and cut wages. Many smaller outfits at the fringes of the Strip and in the city’s downtown went bust. “It used to be the case that going to college in Vegas didn’t make much sense, because you could make $50,000 a year parking cars or bringing drinks”, says Stephen Miller, an economist at the University of Nevada, Las Vegas. That is a harder argument to make now.

And yet in the past few years, life has improved. The old jobs have not come back but there is work. Mr McCracken now makes $18 per hour working on an energy project outside the city—enough, when combined with his wife’s income from her work as a stripper, to raise a one-year-old son. The city’s unemployment rate has fallen below 7% and the promise of a decent life for ordinary Americans once again seems in reach. Just 22% of Las Vegas’s residents have degrees, sharply less than the national figure of 29%. But average household income in the city has crept back up to $51,000, only marginally below the national figure. Population growth, though not what it was before the crisis, has climbed back up. New housing construction is edging upwards. Most of it takes the form of enormous houses at the edge of the city.

As it has recovered, Las Vegas’s economy has diversified. A growing number of businesses have little to do with the traditional gambling industry. One of the new employers in the city is Switch, a secretive firm which manages data for thousands of America’s biggest companies. With its brushed metal interiors, the firm’s campus near the city’s airport resembles an alien base in a video game. Burly tattooed men in sunglasses, equipped with tasers—and should they need them, assault rifles—guard a series of buildings in which hundreds of thousands of servers hum quietly. Enough fuel and food is stored on site to keep going for several days without the need for outside help. Anyone who plays video games, uses online banking or shops online, in all likelihood has personal information stored there.

Las Vegas is a fine place to put such a centre, says Missy Young, a vice-president at Switch. Thanks to an ill-fated investment by Enron in the late 1990s, Sin City has a better fibre-optic network than almost anywhere else in America (the network was bought out by Rob Roy, Switch’s founder). Casinos, which have vast amounts of data to manage, make for good local clients, and thanks to their history of building crazy temples in the desert, talented construction workers are easily found. Unlike California or the East Coast, the city is at little risk of powerful earthquakes or hurricanes which might knock out power. The desert air, though hot in summer, is dry and, on average, in fact rather cool, which is useful for keeping Switch’s kit humming.

As well as the 450 or so workers Switch employs directly, the firm’s clients often send their staff to Las Vegas to manage their servers on site, adding several thousand more employees to the city’s labour force. Switch is one of two big internet firms in Las Vegas. Zappos, an online clothing shop that is owned by Amazon, also has its headquarters there. Its boss, Tony Hsieh, who likes to shuttle employees to parties in a fleet of converted school buses, has invested in reviving Las Vegas’s downtown, which, despite multiple attempts by the city’s government, used to be mostly known for shabby casinos, dodgy motels and the possibility of being mugged. Elements of that still exist, but washed-out drug addicts and ancient gamblers now share space with yuppies, who wander around a new mall made up of shipping containers and guarded by an enormous, fire-breathing metal insect.

Shout a seven

Even the traditional casino business is changing. Big resort operators have moved to attract richer customers, who still have money to spend, and to protect themselves from the growing competition of gambling in other states. Since the crash, the average age of a visitor to Las Vegas has fallen from 51 to 45. Older people, who come mostly to play slot machines, are being crowded out by younger visitors who have little interest in gambling but instead spend their days getting drunk and sunburnt at poolside “day clubs” and their nights at enormous nightclubs. Thanks to this, charges on the Strip for hotel rooms, shops, drinks and so on now make twice as much money as gambling does—almost two-thirds of the total, up from just over two-fifths in 1990.

To attract high-spending yuppies—the males decorating the strip in brash shirts, the females in tight black dresses and precarious heels—casino operators are going as far as to hide the gambling. “In the old days, we designed casinos like supermarkets”, explains Bill Hornbuckle, the perma-tanned president of MGM Resorts International, one of the biggest operators. “We built a big room, put a door in the front and put the milk—the hotel room elevators—in the back, so that people had to schlep through the casino”. Now, he says, casino operators across the Las Vegas Strip are redesigning their entrances to make them more appealing to people who do not like gambling. In Las Vegas, where even pharmacies and petrol stations usually contain slot machines, some newer hotels do not even have casinos at all.