The digital correlator is a crucial element in a modern radio telescope. In this paper we describe a scalable design of the correlator system for the Tianlai pathfinder array, which is an experiment dedicated to test the key technologies for conducting 21cm intensity mapping survey. The correlator is of the FX design, which firstly performs Fast Fourier Transform (FFT) including Polyphase Filter Bank (PFB) computation using a Collaboration for Astronomy Signal Processing and Electronics Research (CASPER) Reconfigurable Open Architecture Computing Hardware-2 (ROACH2) board, then computes cross-correlations using Graphical Processing Units (GPUs). The design has been tested both in laboratory and in actual observation.