'Berlin is poor but sexy," city mayor Klaus Wowereit famously said in 2003. No one could describe Hamburg as poor, but from my seat in the Strandpauli beach bar , Germany's second city looks pretty hot nevertheless – and not in the sense of an airless summer in the capital.
There's salsa on the stereo and bratwurst on the barbie. Hipsters in Aviator shades chat in a palm-thatched bar and lounge on driftwood daybeds beneath kitsch oversized lampshades. It's like Robinson Crusoe gone retro.
Strandpauli is one of seven outdoor beach clubs that make Hamburg the coolest summer city in Germany. While landlocked Berlin swelters, the other German metropolis is all balmy North Sea breezes and barefoot boozing in beach clubs, a seaside slant on the traditional biergarten that only open in warmer months; year-round Strandpauli is an exception. Sure, Berlin has similar bars. But only here can you scrunch sand between your toes as ships chug into one of the biggest harbours in the world.
Locals have holidayed on the strands of the mighty Elbe river for more than a century, and beach bars there remain the first choice for many – places such as Strandperle in the chichi western suburb of Övelgönne, a glorified shack on silky sands for a moneyed set. Now, with the rediscovery of the harbour as Hamburg has blossomed into a style city, the beach club scene has moved uptown to St Pauli in the notorious Reeperbahn district, where you party against a backdrop of docks that are 20 times larger than Monaco.
Hangouts such as Central Park are a real find in this nightlife playground. Half beach-culture, half street-culture, it is an oasis of coastal vibes among grimy streets, with deckchairs scattered over imported sands and massages to go with your mojito.
On my sun-drenched afternoon at Strandpauli, I'm among young families and locals taking a breather between shops. As a sultry dusk settles over the city, the crowd gets dressier, the music clubbier. For a change of scene, I head upriver to slicker Hamburg del Mar and order a sundowner to suit the chilled house grooves and lights shimmering on the docks across the river. Like every other beach club in Hamburg, entry is free.
If most foreign visitors are ignorant of the beach club scene, the Reeperbahn is to blame. Its red-light district means that, for many Britons, St Pauli is synonymous with strippers and stag parties. It was to counter such misconceptions that Henning Bunte founded homestay agency St Pauli Tourist Office. I'm staying with Barbara and her DJ boyfriend for less than the price of a round of drinks. In central Hamburg, they're making architectural statements such as Herzog & de Meuron's futuristic Elbephilharmonie concert hall as part of a €5bn docklands redevelopment scheme. The well-heeled suburbs contain more millionaires than anywhere else in Germany.
But a couple of stops from the centre on the U-Bahn lies this grungy former dockers' neighbourhood. The district's post-punk creativity is realised in cool beach clubs and also a grungy alternative scene. On Barbara's advice I visited the streets of the Karoviertel in the area of north St Pauli in the afternoon. Hipsters mixed with Hausfrauen in a superb fleamarket on Hanseplatte, and the in-Kraut browsed for vintage Adidas along Marktstrasse.
The Karoviertel and adjacent Schanze are also hubs of nightlife, so I return to check out Rote Flora . A former theatre saved by radicals who opposed plans for a commercial venue, it is now a nightclub.
Almost vanished beneath political banners and graffiti, it certainly looks the part, even down to giant bolt-cutters that hang above the dancefloor. But there is a limit to keeping it real and mine is a DJ who plays "Apocalyptic Harsh Free Noise", according to the poster. I take Barbara's advice again and find myself in a glorified scout hut. Grüner Jäger was a forester's house before it was swallowed by the city. Now it's a cosy club – a little kitsch, a little trashy; all disco balls and antler chandeliers. Cheers greet the electro-disco of Funky Town and the DJ beams.
Perhaps due to the DIY credo of its anarcho-punk past, St Pauli excels at such reinvention. For years, the authorities tried to tear down a hulking concrete war bunker by Feldstrasse U-Bahn. When they gave up, the nightclub Uebel und Gefährlich moved in. Bearded indie types nod to block-rockin' beats and this may have something to do with beer at €3 a bottle – every concrete blast-door I peer around reveals another room fizzing with a friendly party vibe.
I'm flagging as 5am approaches but am determined to make it to Golden Pudel Club. A dilapidated shack by the port, "Pudel" is part bohemian café, part community centre, part club where musically (and probably socially) anything goes – from German anvil techno to Jamaican dancehall.
And being a St Pauli institution, Pudel is less a club than a legal squat party. The lighting rig would embarrass a pub DJ, the bar is a fridge and a cashbox. "Anything can happen at any time for no reason", someone has scrawled on the wall, and it feels like it might. Dawn has long since passed, but graffiti artist Rebelzer won't hear of my calling it quits. The Fischmarkt is open – a couple of fish rolls is all I need to continue, he says. Hafenklang club is still going 10 minutes walk away, Silber is about to start. Strandpauli will reopen in a few hours, too. Somewhere beyond the port a dance beat begins to throb.
• Flights from Stansted to Hamburg with easyJet cost from £25 one way. St Pauli Tourist Office (+49 40 9823 4483) books rooms, apartments and houses in St Pauli from €30 a night. Its themed tours cost from €15 per person. All beach clubs are open May to September from noon to midnight, except Strandpauli, which opens year-round.