Despite having no experience of dock building, Hartley was the first full-time professional dock engineer in the world. He had previously worked for his father, Bernard Hartley who was a stonemason, architect and bridgemaster, John Carr and the Duke of Devonshire.
Initially he was appointed Deputy Dock Surveyor to John Foster Jr. However, due to John Foster Jr. resigning three days later, he was promoted to Acting Dock Surveyor. During his service, he not only built new docks, but also modernised all of the existing docks, with the exception of the Old Dock (opened in 1715) which had become disused and filled in. The docks at Liverpool grew from 46 to 212 acres (19 to 86 ha) during his tenure.
In 1831 he was appointed to convert the Manchester Bolton & Bury Canal to a railway line. He persuaded the company to keep the canal open and build the railway more or less along its route.
Between 1841 and 1843 he prepared a number of different designs for fireproof construction of dockside warehouses. In 1843, he made models of warehouse arches at the Trentham Street Dockyard, to test sheet iron lined timber floored building method and brick and iron building materials. Through fire testing of these models, he eventually convinced the Dock Board Trustees of the benefits of his iron framed construction method. These experiments proved the worthiness of his fireproof design and he designed the Albert Dock to these specifications.
Hartley’s improvements over earlier dock and warehouse design included the use of locks to keep the water at a constant level, so that loading and unloading of ships’ cargoes was not reliant on the tide and the enclosure of the dock with high boundary walls, to reduce theft from the docks. He also adapted and improved the design of St Katherine’s Dock in London, by incorporating high arches in the buildings to accommodate cranes.