I have two open-source projects where people can self-host for free, or use the cloud (SaaS) version. Although with Mapzy I stopped providing the cloud version for now. I have one codebase and then use an environment variable to activate features like Stripe that I need for the cloud version.
Mapzy: A simple storefinder (https://github.com/mapzy/mapzy)
Fugue: Privacy-friendly product analytics (https://github.com/shafy/fugu)