v0.1.0
Mistcraft Examples

Infrastructure Examples

Explore practical examples of Mistcraft configurations. Each example demonstrates real-world infrastructure patterns you can adapt for your projects.

Azure Resource Group
Basic resource group creation
resource rg = mw:type:azure/resources/resource-group {
    name     = "my-resources"
    location = "eastus"
    tags = {
        environment = "production"
        project     = "mistcraft"
    }
}
Storage Account
Azure storage with dependencies
resource storage = mw:type:azure/storage/storage-account {
    name                = "mystorageaccount"
    resource_group_name = rg.name
    location           = rg.location
    tier               = "Standard"
    replication_type   = "LRS"

    blob_properties = {
        versioning_enabled = true
    }
}
Virtual Network
Network configuration example
resource vnet = mw:type:azure/network/virtual-network {
    name                = "my-vnet"
    resource_group_name = rg.name
    location           = rg.location
    address_space      = ["10.0.0.0/16"]

    subnet = {
        name           = "internal"
        address_prefix = "10.0.1.0/24"
    }
}
Web App with Database
Complete web application stack
@input
variable app_name: string = "myapp"

# App Service Plan
resource plan = mw:type:azure/web/app-service-plan {
    name                = "${app_name}-plan"
    resource_group_name = rg.name
    location           = rg.location

    sku = {
        tier = "Standard"
        size = "S1"
    }
}

# Web Application
resource app = mw:type:azure/web/app-service {
    name                = "${app_name}-web"
    resource_group_name = rg.name
    location           = rg.location
    app_service_plan_id = plan.id

    app_settings = {
        NODE_ENV = "production"
        DATABASE_URL = sql_db.connection_string
    }
}
Advanced Patterns

Production-Ready Templates

High Availability

Multi-region deployment with automatic failover and load balancing.

Microservices

Complete microservices architecture with service mesh and observability.

Serverless

Event-driven serverless application with Functions and Event Grid.

CI/CD Pipeline

Complete CI/CD infrastructure with build agents and deployment stages.

Using These Examples

Getting Started

  1. Copy any example code above
  2. Save it as infrastructure.mist
  3. Run mistup validate to check syntax
  4. Deploy with mistup deploy

Tips

  • Start with simple examples and build up
  • Use variables for environment-specific values
  • Always validate before deploying
  • Check the documentation for provider-specific options