store templates separately, modularize api endpoints