We present a new multi-fluid, grid-based magnetohydrodynamics (MHD) code PIERNIK, which is based on theRelaxing Total Variation Diminishing (RTVD) scheme. The original scheme has been extended by an addition ofdynamically independent, but interacting fluids: dust and a diffusive cosmic ray (CR)gas, described within the fluid approximation, with an option to add otherfluids in an easy way. The code has been equipped with shearing-box boundaryconditions, a selfgravity module, an Ohmic resistivity module, as well as otherfacilities which are useful in astrophysical fluid-dynamical simulations. Thecode is parallelized by means of an MPI library. In this paper we brieflyintroduce the basic elements of the RTVD MHD algorithm, following Trac & Pen (2003) and Pen et al. (2003), and then focus on a conservativeimplementation of the shearing-box model, constructed with the aid of Masset's (2000) method. We present the results of a test example of the formation of a gravitationally bound object (a planet) in a self-gravitating and differentially rotating fluid.