New app system middleware and template processor