How many Workers scripts can I have per domain?

How can you store many scripts under the same domain?
Later with routing trigger individually.
Or will be the option just one big script pre domain?

Hi @adaptive, regular accounts are limited to a single script per domain, while enterprise accounts can have multiple scripts per domain.

The enterprise-level multi-script feature is useful to split up responsibilities among different teams, but using a single script per domain brings its own performance benefit: it’s less likely to be evicted due to infrequent use, so you are less likely to encounter cold starts of your script.


So as someone who is new to Workers and similar products, would it be the best thing to write my own routing code if I want to trigger different functions based on subdomain and route?

Hi @cat24max, yes, I’d say so. There exist routing libraries out there (e.g., ruta3) that you might want to experiment with if your needs end up being substantial. Otherwise, I’d recommend starting with a simple if-else chain, like in this example recipe: Conditional response · Cloudflare Workers docs


1 Like

Thanks, I have looked at ruta3, but I don‘t think it‘s really the best for my usecase.
I need to get the current subdomain AND route and then route the request to the correct function.
But it won‘t be alot at this time, so a do-it-myself routing is probably sufficient.

As you can see, this thread is old. You can apply 30 scripts to one domain, but you’ll have to apply the 30 scripts to different subdomains or paths. For example:

  • ** can be one script
  • ** can be another script
  •* can be an additional script

Notice that while * matches everything, the /login* overrides the previous *.

And you can of course use one script that act as a router for multiple modules inside 1 single script.