Skip to Content
ArchitectureCore Engine

Core Engine Architecture

Nanokit is built on a deterministic reconciliation engine that bridges the gap between high-level configuration and low-level infrastructure execution.

The v2.0 Modular Pipeline

In version 2.0, the Nanokit Reconciler is decomposed into four specialized engines that work together to ensure stability, performance, and visibility.

1. Ingestion & Merging

The configuration parser loads nanokit.yml, resolves environment variables, and deeply merges environment-specific overrides into a single, unified configuration object.

2. Dependency Resolution (GraphEngine)

The GraphEngine analyzes service dependencies (depends_on) and constructs a Directed Acyclic Graph (DAG). This ensures that services boot in the correct order (e.g., Database before API) and prevents circular dependencies.

3. Delta Calculation (PlanEngine)

The PlanEngine compares the Desired State (from your config) with the Live State (observed from the cloud/Docker). It calculates exactly what needs to be created, updated, or destroyed.

4. Concurrent Execution (ExecutionEngine)

The ExecutionEngine processes the deployment plan in parallel layers based on the DAG. It manages lifecycle hooks (prestart, poststart) and ensures every resource is healthy before progressing to the next layer.

Key Components

State Storage & Synchronization

Nanokit maintains a state.json file that acts as the “source of truth” for what is currently deployed. In team environments, this state is synchronized with remote backends like S3 or HashiCorp Vault to prevent deployment conflicts.

Drift Detection

The Core Engine periodically performs “Drift Checks.” If a resource is manually deleted or modified outside of Nanokit, the engine detects the discrepancy and offers to restore the infrastructure to its configured state.

This modular approach allows Nanokit to support multiple runtimes (Docker, Kubernetes, Firecracker) using the same core logic.

Distributed Tracing (OTel)

The engine is natively instrumented with OpenTelemetry. Every reconciliation loop generates traces that allow you to visualize the deployment timeline, identify slow hooks, and debug orchestration issues directly from the Nanokit Hub.