Config-as-code templates for AI governance you own
Website · Documentation · Guides · Core · Template · Discord
systemprompt-template-provider
Your templates are config, versioned in your own repository, not entries in someone else's dashboard. This crate defines the traits that load them. Templates compile into the binary or resolve from the filesystem at runtime, and every provider passes through one typed contract.
Layer: Shared. Foundational types and traits with no dependencies on other layers. Part of the systemprompt-core workspace.
Overview
The rendering pipeline talks to templates through traits, never through a concrete registry. An embedded loader serves compile-time templates. A filesystem loader discovers them at runtime, sandboxed to a base path. Provider contracts for template, component, and page data are re-exported so downstream crates depend on one surface.
Architecture
| Type | Description |
|---|---|
TemplateProvider |
Top-level provider trait for the rendering pipeline |
TemplateLoader |
Trait for loading templates by name |
TemplateDataExtender |
Trait for augmenting template render context |
ComponentRenderer |
Trait for rendering reusable components |
PageDataProvider |
Trait for supplying page-level data |
PagePrerenderer |
Trait for static page prerendering (re-exported from systemprompt-provider-contracts) |
EmbeddedLoader |
Unit struct loader for compile-time embedded templates |
FileSystemLoader |
Async tokio::fs-backed loader with base-path sandboxing (requires tokio feature) |
TemplateLoaderError / TemplateLoaderResult |
Error type and result alias for loader operations |
DynTemplateProvider |
Arc<dyn TemplateProvider> type alias |
DynTemplateLoader |
Arc<dyn TemplateLoader> type alias |
DynTemplateDataExtender |
Arc<dyn TemplateDataExtender> type alias |
DynComponentRenderer |
Arc<dyn ComponentRenderer> type alias |
DynPageDataProvider |
Arc<dyn PageDataProvider> type alias |
DynPagePrerenderer |
Arc<dyn PagePrerenderer> type alias |
Usage
[]
= "0.32"
use ;
use async_trait;
let loader: DynTemplateLoader = new;
use Arc;
use ;
Feature Flags
| Feature | Default | Description |
|---|---|---|
tokio |
No | Enables FileSystemLoader for async file-based template loading |
Dependencies
Internal
| Crate | Purpose |
|---|---|
systemprompt-provider-contracts |
Provider trait definitions |
External
| Crate | Purpose |
|---|---|
async-trait |
Async trait support |
thiserror |
Derive macros for loader error types |
tokio |
Async filesystem operations (optional, fs + sync) |
License
BSL-1.1 (Business Source License). Source-available for evaluation, testing, and non-production use. Production use requires a commercial license. Each version converts to Apache 2.0 four years after publication. See LICENSE.
systemprompt.io · Documentation · Guides · Live Demo · Template · crates.io · docs.rs · Discord
Shared layer · Own how your organization governs AI.