Architecture

ContractSpec's architecture is built on a foundation of typed specifications served by runtime adapters. This section covers the core architectural concepts: app configuration, integration binding, and knowledge management.

Core layers

1. Specification Layer

The foundation of ContractSpec. Typed specifications define what your application can do:

2. Configuration Layer

How applications are configured and customized:

3. Runtime Layer

How specifications are executed at runtime:

  • ResolvedAppConfig - Merged blueprint + tenant config
  • Policy Decision Point (PDP) - Enforces policies on every operation
  • Presentation Runtime - React and React Native renderers
  • Integration Connectors - Execute external API calls
  • Knowledge Retrieval - Query vector databases and knowledge sources

Configuration model

ContractSpec uses a three-tier configuration model:

LayerTypeScopeStorage
BlueprintAppBlueprintSpecGlobal, versioned, no tenant infoVersion control, immutable
Tenant ConfigTenantAppConfigPer-tenant, per-environmentDatabase, mutable
Resolved ConfigResolvedAppConfigRuntime, ephemeralIn-memory, not persisted

Key architectural principles

  • Spec-first - Everything is defined declaratively before code generation
  • Type-safe - All specifications are strongly typed and validated at compile time
  • Policy-enforced - Every operation passes through the PDP
  • Multi-tenant by default - Tenant isolation is built-in, not bolted on
  • Environment-aware - Separate configurations for sandbox, staging, production
  • Auditable - All operations are logged for compliance and debugging