Map wildcard subdomains to static site folders in CDN?

We’re building a multi-tenant CMS. We’d like to support tens of thousands of tenants. We’d like to have a wildcard cert on our domain (mydomain.com) and give a subdomain to each tenant (acmecorp.mydomain.com). Can we map each subdomain to a folder in your CDN, where we can store a static site? e.g.

acmecorp.mydomain.com -> <somewhere in cloudflare>/acmecorp
alpha.mydomain.com -> <somewhere in cloudflare>/alpha

We’d also like to offer our tenants the ability to use their own domain, so if acmecorp has acmecorp.com, we’d like to be able to give them an SSL cert and direct acmecorp.com to /acmecorp as well.

Ideally, we’d like to programmatically handle as much of the above as possible, especially the subdomain to CDN folder mappings and CDN folder creation. We’d also like for there to be as few moving parts as possible between someone typing acmecorp.mydomain.com into their browser and hitting their static site at /acmecorp.

Firstly, I’d love to know if the above is possible at Cloudflare. Second, if someone could provide links or examples doing the above, it will be greatly appreciated.