Ployter

Templates

How to turn a project that already works into a template and create identical projects from it.

A template stores the structure of a project: services, build and deploy settings, processes, scheduled jobs, volumes, variables, domains and managed databases. With it, you create an identical new project in a few clicks, filling in only what changes (name, domain, keys). The project you create isn't tied to the template.

Use templates to repeat the same stack for several clients, or to have a staging environment identical to production.

Note

Saving and importing your own templates is a plan feature (custom_templates). The Ready-made apps in New service stay available on all plans. See Subscription, plans and costs.

Create a template from a project

  1. Open a project that already works (e.g. loja).
  2. In the ⋮ menu at the top, click Save as template.
  3. Enter a Template name and, if you want, a description.
  4. Click Create template.

The panel copies the services, volumes, domains and managed databases, without the data. It then opens the template screen for you to review.

Review the template

Open Projects → Templates and click Edit on the template. The screen has these parts.

loja template screen with the services' variables
loja template screen with the services' variables

Template variables

These are questions asked once at the top of the form when the template is used. Create one with Template variable, give it a lowercase key (e.g. dominio) and a question. Then write ${{dominio}} in any service value or domain, for example https://api.${{dominio}}. When the template is used, the panel replaces it with what was filled in.

Variables for each service

For each variable, choose under When used what happens in the new project:

Option What it does
Copy The same value in every project.
Reference Copies the reference as is (e.g. ${{mysql.MYSQL_URL}}). It works in the new project, because the internal names repeat.
Generate A new random value on each use, with the number of characters you choose. Good for passwords and keys.
Ask Becomes a field in the form, with a question, a default value, required and secret.

The panel already suggests an option for each variable. References become Reference. Names with PASSWORD, SECRET, TOKEN or KEY become Generate when the value looks random, or Ask (secret and required) when it doesn't, such as a payment gateway key. Names ending in URL, HOST or DOMAIN become Ask. Everything else becomes Copy. Review them before saving.

Remove from template removes the variable. Under Shared variables, you choose the team sets the service uses. If a set no longer exists, it is left out when the template is used.

Domains

Each domain can be:

  • Ask when used: a field in the form, with a question and a default value (accepts ${{dominio}}).
  • Automatic domain: a .ployter.app address already pointing to the server, to test before setting up DNS.

Managed databases

Managed databases and buckets (RDS, ElastiCache, S3, DigitalOcean) are optional when the template is used. Whoever uses it picks the account and the size, because they generate cloud costs. Without them, references to the database stay empty until you create one with the same internal name.

Click Save template to store it.

Create a project from the template

  1. Open Projects → Templates and click Use on the template.
  2. Fill in the Project name (e.g. Cliente X).
  3. Under Server, choose the project's server. All services go to it; you can change each service's server right below.
  4. Answer the questions: template variables, variables set to Ask and domains.
  5. If the template has managed databases, choose the cloud account and the size, or leave None.
  6. If you have Cloudflare connected, check Point the domains on Cloudflare (with proxy). Only domains with no record on Cloudflare are pointed; a domain that points somewhere else stays as is.
  7. Click Create and deploy, or Create only to deploy later.

New project form with the loja template
New project form with the loja template

With Create and deploy, the project screen shows the progress. Each service starts once the ones it uses (services and databases) are live. Managed databases take 5 to 20 minutes to be ready.

Export and import

In each template's menu:

  • Export JSON downloads the template to a file, to keep or to take to another team.
  • Delete removes the template. Projects created from it stay.

To bring in a template, click Import JSON in Projects → Templates.

Warning

The exported file has the fixed variable values (the ones set to Copy) in plain text. Store it carefully.

Permissions

  • Create, edit and delete templates lets you save, edit, import and export. Without it, the template screen is read-only and fixed values are hidden.
  • Using a template requires Create projects and Create services. To deploy, Deploy; to point DNS, Manage domains; to create managed databases, Create managed databases and caches.

See Teams, members and roles.