For my apartment, I run rtsp-simple-server[1] on my home server and use Raspberry Pis with generic USB webcams running ffmpeg to stream the audio/video to the RTSP server. Then I run camera.ui[2] separately for a nicer interface on top of all the cameras, HomeKit integration, etc.
The only downside hardware-wise is I don't get any indoor IR night vision with these, which some of the nicer "smart home" account-locked ones do.
It's honestly not too bad to set up if you run [1] and [2] in Docker. I've done disaster recovery scenarios of my home infra where I straight up disconnect the modem's uplink and everything works without any issues.
[1] - https://github.com/bluenviron/mediamtx
[2] - https://github.com/seydx/camera.ui