Skip to Content
ArchitectureInfrastructure Providers

Provider Abstraction Layer (PAL)

Nanokit is designed to be infrastructure-agnostic. This is achieved through the Provider Abstraction Layer, a standardized interface that decouples the Core Engine from the specific details of cloud vendors or local runtimes.

The Provider Interface

Every infrastructure target (Docker, AWS, GCP, Azure) is implemented as a Provider. The Core Engine interacts with these providers using a unified set of methods defined in @nkapp/plugin-api.

Core Responsibilities

A Provider is responsible for:

  • Resource Discovery: Finding existing resources on the target platform.
  • Service Orchestration: Creating, starting, stopping, and deleting instances.
  • Health Monitoring: Verifying if a resource is ready to receive traffic.
  • Gateway Management: Configuring load balancers or entry points (e.g., Caddy, AWS ALB).

How it Works

When you run a command like nkapp up, Nanokit looks at the infra.provider field in your configuration:

infra: provider: aws # Nanokit loads the AWS Provider plugin

The Core Engine then delegates all platform-specific operations to that plugin. This ensures that the same nanokit.yml can be used to deploy to a local Docker environment during development and to AWS during production.

Supported Providers

Nanokit includes first-party support for:

ProviderTargetUse Case
DockerLocal Machine / VPSLocal development and simple server deployments.
AWSAmazon Web ServicesEnterprise-grade scaling using ECS, Fargate, and RDS.
GCPGoogle Cloud PlatformManaged services using Cloud Run and GKE.

Extensibility: The PAL is plugin-based. Developers can write custom providers to support proprietary clouds or specialized hardware by implementing the @nkapp/plugin-api/Provider interface.

Transparent Metadata

Providers automatically inject platform-specific metadata into your services (e.g., Instance IDs, Private IPs, Cluster names) using the NANOKIT_ environment variable prefix. This allows your application to be “Cloud Aware” without being “Cloud Dependent”.