They say New York is the city that never sleeps. But Shanghai must have silently crept up one night and snatched the title while the Big Apple was snoozing.

After decades of communist chastity imposed on a city that used to be known as the 'Whore of the Orient', Shanghai is coming into bloom again. Though, not blessed with natural beauty, Chinese industriousness (and the occasional former army commander cracking the whip in his new-found role as business entrepreneur) is making the city something of a model for the 21st century.

Recently, the makers of Code 46, a sci-fi version of the old classic Casablanca, decided that rather than build a set, they would use Shanghai (along with Dubai and Hong Kong) as the backdrop for their film. And it is not hard to see why. Skyscrapers shoot out of the ground like mushrooms overnight, and each humid and often overcast day brings a fresh twist in the tangle of four-lane carriageways that snake through the city.

Far removed from the rural workers paradise of Chairman Mao's dreams, this booming metropolis already counts twice the population of London. Every week thousands more pour in, adding to the pool of cheap manual labour that fuels Shanghai's apparently perpetual construction boom: glass and chrome high-rise towers, a gleaming new underground system and the world's first commercial magnetic levitation train, which runs from the airport to the city at 270 mph, are all symbols of the 'new' China.

Amid this enthusiasm for the new, something has to give. To the horror of European visitors, city planners pay little heed to historical buildings, knocking down parts of the old colonial concession areas to make way for shopping arcades and office blocs. For a country that places a high value on tradition, the only tradition in Shanghai seems to be that nothing is sacred: not even the founding headquarters of the Chinese Communist party. These are now surrounded by Starbucks and Kentucky Fried Chicken, as well as home-grown chains serving food and drink at prices no ordinary worker could afford.

It is understandable that the Shanghainese are not keen to be reminded of the colonial days when they were second class citizens in their own country, victims of the biggest drug-pushing campaign in history — the Opium Wars. Better to be in control of one's own destiny again, free from the outside interference of Western powers, and later, its jealous sister in the north, Beijing. And so this city is proud to be at the forefront of change in China.

Walking through Shanghai's shopping malls just before Christmas, it is hard to imagine that this is still officially a communist (and an atheist) state. Every shop assistant is dressed like one of Santa's elves, teenagers parade the latest mobile phones, and shops are stocked full of real Gucci and Prada (the fakes are round the corner in the street market). Buddha-worship is back in fashion, but his latest incarnation bears the name 'Mammon', for the Chinese are a pragmatic lot and he is the one god guaranteed to bring good fortune in the here-and-now.

But Shanghai's success has also lured back a number of old acquaintances: prostitution, gambling, and drugs. At least rich and poor alike unite in their new-found hedonism. Status symbols herald the return of class division, and the rich openly send their children to university at the twin high courts of class and capitalism: Britain and the United States.

To some, the liberalisation of the market without the introduction of political freedoms spells danger in a country of over 1 billion people. Rising unemployment (currently 10 per cent), increased superstition (witness the growth of the Falun Gong movement) and a failing health system (HIV infections are becoming a serious problem in both rural and urban areas) point to the danger of social unrest if the boom should ever falter. Beside every high-rise tower still lie the hutongs, cramped alleyways of communal housing without clean water or electricity.

The Chinese I met were reluctant to speak about democratic change in all but the most general terms. Sticking your head out from the crowd has never been considered a wise move here. In January, democracy activist Wang Bingzhang was sentenced to life imprisonment in a one-day trial behind closed doors after apparently being kidnapped from neighbouring Vietnam by Chinese agents.

So while the market has been opened up to capitalist investment, the Communist Party still keeps a firm grip on the reins of power. Change is slow, and only recently has anyone seriously suggested a directly elected government could replace the current system of appointing leaders through committees.

For now, Shanghai's sons have taken over all senior positions in the Communist Party and hope to steer the rest of the country down the same route of economic success their city has taken. Ambitious new projects, such as sending the first Chinese astronaut into space by the end of 2003, hosting the Olympic Games in 2008 and the World Expo in 2010, are to uphold Chinese pride in the face of its failing Communist institutions.

On a stroll through a tranquil park I ask a Chinese friend whether one of the young men shivering in the morning air in his oversize People's Liberation Army parka is doing his national service. After the Tiannanmen massacre in 1989, all students are required to undergo military training, to remind them of their patriotic duties. Somewhat reassuringly the young soldiers doesn't bear a weapon. My friend tells me, "his duty is to protect the flowers and trees."