Back
Amir

check the HTTP Host header for the hostname being accessed and look it up in your database to find the user who it belongs to.

What if I have a subdomain for the users e.g user.domain.com and they want to use their custom domain. Do I give them a custom.domain.com to point their CNAME record to?

Yes. I'm doing that with #chamados. Users can have both, a subdomain and a custom domain.

When a request arrives, I check where it belongs on my main controller and set the scope for the rest of the app.

Do you users point the CNAME record to the subdomain?

To my main domain, but I think pointing to a subdomain also works fine.

an end-to-end encrypted filesystem like s3ql or a commercial offering like objectivefs. i use the latter from multiple machines, works like a charm. i store my git repos on there and periodically push to GitHub. working on a remote filesystem has its drawbacks, too, it can get especially slow when you have high latency or are working with large files.

An LLC provides a good balance of operational simplicity and liability protection compared to sole proprietorships and corporations.

From a U.S. perspective, I would suggest keeping things simple: incorporate where you do business, until you have a reason to optimize your tax liabilities. Typically, this would be in your home country (and home state/province), to simplify paperwork. If you're in the U.S., don't bother with "off shore" incorporation since the IRS lays claim to worldwide earnings for U.S. persons/companies and it's on you to prove otherwise. For almost everyone else, the world is your tax oyster :)