SystemPrompt consists of 33 crates organized into five layers. This reference documents each crate's purpose, API, and usage.

Layer Overview

Layer Crates Purpose
Shared 7 Pure types, no dependencies
Infrastructure 7 Foundational services
Domain 9 Business logic
Application 4 Orchestration
Entry 2 Binary entry points
Facade 1 Public API

Quick Reference

Shared Layer (7 crates)

Crate Description
systemprompt-models Domain models, DTOs, validation
systemprompt-traits Core trait definitions
systemprompt-identifiers Typed IDs
systemprompt-extension Extension framework
systemprompt-provider-contracts Provider traits
systemprompt-client HTTP client
systemprompt-template-provider Template abstractions

Infrastructure Layer (7 crates)

Crate Description
systemprompt-database PostgreSQL/SQLx abstraction
systemprompt-logging Structured logging
systemprompt-config Configuration management
systemprompt-events Event bus, SSE
systemprompt-security JWT, authentication
systemprompt-cloud Cloud API client
systemprompt-loader File/module discovery

Domain Layer (9 crates)

Crate Description
systemprompt-users User management
systemprompt-oauth OAuth2/OIDC
systemprompt-files File storage
systemprompt-analytics Metrics, reporting
systemprompt-content Content management
systemprompt-mcp MCP server registry
systemprompt-ai LLM integration
systemprompt-agent A2A protocol
systemprompt-templates Template registry

Application Layer (4 crates)

Crate Description
systemprompt-runtime AppContext, lifecycle
systemprompt-scheduler Job scheduling
systemprompt-generator Static site generation
systemprompt-sync Cloud synchronization

Entry Layer (2 crates)

Crate Description
systemprompt-api HTTP server
systemprompt-cli CLI application

Facade (1 crate)

Crate Description
systemprompt Public API re-exports

Using the Crates

As a Library

Add the facade crate to your Cargo.toml:

[dependencies]
systemprompt = { version = "0.0.14", features = ["full"] }

Feature Flags

Feature Includes
core traits, models, identifiers, extension (default)
database database abstraction
api HTTP server (requires core + database)
cli CLI entry point
mcp Model Context Protocol
sync Cloud synchronization
cloud Cloud infrastructure
full All functionality

Individual Crates

For fine-grained control, depend on specific crates:

[dependencies]
systemprompt-models = "0.0.14"
systemprompt-database = "0.0.14"
systemprompt-extension = "0.0.14"