Blueprints Reference
Reference for the Blueprint fields accepted by MicroStax validation: services, routing, snapshots, secrets, volumes, probes, and mocks.
Blueprints are the "brain" of your MicroStax environments. They define what runs, how services talk to each other, and how your data is initialized. Think of it as a super-charged docker-compose.yml for Kubernetes.
Minimal Example
name: payments-dev
description: Payments API with Postgres
services:
- name: api
image: ghcr.io/example/payments-api:latest
ports:
- containerPort: 8080
expose: true
dependsOn: [db]
env:
DATABASE_URL: postgres://postgres:devpass@db:5432/payments
- name: db
image: postgres:16-alpine
ports:
- containerPort: 5432
secrets:
- name: db-password
envKey: POSTGRES_PASSWORD
value: auto-generated
volumes:
- name: db-data
mountPath: /var/lib/postgresql/data
type: pvc
size: 5Gi
Top-Level Fields
| Field | Type | Required | Notes |
|---|---|---|---|
name | string | Yes | Environment name. |
description | string | No | Human-readable context. |
services | ServiceSpec[] | Yes | One or more services. |
plans | object | No | Named deployment plans with per-service overrides. |
routing | RoutingSpec | No | Environment mode and overlay controls. |
autoShutdownEnabled | boolean | No | false ignores autoShutdownDelayMinutes. |
autoShutdownDelayMinutes | number | No | Idle minutes before stop (max 1440). See below. |
Deployment Plans
Use plans for named profiles such as production when a service needs
different replicas or resource limits outside the base development Blueprint.
plans:
production:
services:
db:
replicas: 3
resources:
memory: 512Mi
cpu: 500m
Service Fields
| Field | Type | Required | Notes |
|---|---|---|---|
name | string | Yes | DNS-safe service name. |
image | string | Yes | OCI image reference. |
ports | PortSpec[] | No | Container ports. |
env | Record<string,string> | No | Runtime environment variables. |
resources | ResourceSpec | No | CPU and memory requests and limits. |
expose | boolean | No | Creates ingress when true. |
dependsOn | string[] | No | Declares dependency order. |
command | string[] | No | Overrides container command. |
args | string[] | No | Overrides container args. |
entrypoint | string[] | No | Overrides entrypoint. |
replicas | number | No | Horizontal scaling count. |
volumes | VolumeSpec[] | No | PVC or emptyDir mounts. |
secrets | SecretSpec[] | No | Managed secret injection. |
labels | Record<string,string> | No | Service-level Kubernetes labels. |
annotations | Record<string,string> | No | Service-level annotations. |
init | InitSpec | No | One-time initialization job. |
snapshot | SnapshotSpec | No | Snapshot restore configuration. |
mock | MockSpec | No | Stub or mirrored behavior. |
livenessProbe | ProbeSpec | No | Liveness health check. |
readinessProbe | ProbeSpec | No | Readiness health check. |
startupProbe | StartupProbeSpec | No | Startup health check. |
imagePullSecrets | {name:string}[] | No | Private registry auth. |
Service hostnames
Services in an environment reach each other by their blueprint name: a service named db listening on 5432 is reachable from its siblings at db:5432 (for example postgres://user:pass@db:5432/app). The longer prefixed name MicroStax also creates (msx-<env>-<id>-db) keeps working. A service name must be lowercase alphanumerics and hyphens, start with a letter and end with an alphanumeric (at most 63 characters); otel-collector and mock-redis are reserved for platform services. Blueprints with an invalid or reserved service name are refused with a VALIDATION_ERROR that points at the offending name.
Routing Modes
Routing controls how MicroStax provisions and resolves services.
| Mode | Use when | Behavior |
|---|---|---|
isolated | You need a fully independent environment. | All services are provisioned locally. |
baseline | You want a shared provider environment. | Full environment intended to back overlays. |
overlay | You want a sparse feature environment. | Changed services run locally; unchanged services bridge to the baseline/provider. |
routing:
mode: overlay
baselineId: <baseline-env-uuid>
overlayId: feat-checkout-refactor
headerName: x-msx-env
propagateHeader: true
ttlHours: 24
Field notes:
baselineIdidentifies the baseline environment for overlay routing.overlayIdbecomes the request routing value.headerNamedefaults tox-msx-env.propagateHeadercontrols downstream header propagation.ttlHourssets overlay expiry.
Resources
resources:
memory: 256Mi
cpu: 200m
memoryLimit: 512Mi
cpuLimit: 800m
memoryandcpuare requests.memoryLimitandcpuLimitcap usage.- If limits are omitted, MicroStax derives them from requests.
Secrets
secrets:
- name: stripe-secret
envKey: STRIPE_SECRET_KEY
value: auto-generated
length: 48
Use secrets for credentials that should not be committed into plain environment variables.
Volumes
volumes:
- name: cache-data
mountPath: /data
type: pvc
size: 10Gi
storageClass: standard-rwo
Supported volume types:
pvcfor persistent stateemptyDirfor ephemeral scratch storage
Stop, Resume, and Auto-Shutdown
microstax env stop (and auto-shutdown) scales every service to zero
replicas. The namespace, secrets, config, and endpoints stay in place, and
microstax env resume scales the services back up.
Only pvc volumes survive a stop. Resuming starts new pods, so anything a
service wrote to its container filesystem or to an emptyDir volume is gone.
A Postgres, MySQL, MongoDB, Redis, or LocalStack service without a pvc volume
comes back empty; re-run its seeds after a resume. microstax env validate
flags those stateful services (lint L015). microstax env get,
microstax env stop, and the MCP env_get, env_stop, and env_resume tools
list every service without a pvc volume, and env_get shows which
auto-shutdown rule applies to the environment.
Resume brings each service back to the replica count recorded for it; a service scaled to 0 stays at 0.
Persistent volumes
For each pvc volume the platform creates a PersistentVolumeClaim named
<namespace>-<service>-<volume> before the service's Deployment:
- Node-local development storage. The claim is ReadWriteOnce, requests the
volume's
size(default1Gi), and uses the cluster's default StorageClass unless the volume setsstorageClass. It is not replicated or backed up. - One replica. A service with a
pvcvolume must run a single replica and is rolled out with theRecreatestrategy. The API refuses a create,PATCH, import, overlay, or scale request that asks for more replicas withVALIDATION_ERROR, andmicrostax env validateand the MCPblueprint_validatetool report it as lintL016. Autoscaling never scales such a service past one replica. - Kept across stop, hibernate, and resume; deleted with the environment. The claim lives in the environment's namespace and goes when it is deleted.
- Fixed once created. Changing
sizeorstorageClasslater does not resize or move an existing claim; delete and recreate the environment. Adding apvcvolume to a service that is already running takes effect when the environment is re-provisioned. - Counted against your plan. The summed
pvcsizes per environment are limited to 5 GiB on Free, 20 GiB on Pro, 100 GiB on Team, and unlimited on Enterprise. A blueprint over the limit is refused withPLAN_LIMIT_EXCEEDEDbefore anything is created.
When auto-shutdown stops an environment
A running environment is stopped once it has been idle longer than the first limit that applies:
- The delay set on the environment with
microstax env setor the MCPenv_updatetool (30–1440 minutes), if auto-shutdown is enabled there. - The blueprint's
autoShutdownDelayMinutes(capped at 1440), unless the blueprint setsautoShutdownEnabled: false. - The platform idle timeout (240 minutes by default).
autoShutdownEnabled: false does not exempt an environment from the platform
idle timeout.
Idle time counts from the last MicroStax API request for that environment,
including CLI, MCP, and dashboard calls. Requests to the environment's own
endpoints do not count as activity. The stop reason recorded on the
environment names the limit that applied, for example
Idle for 1441m, beyond the blueprint autoShutdownDelayMinutes (1440m).
Init Data
Use init when you want a one-off script executed during provisioning.
init:
script: ./seed/schema.sql
mountPath: /seed
timeout: 120
type: sql
Use init for environment-local bootstrap that should be part of the validated
Blueprint contract.
Snapshots
Use snapshot to restore sanitized production-like data at provision time.
snapshot:
engine: postgres
database: payments
sourceSecretRef:
name: prod-payments-url
key: DATABASE_URL
namespace: platform
storage:
provider: gcs
bucket: microstax-snapshots
region: us-central1
excludeTables:
- audit_logs
sanitization:
- field: users.email
strategy: fake
- field: users.ssn
strategy: redact
schedule: '0 */6 * * *'
maxAgeHours: 12
Snapshot behavior:
- supported engines:
postgres,mysql - supported storage providers:
gcs,s3,local - supports inclusion/exclusion filters and sanitization rules
- cached artifacts may be reused until
maxAgeHoursexpires
Mocking And Shadow Validation
Mocks can fully replace a dependency, run as a sidecar, or receive mirrored traffic.
mock:
enabled: true
mode: ai-stateful
openapi: ./specs/payments-openapi.yaml
deployment:
mode: mirror
istio:
mirrorPercent: 25
validation:
mode: warn
coercion: true
Important distinctions:
modecontrols mock behavior:staticorai-statefuldeployment.modecontrols runtime placement:replace,sidecar, ormirrormirroris intended for traffic shadowing and behavioral diffing
Probes
readinessProbe:
path: /ready
port: 8080
Use:
startupProbefor slow bootsreadinessProbefor routing eligibilitylivenessProbefor restart detection
Example: Baseline Blueprint
name: storefront-base
routing:
mode: baseline
services:
- name: web
image: ghcr.io/example/storefront-web:stable
ports:
- containerPort: 3000
expose: true
- name: catalog
image: ghcr.io/example/catalog-api:stable
ports:
- containerPort: 8080
Example: Overlay Blueprint
name: storefront-checkout
routing:
mode: overlay
baselineId: <baseline-env-uuid>
overlayId: feat-checkout
ttlHours: 8
services:
- name: checkout
image: ghcr.io/example/checkout-api:feat-checkout
ports:
- containerPort: 8080
Admission Sanitizer
MicroStax runs every blueprint you submit through an admission-time sanitizer before the orchestrator touches Kubernetes. The goal is simple: your blueprint should just work on the cluster we're targeting, even if the blueprint was authored somewhere else. The sanitizer applies seven passes and records every change on the environment record so you can review exactly what it did.
The seven passes
- image — Resolves every
image:against the configured registry. If an image can't be pulled, the sanitizer substitutes the platform stub-proxy image and tags the service withmicrostax.io/sanitizer-substituted-image. Your env still boots. - node-selector — Reads
microstax.io/node-selectorand drops anykey=valuepair that no node in the cluster actually has. If nothing matches, the selector is removed entirely — otherwise the pod would be Pending forever. - secret-fallback — If a service requires a paid credential (e.g.
LOCALSTACK_AUTH_TOKEN) and no matching secret is bound, the sanitizer substitutes a compatible OSS/mock variant. LocalStack Pro → LocalStack community is the canonical example. - probe — Services with
portsbut noreadinessProbeget a TCP probe on the first port. Stops the orchestrator from flipping a still-starting pod toerror. - limits — Missing
resources.cpu/memoryrequests and limits are filled with platform defaults (100m/128Mirequests,500m/512Milimits). Keeps the scheduler's behavior predictable across clusters. - pin — Mutable tags (
:latest,:main,:dev, or no tag) are resolved to an immutable@sha256:...digest, so a redeploy two months from now lands on the same bytes you tested today. If the registry can't return a digest the service is annotated withmicrostax.io/sanitizer-mutable-tagand the env still provisions — unless you run the API withMICROSTAX_PIN_DIGESTS=strict, in which case the blueprint is refused with anUNRESOLVED_DIGESTrejection instead. - context-agent — Opts services into the mesh-free overlay
context-agent sidecar only when the image is actually published for
the current platform version. Otherwise the annotation is set to
falseso the pod can reach Ready.
Where to see the fixes
Every rewrite is attached to the environment record as autoFixes[]. Open
the environment in the dashboard and look for the "Platform auto-fixed N
issues in your blueprint" panel above the tabs. Each row explains what
changed and why.
Strict mode
If you want byte-for-byte determinism — for example because you're promoting an overlay to a signed baseline — set the top-level field:
strictSanitizer: true
In strict mode every would-be rewrite becomes a BLUEPRINT_REJECTED error.
You get the full list of objections and can fix them yourself. The original
blueprint is never mutated. The rejection response carries both halves: the
objections under details.rejections, and the repairs the sanitizer would
have applied under details.autoFixes — the same structured rows a 201
returns — so you can see exactly what it wanted to change before you change
it yourself.
Pre-flight dry-run
After the sanitizer, MicroStax renders every Kubernetes manifest the
orchestrator would apply and asks the API server to validate them
(dryRun=All) without actually creating anything. If the dry-run finds
blocking errors the env is rejected with a PREFLIGHT_FAILED code and the
structured report is attached to the response. Non-blocking warnings (e.g.
"preflight runner unavailable in this deployment mode") appear in the
dashboard's auto-fixes panel under "Pre-flight warnings".
Auto-heal
Environments default to autoHealEnabled: true. When
POST /environments/:id/diagnose runs, any high-confidence suggestion that
includes a safe JSON patch (confidence >= 0.95, blueprintPatch present,
autoApplyIfConfidenceAbove set) is applied silently — no dashboard click
required. The diagnose response includes autoHealApplied: [suggestionId, ...] so you can audit what happened. Turn this off per-env by setting
autoHealEnabled: false before promotion.
Best Practices
- Keep service names stable across baseline and overlay Blueprints.
- Use overlays only for services you are actively changing.
- Put realistic data policy in
snapshot, not ad hoc shell scripts. - Keep public exposure limited to services that actually need ingress.
- Add probes for every stateful or externally exposed service.
- Trust the sanitizer — write the blueprint you want for production; the platform will degrade gracefully on dev/test clusters.
- For baselines and signed blueprints, set
strictSanitizer: trueso the rewrite rules never silently change what you promoted.