With PETRA III, we use one of the world's most brilliant 3rd generation light sources to investigate in-situ the growth of ferroelectric thin films during the deposition process. For this purpose, we have built an rf magnetron sputtering chamber suitable for use at the High Resolution Powder Diffraction Beamline P02.1. It is restricted in size and weight to fit onto the diffractometer, but is not limited with respect to the performance of the sputtering process.The goal of this study is to determine the influence of the processing parameters on nucleation, crystallization, and microstructure evolution during film growth. This fundamental knowledge is necessary to systematically control the composition, the morphology, and the resulting electrical properties of the layers for specific applications. In this talk, the design of the chamber and first experimental results will be presented.