Shanghai’s origins trace to the 7th century (Tang Dynasty), when a settlement called Songjiang was established in present‑day Songjiang District (southwest of modern downtown). The name “Shanghai” ( “Upon the Sea”) appeared later as the port grew at the confluence of the Yangtze estuary and the Huangpu River.
By the Song Dynasty (11th c.) it was a market town; the 1842 Treaty of Nanking opened it as a treaty port, launching its meteoric rise.