Skip to content

Commit b9be33a

Browse files
committed
chore: explain how to include the template in the standard deployment
1 parent 27b2eba commit b9be33a

1 file changed

Lines changed: 40 additions & 14 deletions

File tree

pages/templates/building-a-template.mdx

Lines changed: 40 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -163,32 +163,58 @@ public layoutMetadata = {
163163

164164
## Registering a Custom Template
165165

166-
### In the standard UI build
166+
### Via additional-templates.json
167167

168-
Add the template path to your `.env`:
168+
Templates are registered in `additional-templates.json` in the `uverify-ui` project root. This file is read at build time by `config.js` and supports two entry types.
169169

170-
```env
171-
VITE_ADDITIONAL_TEMPLATES="MyTemplate:../my-template/src/Certificate.tsx"
170+
**Local file** — a template located relative to the `uverify-ui` directory, useful during development:
171+
172+
```json
173+
[
174+
{
175+
"type": "file",
176+
"name": "MyTemplate",
177+
"path": "../my-template/src/Certificate.tsx"
178+
}
179+
]
172180
```
173181

174-
Multiple templates:
182+
**External repository** — a template fetched from a Git repository at a pinned commit (cloned into `.template-cache/` during the build):
175183

176-
```env
177-
VITE_ADDITIONAL_TEMPLATES="TemplateA:../path/a/Certificate.tsx,TemplateB:../path/b/Certificate.tsx"
184+
```json
185+
[
186+
{
187+
"type": "repository",
188+
"name": "MyTemplate",
189+
"url": "https://github.com/some-org/my-template",
190+
"commit": "a3f1c2d4e5b6...",
191+
"path": "src/Certificate.tsx"
192+
}
193+
]
178194
```
179195

180-
Then rebuild the UI. The template will be available under the `id` you choose (the template ID used in `uverify_template_id` metadata is the key in this variable, lowercased).
196+
<Callout type="info">
197+
The `commit` field pins the exact revision used in the build. This makes external templates fully auditable and prevents unexpected upstream changes from affecting your deployment. To update a template, change the `commit` hash and rebuild.
198+
</Callout>
199+
200+
After editing `additional-templates.json`, run `node config.js` to regenerate the template registry and then start or rebuild the UI.
201+
202+
### Publishing to app.uverify.io
203+
204+
To have your template included in the standard deployment at [app.uverify.io](https://app.uverify.io), open a pull request against the [`uverify-ui`](https://github.com/UVerify-io/uverify-ui) repository adding a `repository` entry for your template. All proposed templates are reviewed for security issues before being merged.
205+
206+
Use the **Add External Template** issue template in `uverify-ui` to start the conversation before opening a PR.
181207

182-
### With Docker (custom image)
208+
### With Docker (self-hosted)
183209

184-
Use the custom Docker image that builds at container start, and mount your template directory:
210+
For self-hosted deployments, use the custom Docker image that builds at container start and mount your template directory:
185211

186212
```bash
187213
docker run \
188214
-e VITE_BACKEND_URL=https://api.uverify.io \
189215
-e VITE_CARDANO_NETWORK=mainnet \
190-
-e VITE_ADDITIONAL_TEMPLATES="MyTemplate:/templates/my-template/src/Certificate.tsx" \
191-
-v /path/to/my-template:/templates/my-template \
216+
-v /path/to/additional-templates.json:/app/additional-templates.json \
217+
-v /path/to/my-template:/app/.template-cache/my-template \
192218
-p 3000:80 \
193219
uverify/uverify-ui:custom
194220
```
@@ -199,11 +225,11 @@ docker run \
199225

200226
## Activating Your Template
201227

202-
Set `uverify_template_id` in your certificate metadata to the template ID (the key from `VITE_ADDITIONAL_TEMPLATES`) when notarizing:
228+
Set `uverify_template_id` in your certificate metadata to the template name (first character lowercased) when notarizing:
203229

204230
```json
205231
{
206-
"uverify_template_id": "MyTemplate",
232+
"uverify_template_id": "myTemplate",
207233
"title": "Certificate of Completion",
208234
"recipient": "Jane Doe"
209235
}

0 commit comments

Comments
 (0)