Shanghai street scene
Shanghainese men exercise in a park in the centre of the city. Reuters

A 'lao wei', or foreigner, in China in 2008 was still a pretty rare sight on the streets of Shanghai, a time when the expatriate population was largely made up of English teachers, itinerant journalists and business high-flyers living on huge compounds on the far outskirts of the sprawling city.

When I moved to Shanghai earlier that year, Beijing was preparing to host the Olympics and had made it far more difficult for foreigners to apply for work permits. There were few jobs outside poorly paid and infamously unstable English teaching positions and a few expatriate magazines. Salaries were far better than those of locals, of course, but a flight to Britain cost a months' salary – so we never went home.

Shanghai could be a punishing place to live, with a seemingly impenetrable language, wildly different cuisine, a chaotic work environment, sticky humid summers and bitterly cold winters, felt all the more acutely as Chinese policy prevents installing central heating anywhere south of the Yangtze River. For five long months we would shiver on the sofa, surrounded by electric heaters, waiting for spring.

On the streets, locals would often stop and stare – or even worse, point and laugh – and it was common to be followed in the supermarkets by little old ladies, peering into your shopping basket in open-mouthed wonder. Before learning the basics of the language, the only way to get around was by carrying bundles of business cards and scraps of paper with Chinese addresses to show to taxi drivers.

The weather hasn't changed, but almost everything else has. In 2016 a foreigner on cosmopolitan arteries such as Huaihai and Nanjing Roads – let alone in the leafy French Concession – barely attracts a glance. China has made it far easier for people to visit the country (introducing two-year, multiple entry visas for the first time, for example), and foreigners have flooded in.

There are no official figures on the expatriate population in Shanghai or China more widely, but it appears to have ballooned. Western-owned bars and restaurants dominate the French Concession where, on some streets, it is rare to see a Shanghainese face. On the Yong Kang Road bar street on a sunny Saturday afternoon, boisterous British, French and American expats swill beer and swap stories.

The advent of smartphones has made life easy for those who don't learn Mandarin and you can now have anything from pork sausages to American cookies delivered to your door. Shanghai has no less than a dozen craft breweries, scores of American diners, cocktail bars – even Uber, meaning that the days of shouting unintelligible street addresses to bemused cabbies look soon to be over for good.

It is not just Shanghai's foreign population that has changed – but the Shanghainese too. In 2008, a Japanese entrepreneur owned the best-known cocktail bar in the city and the lone microbrewery was founded by an American. In 2016, it is often the Shanghainese that own and operate the city's best nightlife spots – visit them on a Friday night and you'll find locals, not 'lao weis', filling the tables.

There are those in Shanghai who will rue these changes, there always are, but I would not be one of them. What makes Shanghai so addictive is that it has a momentum that is always one step ahead, so that being there always feels like riding just behind the crest of a wave. It is more than China's financial and economic hub and the motor of its remarkable growth; it is its ambition.

Whether it is banning the age-old custom of wearing pyjamas in the street, prohibiting the use of fireworks, locking up Nobel Prize-winning poets or bulldozing centuries-old neighbourhoods in Shanghai and Beijing, the Chinese government frequently seems to be ashamed of the unique characteristics that make China the country that it is.

But Shanghai retains those characteristics in spades, alongside the cultures and traditions of Chinese residents from every corner of the country and foreigners from across the world. Like London, or New York, Shanghai's diversity is its essence. It is one of the reasons that for decades the Communist Party has never really trusted Shanghai, fearing its constant refusal to be tamed.

The West originally imposed internationalism on Shanghai, with the British and then the French demanding 'concessions' in the port city after China's defeat in the opium wars. In the 1930s, foreigners poured into Shanghai helping to cement the concessions – the distinct characters of which remain today – until the door closed in 1949 with Mao Zedong and the Communist era.

That door has been open for some time, but it is only in the last few years that so many have chosen to pass through it. Those that do will be privileged to see China at its most dynamic and exciting, but also its most pivotal. When China changes, it will be Shanghai that leads the charge – and there will be nothing that the Communist Party elites can do to stop it.