Skip to content

About

Public ABI for bext plugin authors — mirror of crates/bext-plugin-api in the private monorepo

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

7 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

bext-plugin-api

Public ABI for bext plugin authors. This is the single crate you need to depend on if you want to write a plugin for bext.

[dependencies]
bext-plugin-api = "0.2"

What this crate is

bext-plugin-api defines the trait hierarchy and shared types that every bext plugin implements. It has near-zero dependencies (just serde) so that plugin authors can pull it into any Rust project without dragging in the rest of the bext runtime.

The crate is the stable contract between the bext core engine and third-party extensions. The rest of the bext codebase will break you on a major version bump; this crate will not.

Plugin kinds

The crate exposes trait definitions for the following plugin kinds. Each plugin kind has its own module and its own lifecycle hooks.

Module Trait Purpose
auth AuthPlugin JWT, cookie, or custom authentication
session SessionStore Session persistence (cookie, redis, custom)
mailer Mailer Transactional email sending (SMTP, SES, etc.)
scheduled ScheduledTask Cron-like scheduled background jobs
tracer Tracer Structured tracing (stdout, OTLP, custom)
(core) Plugin Generic request/response middleware

Example

use bext_plugin_api::{Plugin, Request, Response};

pub struct HelloPlugin;

impl Plugin for HelloPlugin {
    fn on_request(&self, req: &Request) -> Option<Response> {
        if req.path() == "/hello" {
            Some(Response::text(200, "Hello from a bext plugin"))
        } else {
            None
        }
    }
}

Plugins are loaded by the bext runtime through one of the host crates:

Reference implementations

The bext-impls sub-workspace ships reference plugins you can use as starting points — JWT auth, cookie/Redis sessions, SMTP/SES mailers, stdout/OTLP tracers, and a cron scheduler. Each is a complete working plugin against this ABI, under ~500 lines of Rust.

License

MIT. This crate must stay MIT so plugin authors can link it freely into projects of any license.

Stability

Pre-1.0, the ABI is evolving. Minor version bumps (0.2 → 0.3) may include breaking changes to trait signatures. Patch bumps (0.2.0 → 0.2.1) are additive only. Once the crate reaches 1.0 it will follow strict semver for the public ABI.

About

Public ABI for bext plugin authors — mirror of crates/bext-plugin-api in the private monorepo

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages