Write infrastructure once, compile it to Kubernetes, Compose, or GitHub Actions
16
stars
9
commits
Python
primary language
Sep 4, 2026
updated
Write infrastructure once, compile it to Kubernetes, Compose, or GitHub Actions.
Infra Lang is an Infrastructure-as-Code DSL for DevOps engineers, SREs, and
platform teams. You describe your application — services, databases, queues,
secrets, and pipelines — in one declarative .infra file, and Infra Lang
compiles it to Kubernetes YAML, Docker Compose, Terraform HCL, or a GitHub
Actions workflow. Instead of hand-writing and maintaining the same app in four
different formats, you maintain one source of truth.
A single .infra file describes a service:
# app.infra
service api {
image: "myapp/api:v1.0.0"
replicas: 3
port 8080
health http("/health")
resources {
requests { cpu: 200m, memory: 256Mi }
limits { cpu: 1000m, memory: 512Mi }
}
}
Compile it to Kubernetes:
infra compile app.infra --target kubernetes
Infra Lang produces the matching Deployment and Service:
apiVersion: apps/v1
kind: Deployment
metadata:
name: api
spec:
replicas: 3
selector:
matchLabels:
app.kubernetes.io/name: api
template:
spec:
containers:
- name: api
image: myapp/api:v1.0.0
ports:
- containerPort: 8080
name: port-0
resources:
requests: { cpu: 200m, memory: 256Mi }
limits: { cpu: 1000m, memory: 512Mi }
readinessProbe:
httpGet: { path: /health, port: 8080 }
---
apiVersion: v1
kind: Service
metadata:
name: api
spec:
selector:
app.kubernetes.io/name: api
ports:
- port: 8080
targetPort: 8080
The same file compiles to Docker Compose with no rewriting:
infra compile app.infra --target compose
A pipeline block compiles to a GitHub Actions workflow:
pipeline ci {
trigger { branches: ["main"] }
stages {
test: { runsOn: "ubuntu-latest" steps { t: { run: "pytest" } } }
}
}
infra compile app.infra --target github
service, database, cache, queue,
storage, network, secret, config, pipeline, environment,
cluster.Error-severity findings block compilation..infra file on disk.infra fmt, infra repl, and
infra diff for reviewing changes.infra up / infra down apply and remove resources
on a live cluster (kubectl apply/delete), Docker Compose
(docker compose up/down), or Helm (helm upgrade --install/uninstall),
with a --dry-run to preview commands.infra cost estimates the monthly cloud cost of a
.infra file (per-resource table, --json for CI gates, --currency).infra serve / infra ui render any
.infra file as an interactive, fully-offline HTML dashboard (see below).import with cycle
detection, extends inheritance, 25+ stdlib functions and a prelude of
shared constants.infra serve / infra ui)Since 0.5.2 Infra Lang ships a local, zero-dependency dashboard that
renders any .infra file as a single self-contained HTML page:
infra serve app.infra # http://localhost:8080 (opens browser)
infra serve app.infra --port 9000 # custom port (loopback only)
infra serve app.infra --no-browser # serve without opening a browser
infra serve app.infra -e staging # preview an environment overlay
infra serve app.infra -o report.html # one-shot static export, then exit
infra ui app.infra # alias for `infra serve`
The dashboard shows the architecture DAG (services, databases, caches and
queues with depends_on edges), a FinOps cost report (monthly estimate
with a per-resource share chart), a live-drift panel and a switcher for
every environment overlay declared in the file. It inlines all CSS/JS — no
CDN, no external requests — and binds to 127.0.0.1 only.
Click the button below to open this project in GitHub Codespaces:
No local installation needed — full dev environment in about 2 minutes (Python 3.12, Docker-in-Docker, kubectl/helm, Ruff/Mypy extensions).
pip install infra-lang
With the language server (recommended for VS Code):
pip install 'infra-lang[lsp]'
Verify:
infra --version
infra --help
Note: For the latest development version, install from Git:
pip install git+https://github.com/TuviDev/infra-lang.git
Requirements: Python 3.11+.
Full documentation is hosted at TuviDev.github.io/infra-lang.
The fastest path is the 5-minute quickstart. In short:
.infra file (see the demo above).infra validate app.infrainfra compile app.infra --target kubernetesinfra-out/, or preview with --dry-run.infra fmt app.infra and infra diff app.infra app2.infra.There is also a guided tutorial and commented examples.
| Target | Command | What it generates |
|---|---|---|
| Kubernetes | -t kubernetes | Deployments, Services, Ingress, StatefulSets, PVCs, ConfigMaps, Secrets, CronJobs, HPA, PDBs, NetworkPolicies, ResourceQuotas, Namespaces, RBAC, TopologySpreadConstraints |
| Helm | -t helm | A complete chart: Chart.yaml, values.yaml, templates/, _helpers.tpl, .helmignore |
| Docker Compose | -t compose | docker-compose.yml, .env.example, Makefile |
| Terraform | -t terraform | main.tf, variables.tf, outputs.tf, providers.tf (AWS/GCP/Azure) |
| GitHub Actions | -t github | .github/workflows/*.yml, dependabot.yml |
Not every resource type maps to every target — for example, pipeline compiles
only to GitHub Actions, and cluster only to Terraform. See the
support matrix for the
full mapping.
The documentation is hosted at TuviDev.github.io/infra-lang.
| Doc | What it covers |
|---|---|
| Quickstart | 5-minute first run |
| Language spec | Full DSL reference (blocks, fields, error codes) |
| Support matrix | Which resources map to which targets |
| LSP / editor support | VS Code extension and language server |
| Known limitations | Honest boundaries of the project |
Contributions are welcome. See CONTRIBUTING.md for how to set up a dev environment, add a backend or a grammar rule, and the coding standards (ruff, mypy). Please read our Security policy before reporting a vulnerability.
Licensed under the MIT License.
Infra Lang is inspired by the ideas behind Terraform, Score, and Pulumi: declarative infrastructure that is easy to read and hard to get wrong.
9 commits
Python
99.8%
Write infrastructure once, compile it to Kubernetes, Compose, or GitHub Actions
16
stars
9
commits
Python
primary language
Sep 4, 2026
updated
Write infrastructure once, compile it to Kubernetes, Compose, or GitHub Actions.
Infra Lang is an Infrastructure-as-Code DSL for DevOps engineers, SREs, and
platform teams. You describe your application — services, databases, queues,
secrets, and pipelines — in one declarative .infra file, and Infra Lang
compiles it to Kubernetes YAML, Docker Compose, Terraform HCL, or a GitHub
Actions workflow. Instead of hand-writing and maintaining the same app in four
different formats, you maintain one source of truth.
A single .infra file describes a service:
# app.infra
service api {
image: "myapp/api:v1.0.0"
replicas: 3
port 8080
health http("/health")
resources {
requests { cpu: 200m, memory: 256Mi }
limits { cpu: 1000m, memory: 512Mi }
}
}
Compile it to Kubernetes:
infra compile app.infra --target kubernetes
Infra Lang produces the matching Deployment and Service:
apiVersion: apps/v1
kind: Deployment
metadata:
name: api
spec:
replicas: 3
selector:
matchLabels:
app.kubernetes.io/name: api
template:
spec:
containers:
- name: api
image: myapp/api:v1.0.0
ports:
- containerPort: 8080
name: port-0
resources:
requests: { cpu: 200m, memory: 256Mi }
limits: { cpu: 1000m, memory: 512Mi }
readinessProbe:
httpGet: { path: /health, port: 8080 }
---
apiVersion: v1
kind: Service
metadata:
name: api
spec:
selector:
app.kubernetes.io/name: api
ports:
- port: 8080
targetPort: 8080
The same file compiles to Docker Compose with no rewriting:
infra compile app.infra --target compose
A pipeline block compiles to a GitHub Actions workflow:
pipeline ci {
trigger { branches: ["main"] }
stages {
test: { runsOn: "ubuntu-latest" steps { t: { run: "pytest" } } }
}
}
infra compile app.infra --target github
service, database, cache, queue,
storage, network, secret, config, pipeline, environment,
cluster.Error-severity findings block compilation..infra file on disk.infra fmt, infra repl, and
infra diff for reviewing changes.infra up / infra down apply and remove resources
on a live cluster (kubectl apply/delete), Docker Compose
(docker compose up/down), or Helm (helm upgrade --install/uninstall),
with a --dry-run to preview commands.infra cost estimates the monthly cloud cost of a
.infra file (per-resource table, --json for CI gates, --currency).infra serve / infra ui render any
.infra file as an interactive, fully-offline HTML dashboard (see below).import with cycle
detection, extends inheritance, 25+ stdlib functions and a prelude of
shared constants.infra serve / infra ui)Since 0.5.2 Infra Lang ships a local, zero-dependency dashboard that
renders any .infra file as a single self-contained HTML page:
infra serve app.infra # http://localhost:8080 (opens browser)
infra serve app.infra --port 9000 # custom port (loopback only)
infra serve app.infra --no-browser # serve without opening a browser
infra serve app.infra -e staging # preview an environment overlay
infra serve app.infra -o report.html # one-shot static export, then exit
infra ui app.infra # alias for `infra serve`
The dashboard shows the architecture DAG (services, databases, caches and
queues with depends_on edges), a FinOps cost report (monthly estimate
with a per-resource share chart), a live-drift panel and a switcher for
every environment overlay declared in the file. It inlines all CSS/JS — no
CDN, no external requests — and binds to 127.0.0.1 only.
Click the button below to open this project in GitHub Codespaces:
No local installation needed — full dev environment in about 2 minutes (Python 3.12, Docker-in-Docker, kubectl/helm, Ruff/Mypy extensions).
pip install infra-lang
With the language server (recommended for VS Code):
pip install 'infra-lang[lsp]'
Verify:
infra --version
infra --help
Note: For the latest development version, install from Git:
pip install git+https://github.com/TuviDev/infra-lang.git
Requirements: Python 3.11+.
Full documentation is hosted at TuviDev.github.io/infra-lang.
The fastest path is the 5-minute quickstart. In short:
.infra file (see the demo above).infra validate app.infrainfra compile app.infra --target kubernetesinfra-out/, or preview with --dry-run.infra fmt app.infra and infra diff app.infra app2.infra.There is also a guided tutorial and commented examples.
| Target | Command | What it generates |
|---|---|---|
| Kubernetes | -t kubernetes | Deployments, Services, Ingress, StatefulSets, PVCs, ConfigMaps, Secrets, CronJobs, HPA, PDBs, NetworkPolicies, ResourceQuotas, Namespaces, RBAC, TopologySpreadConstraints |
| Helm | -t helm | A complete chart: Chart.yaml, values.yaml, templates/, _helpers.tpl, .helmignore |
| Docker Compose | -t compose | docker-compose.yml, .env.example, Makefile |
| Terraform | -t terraform | main.tf, variables.tf, outputs.tf, providers.tf (AWS/GCP/Azure) |
| GitHub Actions | -t github | .github/workflows/*.yml, dependabot.yml |
Not every resource type maps to every target — for example, pipeline compiles
only to GitHub Actions, and cluster only to Terraform. See the
support matrix for the
full mapping.
The documentation is hosted at TuviDev.github.io/infra-lang.
| Doc | What it covers |
|---|---|
| Quickstart | 5-minute first run |
| Language spec | Full DSL reference (blocks, fields, error codes) |
| Support matrix | Which resources map to which targets |
| LSP / editor support | VS Code extension and language server |
| Known limitations | Honest boundaries of the project |
Contributions are welcome. See CONTRIBUTING.md for how to set up a dev environment, add a backend or a grammar rule, and the coding standards (ruff, mypy). Please read our Security policy before reporting a vulnerability.
Licensed under the MIT License.
Infra Lang is inspired by the ideas behind Terraform, Score, and Pulumi: declarative infrastructure that is easy to read and hard to get wrong.
9 commits
Python
99.8%