Dumping your untreated poop directly into the river is actually a bad practice.
A lot of municipalities (at least in my neck of the EU) have a main line running through it which collects the sewage from the buildings and brings it to a water treatment plant.
If that is not an option then a septic system can be installed:
A typical septic system works with a large holding tank which overflows out into the drainage field. Which is a large area where the sewage gets slowly percolated into the groundwater where natural processes take care of it.
Building a septic system required a permit in most areas. This permit is to ensure the field and tank are sized properly, its location is recorded and that the ground can percolate the waste well enough.