its a whole cycle....
amonia is produced from the fish.... then the bacteria convert it into nitrate then another diff bacteria convert the nitrates into nitirites....
water changes and a good filtration system are the best way to keep and maintain good water quality...
i recommend doing a 10% water change every other week.... then depending on your tank either you need to add more LR to add in the nitrate cycle.... add more to your sump or add some macro algaes.... if you have canister filters like i run.... then clean them more often and replace or run an activated carbon to help....
i clean my media floss in my canisters every 2-3 weeks and use chemi-pure carbon i replace that every 2 months.... ( i know 2 months sounds long but the company and the LFS where i get it from swear its good for 3+ months but i decided 2 was long enough for me.... my water always stays constant and clean....