Skip to main content
A code template packages your source code and a manifest, vertracloud.template.yaml, that tells the platform what to ask, how much memory to reserve and how to start the app. In this tutorial you build a Discord bot template that asks one question (the bot token, a secret), runs with the minimum RAM and creates a working bot in a few clicks. It takes about 20 minutes and ends with the bot answering /ping. A code template does not use an image slot, because the platform builds your code the same way it builds any application. If you are not sure whether you need a code or an image template, read the overview for authors first.

Before you start

The Vertra CLI installed and signed in with an API key (vertra auth login) that has the templates:read, templates:write and templates:deploy scopes.
A plan that can create private templates (the same plans that can create Docker images, see Plans and limits). Each account can keep up to 5 private templates.
Node.js 22 or newer on your computer, only to generate the lock file.

Step by step

1

Create the folder and the bot code

A template folder holds the manifest at the root and the code of each code service in a subfolder. Create this layout:
src/package.json pins the library version so every copy of the template installs the same code:
src/package.json
src/index.js reads the token from the environment, registers a /ping command and exits with a clear message when the login fails, so a wrong token shows up in the log instead of a silent crash loop:
src/index.js
Generate the lock file without installing anything, so no node_modules folder ends up in the package:
2

Get a bot token to test with

In the Discord Developer Portal, create an application, open Bot and use Reset Token. Copy the token somewhere safe: you will type it when you use the template, never in a file. Then invite the bot to a test server (OAuth2, scopes bot and applications.commands).
3

Write the manifest

The manifest answers four questions: what is this template, what does the user fill in, what runs, and what may the user change afterwards. Create vertracloud.template.yaml:
vertracloud.template.yaml
What each part does:
Never write the token in env. A manifest that carries a literal value for a variable named like a secret (*_TOKEN, *_KEY, *_SECRET, PASSWORD) is refused with secret_in_manifest. Ask for it with a secret question, as above.
4

Validate the manifest

From the template folder, run:
The command checks the manifest against the platform’s rules without creating anything. It prints each finding with its file, line, manifest path and code, and exits with a failure status when there is at least one. Add --json to get { valid, file, issues: [{ path, code, message, line }] } for scripts. Fix every finding and run it again until it passes; the common ones are listed in Validate and test and in the error reference.
5

Create the private template

The CLI packs the src folder (.env* files, .git and symlinks are never sent) and creates a private template that only you, or your workspace, can see. It appears under Templates, tab My templates, with a counter such as “1 of 5 private templates”. The platform also scans the code for secrets before accepting it and, if it finds any, lists the files.
6

Use your own template

Open Templates, My templates, pick the template and choose Use. The wizard asks for the bot token, lets you set the app name and, if you want, a larger RAM. Or from the terminal:
The deploy runs as a job: it creates the app, injects the variable, starts it and waits for the healthcheck. If any step fails, everything it created is undone. At the end the wizard shows the outputs.
7

Check the bot

Open the app log. A healthy start prints Logged in as <bot name>. Slash command /ping registered. In your test server type /ping: the bot answers with the latency. If the log shows Login failed, the token is wrong or was reset.
8

Publish a new version

Change the code or the manifest, raise version (for example to 1.0.1) and run:
A version is immutable and must be higher than the previous one. Apps created from the template see “New version available” and update when their owner clicks, always with a safety snapshot first.

Troubleshooting

Next steps

Last modified on October 28, 2026