The adjoint method is an efficient approach for computing derivatives because its computational cost is independent of the number of design variables. Using the derivatives computed from the adjoint method, a gradient-based optimization can handle complex design problems such as full-scale aircraft. Despite the above advantages, implementing the adjoint method for a partial differential equation based primal solver is a time-consuming task. To lower the barrier for adjoint implementations, we propose an object-oriented framework to rapidly develop the discrete adjoint method based on OpenFOAM; an open-source, multiphysics package that contains more than 80 primal solvers involving a wide range of disciplines such as aerodynamics, hydrodynamics, heat transfer, structures, combustion, and multiphase flow. The proposed framework provides high-level interfaces that allow us to implement the adjoint method for any existing steady-state OpenFOAM primal solvers by adding or modifying only O(100) lines of source code. In this paper we introduce the overall structure of the proposed adjoint framework and detail the adjoint development process by starting with a simple scalar transport equation and then extending the development to the Navier-Stokes equations. So far, we have implemented adjoint methods for five primal solvers and four turbulence models. We observe excellent adjoint scalability with up to O(10) million cells and O(1000) CPU cores, and the maximal error in the adjoint derivatives is less than 0.1%. To further demonstrate the benefit of having the flexibility to rapidly develop the adjoint method for different solvers and turbulence models, we showcase three successful aerodynamic shape optimizations that cover incompressible, compressible, full turbulence, and transitional turbulence conditions. Our proposed adjoint framework has the potential of becoming a useful tool to handle high-fidelity multidisciplinary design optimization problems for general engineering systems such as aircraft, cars, ships, and turbomachinery.