Skip to content
Public template

About

Native Temps plugins in TypeScript with tag-based npm publication

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Temps TypeScript plugin template

A Temps plugin is an ordinary Temps service: it runs from a container image, and an administrator adds that service as a plugin. Adding a plugin does not restart Temps. This template is a working plugin with a sidebar page, the Dockerfile it runs from and a workflow that publishes its image.

It needs a Temps release in which plugins run as services (after v0.1.0-beta.65). The commands below use the Temps CLI as temps; bunx --bun @temps-sdk/cli runs the same CLI without installing it.

1. Write the plugin

Use Use this template on GitHub to create your own repository, and install Bun 1.4.2.

Rename the identity in package.json: name, author, repository (the GitHub address of your repository), description, and temps.name and temps.title. A release from a copy of the template is refused until you do. Then write the plugin: src/index.ts holds the manifest, navigation and routes, and src/page.ts the sidebar page. The example serves its page at /ui/ and JSON at /.

bun install
bun test
bun run check

Run it locally in the plugin simulator, which serves a preview of the plugin as Temps would show it:

bunx --bun @temps-sdk/cli plugin dev --exec bun -- run src/index.ts

Try it on a Temps instance. This builds the Dockerfile here, uploads the image and adds the plugin; no registry is needed:

temps plugin add --build

Commit bun.lock with the source; the image is installed from the lockfile. Review dependencies and build scripts before you build or run any plugin: building source executes code from that repository.

What the plugin receives

The plugin needs no configuration to be reachable. Started without arguments, as its container starts it, the SDK reads what every Temps deployment receives:

Variable Use Default
PORT the port to listen on 8080
TEMPS_PLUGIN_SECRET the secret Temps gave this deployment, and presents to it required
TEMPS_PLUGIN_DATA_DIR where the plugin keeps its files; mount the service's volume there /data

Temps presents the deployment's secret in the x-temps-auth-signature header of every request. Only the health route answers a caller without it. src/service.test.ts starts the plugin this way and checks both.

A newly added plugin has no permissions. An administrator grants what it asks for, and approves each new build before it runs as the plugin. The plugin then appears in the platform sidebar; open it to see its page.

2. Publish the image

Set version in package.json, commit, and push a tag v followed by that version:

git tag v1.0.0
git push origin v1.0.0

The Publish image workflow checks that the tag matches package.json (and, in a copy of the template, that the identity is renamed and repository names this repository), then builds the Dockerfile for linux/amd64 and linux/arm64 and pushes it to the GitHub Container Registry of this repository.

A new package on ghcr.io starts private. Make it public once, in the package's settings under Change visibility, before other Temps instances can pull it.

3. Share it

The workflow's run summary prints the line to share:

temps plugin add --image ghcr.io/your-org/your-plugin@sha256:<digest>

It adds exactly the image that was built, named by its digest. In the console, Settings > Plugins > Add plugin takes the same image.

To update a plugin an instance already has, run the same command with --project <service> and the new image. The new build waits for an administrator's approval; until then the approved build keeps running as the plugin.

4. List it in the catalogue (optional)

A listed plugin shows a one-step Add in Settings > Plugins. Open a pull request to gotempsh/plugins that adds registry/<plugin-name>.json with repo (your repository), categories, and the image and commit the workflow's summary printed. The format is described in the catalogue's registry/README.md.

A new version is another pull request there that changes image and commit.

Screenshots

The catalogue previews come from temps.screenshots in package.json. Replace the light and dark PNGs in assets/ with screenshots of your own plugin, and update each repository-relative path, descriptive alt, and optional caption. Capture only the plugin UI: never include credentials, account details, or private project data. The catalogue reads these paths at the commit the listing names, so new screenshots appear with the next listing update.

Workflows

The Test plugin workflow runs the tests, the type check and a build of the image for every commit and pull request. The Publish image workflow runs only for a version tag. Neither needs a secret beyond the repository's own GITHUB_TOKEN.

About

Native Temps plugins in TypeScript with tag-based npm publication

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages