Smart Application Framework (SAF)
SAF is an open-source, cross-platform framework for building distributed applications across cloud and edge. It lets you compose applications from independently deployable plug-ins that communicate exclusively through a shared messaging infrastructure — keeping plug-ins loosely coupled and independently replaceable.
What SAF Does
SAF builds on top of .NET’s Microsoft.Extensions.Hosting and adds:
| Layer | What it provides |
|---|---|
| Plugin System | Assembly-isolated plug-in loading, independent DI containers per plug-in, typed cross-plug-in service resolution, in-process reload on configuration changes |
| SAF Host | Opinionated host wiring: service host identity, plug-in folder discovery, optional diagnostics |
| Messaging Infrastructure | Exchangeable pub/sub broker (In-Process, Redis, NATS, C-DEngine, or Routing) |
| Storage Infrastructure | Exchangeable key/value store (LiteDB, SQLite, Redis, C-DEngine) |
| Secret Store | Keep credentials out of configuration files, in an OS-level store (Windows Credential Manager or a cross-platform encrypted file store) |
| Toolbox Services | Ready-made helpers: Heartbeat, Request/Reply client, File Transfer |
Core Design Principles
- Plug-in isolation — each plug-in gets its own DI container. Private services are invisible to other plug-ins.
- Communication through messaging — plug-ins never call each other directly; they publish and subscribe to topics.
- Exchangeable infrastructure — swap the message broker or storage backend without touching plug-in code.
- SAF-agnostic plugin system — the plugin loading mechanism (
SAF.PluginSystem.*) has no SAF-specific dependencies and can be used independently.
Architecture Overview
graph TB
subgraph Host Process
H[".NET Generic Host"] --> SAF[SAF Host]
SAF --> PS[Plugin System]
PS --> |"loads & isolates"| PA["Plugin A\n(own DI container)"]
PS --> |"loads & isolates"| PB["Plugin B\n(own DI container)"]
subgraph "Shared Infrastructure (injected into every plugin)"
MSG[IMessagingInfrastructure]
STO[IStorageInfrastructure]
SEC[ISecretStore]
end
PA --- MSG
PA --- STO
PA --- SEC
PB --- MSG
PB --- STO
PB --- SEC
end
PA -->|"publish(topic, payload)"| MSG
MSG -->|"subscribe(topic)"| PB
Package Overview
| Package | Purpose |
|---|---|
SAF.Common |
Core interfaces: IStorageInfrastructure, IServiceHostInfo |
SAF.Messaging.Contracts |
Core interfaces: IMessagingInfrastructure, IMessageHandler, Message |
SAF.Messaging.Runtime |
Runtime wiring: resolves the primary IMessagingInfrastructure plug-in |
SAF.Messaging.InProcess |
In-memory messaging (development / tests) |
SAF.Messaging.Redis |
Redis-backed messaging and storage |
SAF.Messaging.NATS |
NATS-backed messaging and storage |
SAF.Messaging.Cde |
C-DEngine-backed messaging |
SAF.Messaging.Routing |
Fan-out / routing across multiple brokers |
SAF.Storage.LiteDb |
LiteDB-backed key/value storage |
SAF.Storage.SQLite |
SQLite-backed key/value storage |
SAF.Configuration.Secrets.Contracts |
Secret store contracts: ISecretStore, SecretStoreOptions, SecretReference |
SAF.Configuration.Secrets |
Secret store providers (Windows Credential Manager, cross-platform file store), the default PkcsSecretProtector, and provider selection |
SAF.Configuration.Secrets.Extensions |
Secret store host-builder integration (AddSecretStore, AddSecretConfigurationResolution) |
SAF.PluginSystem.Hosting |
Plugin loading engine |
SAF.PluginSystem.Hosting.Contracts |
Plugin contracts: IPluginManifest, IServicePlugin, IPluginAssemblyValidator, validation context/result |
SAF.PluginSystem.Hosting.Extensions |
Plugin-system convenience extensions and built-in assembly validators |
SAF.Hosting |
SAF-specific host wiring on top of the plugin system |
SAF.Toolbox |
Heartbeat, RequestClient, FileTransfer helpers |
Documentation
- Getting Started — create your first SAF application end-to-end
- SAF Host — initialise and configure the host
- Plugin System — deep-dive into the plugin loading engine (SAF-independent)
- Plugin Deployment Security — installer and filesystem requirements for in-process plugins
- Messaging Infrastructure — pub/sub how-tos and all implementations
- Storage Infrastructure — key/value store how-tos and all implementations
- Secret Store — keep credentials out of configuration files, in an OS-level store
- Toolbox Services — Heartbeat, Request/Reply, File Transfer
- Migration Guide: 10.x → 11.x — breaking changes and upgrade steps