Overview
Plugins extend Dokrypt’s functionality with custom lifecycle hooks, CLI commands, and services. Plugins can be installed globally or per-project.Plugin Types
| Type | Description |
|---|---|
container | Runs as a Docker container alongside your services |
binary | Runs as a native binary on the host machine |
Installation
- Local:
./plugins/(project directory) - Global:
~/.dokrypt/plugins/
Plugin Manifest
Every plugin has aplugin.yaml manifest:
Lifecycle Hooks
Plugins can subscribe to these lifecycle events:| Hook | Triggered When | Use Cases |
|---|---|---|
on_init | Dokrypt initializes | Setup, configuration validation |
on_up | dokrypt up completes | Start monitoring, register listeners |
on_down | dokrypt down starts | Cleanup, save state |
on_transaction | A transaction executes | TX logging, gas tracking |
on_block_mined | A new block is mined | Block monitoring, indexing |
on_contract_deployed | Contract deployment detected | ABI registration, verification |
on_test_end | Test suite completes | Report generation, notifications |
Plugin Configuration
Configure plugins indokrypt.yaml:
Creating a Plugin
Scaffold
my-plugin
plugin.yaml
Dockerfile
README.md
Plugin Environment
Plugins receive an environment interface with:| Method | Description |
|---|---|
ProjectName() | Current project name |
ChainRPCURL(name) | RPC URL for a chain |
ServiceURL(name) | URL for a service |
Publishing
Managing Plugins
Hooks Configuration (dokrypt.yaml)
In addition to plugin hooks, you can define shell command hooks directly indokrypt.yaml:
| Hook | When |
|---|---|
pre_up | Before starting services |
post_up | After all services are healthy |
pre_down | Before stopping services |
post_down | After all services stopped |
post_snapshot | After a snapshot is saved |