We developed a 6D multi-particle tracking program CETASim in C++ to simulate intensity-dependent effects in electron storage rings. The program can simulate the beam collective effects due to short-range/long-range wakefields for single/coupled-bunch instability studies. It also features the simulation of interactions among charged ions and the trains of electron bunches, including both fast ion and ion trapping effects. The bunch-by-bunch feedback is also included so that the user can simulate the damping of the unstable motion when its growth rate is faster than the radiation damping rate. The particle dynamics is based on the transfer maps from sector to sector, including the nonlinear effects of amplitude-dependent tune shift, high-order chromaticity, and second-order momentum compaction factor. Users can also introduce a skew quadrupole useful for emittance sharing and exchange studies. This paper describes the code structure, the physics models, and the algorithms used in CETASim. We also present the results of its application to the PETRA-IV storage ring.