Skip to main content

Prerequisites

Install

go install github.com/ubiquex/ubx@latest
ubx version
# ubx v1.0.0

Create a Project

ubx init my-infra
cd my-infra
This scaffolds:
my-infra/
  ubx.yaml      # project config
  stack.iac     # your infrastructure
  .ubx/         # generated output (git-ignored)

Write Your First Stack

Edit stack.iac:
input "env" {
  type    = "string"
  default = "dev"
}

unit "aws_s3_bucket_v2" "assets" {
  bucket        = "${input.env}-my-assets"
  force_destroy = true
}

output "bucket_name" {
  value       = ~unit.aws_s3_bucket_v2.assets.bucket
  description = "S3 bucket name"
}

Validate

ubx validate
#   ◆ Compile    stack.iac
#   ✓  valid

Preview

ubx plan
#   ◆ Compile    stack.iac → .ubx/index.ts
#   ◆ Stack      dev
#   ◆ Packages   ready
#
#   ─── Preview ────────────────────────
#   +  aws:s3:BucketV2    assets
#
#   1 to create

Deploy

ubx apply
#   ◆ Compile    stack.iac → .ubx/index.ts
#   ◆ Stack      dev
#   ◆ Packages   ready
#
#   ─── Applying ───────────────────────
#   +  aws:s3:BucketV2    assets    3s
#
#   ✓  done in 4s · 1 created · 0 changed · 0 destroyed
#
#   ─── Outputs ────────────────────────
#   bucket_name  =  "dev-my-assets"

Clean Up

ubx destroy

Wire Outputs to Apps

The real power of ubx — wiring cloud outputs directly into app deployments:
unit "aws_rds_instance" "db" {
  engine              = "postgres"
  instance_class      = "db.t3.micro"
  allocated_storage   = 20
  username            = "admin"
  password            = secret("aws_secrets_manager", "prod/db/password")
  skip_final_snapshot = true
}

deploy "helm" "backend" {
  chart     = "my-backend"
  namespace = "backend"
  values = {
    database = {
      host = ~unit.aws_rds_instance.db.endpoint  # auto-wired
    }
  }
}
No manual steps. No pipeline glue. The ~ prefix wires it automatically.

Next Steps

Multi-environment

Staging vs production with extend blocks

AI features

ubx explain, fix, suggest, review, upgrade

Language reference

All block types and syntax

CLI reference

All ubx commands