title: Multi-site aware PSGI application development
body: <p>The <a href="https://metacpan.org/pod/Plack::Builder" rel="noreferrer">Plack::Builder</a> allows mount multiple hosts, e.g. something as the following snippet:</p>
  
  <pre><code>my @sites = load_site_names();
  my $apps;
  for my $site (@sites) {
      $apps-&gt;{$site} = Some::PsgiFramework::MyApp-&gt;new( config =&gt; get_config($site) );
  }
  
  use Plack::Builder;
  builder {
      for my $site (@sites) {
          mount "$site" =&gt; $apps-&gt;{$site};
      }
      mount '/' =&gt; sub { ... };
  }
  </code></pre>
  
  <p>e.g.</p>
  
  <ul>
  <li>the <code>load_site_names</code> returns a list of sites like <code>http://example.com</code> , <code>http://some.other.site.com</code>, ...</li>
  <li>every "virtual-host" will use the same <code>Some::PsgiFramework::MyApp</code></li>
  <li>just their config is different</li>
  </ul>
  
  <p>I need exactly the above - need develop one simple web-app which should be deployed for hunderts of different (low-traffic) sites and don't want setup an different PSGI server for each site. </p>
  
  <p>However, the author of the Plack itself says (in the <a href="https://metacpan.org/pod/Plack::Request" rel="noreferrer">Plack::Request</a>)</p>
  
  <blockquote>
    <p>Note that this module is intended to be used by Plack middleware
    developers and web application framework developers rather than
    application developers (end users).</p>
    
    <p>Writing your web application directly using Plack::Request is
    certainly possible but not recommended: it's like doing so with
    mod_perl's Apache::Request: yet too low level.</p>
    
    <p>If you're writing a web application, not a framework, then you're
    encouraged to use one of the web application frameworks that support
    PSGI (<a href="http://plackperl.org/#frameworks" rel="noreferrer">http://plackperl.org/#frameworks</a>), or see modules like
    HTTP::Engine to provide higher level Request and Response API on top
    of PSGI.</p>
  </blockquote>
  
  <p>And this is the problem.</p>
  
  <p>I checked many of different PSGI based frameworks in the MetaCPAN. And <strong>AFAIK</strong> each is singleton based, e.g. doesn't allows write applications which could be shared (mounted) many times for different sites in the same <code>app.psgi</code>.</p>
  
  <p>So the questions are:</p>
  
  <ul>
  <li>missed I something in the MetaCPAN (or in the docs), and here <strong>exists</strong> <strong>any</strong> (lighweight) web-framework which allows develop applications mountable many times in the <code>app.psgi</code>?</li>
  <li>or i'm forced to develop <code>Just Another My Own PSGI Framework</code>? (To be honest, I not checked the catalyst - as it is too heavy-weight)</li>
  <li>or just badly understand the "mounting"?</li>
  </ul>