Skip to content
You are reading the HappyView v2 docs, which are no longer updated. Read the v3 docs.

Developing Plugins

This guide covers how to build your own HappyView WASM plugins. For installing and configuring plugins, see the Plugins guide.

See the happyview-plugins repository for examples and the plugin SDK.

Each plugin has a manifest.json that describes its metadata:

{
"id": "steam",
"name": "Steam",
"version": "1.0.0",
"api_version": "1",
"description": "Import your Steam game library and playtime data.",
"icon_url": "https://example.com/steam-icon.png",
"auth_type": "openid",
"wasm_file": "steam.wasm",
"required_secrets": [
{
"key": "PLUGIN_STEAM_API_KEY",
"name": "Steam Web API Key",
"description": "Get your API key at steamcommunity.com/dev/apikey"
}
]
}
FieldDescription
idUnique plugin identifier
nameDisplay name
versionSemantic version
api_versionPlugin API version (currently “1”)
descriptionBrief description shown during install
icon_urlOptional icon URL
auth_typeAuthentication type: oauth2, openid, or api_key
wasm_fileWASM binary filename (default: plugin.wasm)
required_secretsArray of secrets the plugin needs
EndpointDescription
GET /external-auth/providersList available auth providers
GET /external-auth/accountsList user’s linked accounts
GET /external-auth/{plugin}/authorizeStart OAuth flow
GET /external-auth/{plugin}/callbackOAuth callback handler
POST /external-auth/{plugin}/syncSync data from linked account
POST /external-auth/{plugin}/unlinkUnlink account
POST /external-auth/{plugin}/connectConnect with API key (for api_key auth type)
EndpointDescription
GET /admin/pluginsList installed plugins
POST /admin/pluginsInstall a plugin
POST /admin/plugins/previewPreview plugin before installing
GET /admin/plugins/officialBrowse the official plugin registry catalog
DELETE /admin/plugins/{id}Remove a plugin
POST /admin/plugins/{id}/reloadReload plugin from source
POST /admin/plugins/{id}/check-updateCheck whether a newer version is available
GET /admin/plugins/{id}/secretsGet configured secrets (masked)
PUT /admin/plugins/{id}/secretsUpdate plugin secrets

The dashboard’s Settings > Plugins page calls GET /admin/plugins/official to populate the install browser, and POST /admin/plugins/{id}/check-update to display update badges on installed plugins.

Plugins must export these functions:

ExportSignatureDescription
alloc(size: u32) -> u32Allocate memory
dealloc(ptr: u32, size: u32)Deallocate memory
get_authorize_url(ptr: u32, len: u32) -> i64Generate OAuth authorize URL
handle_callback(ptr: u32, len: u32) -> i64Handle OAuth callback
refresh_tokens(ptr: u32, len: u32) -> i64Refresh expired tokens
get_profile(ptr: u32, len: u32) -> i64Get external profile info
sync_account(ptr: u32, len: u32) -> i64Sync data and return records

Plugins can import these host functions:

ImportDescription
host_http_requestMake HTTP requests
host_get_secretRead configured secrets
host_logWrite to server logs
host_kv_getRead from KV storage
host_kv_setWrite to KV storage
host_kv_deleteDelete from KV storage