Mo Sharif
← ~/work

Infrastructure Export

An architecture diagram that stays a picture is only half useful. The other half is turning it into something you can actually deploy.

Codelit exports your diagrams to a dozen-plus formats, from infrastructure-as-code (Terraform, Docker Compose, Kubernetes) to documentation formats (Mermaid, SVG, PNG) to data interchange (JSON). The goal: your architecture diagram isn't just a drawing, it's a deployable spec.

Docker Compose generates a docker-compose.yml with services, networks, volumes, and dependencies mapped from your diagram. Each service node becomes a container definition. Database nodes get volume mounts. Queue nodes get appropriate images (redis, rabbitmq, kafka).

Terraform generates HCL (HashiCorp Configuration Language) with provider blocks, resource definitions, and variable declarations. Maps to AWS by default, but supports GCP and Azure resource types. A service node becomes an ECS task or Lambda function depending on context. A database node becomes an RDS instance.

Kubernetes manifests generates Deployments, Services, ConfigMaps, and Ingress resources. Each service node maps to a Deployment + Service pair. Databases get StatefulSets. The ingress configuration is inferred from your gateway/load balancer nodes.

Mermaid exports back to Mermaid syntax. Useful if you built or modified a diagram visually and want to embed it in documentation. Full round-trip: import Mermaid, edit on canvas, export Mermaid.

SVG is a vector export of the canvas. Crisp at any zoom level. Good for embedding in presentations and documents.

PNG is a raster export. Quick and universal. Supports transparent background and custom resolution.

JSON is the raw diagram data. Nodes, edges, groups, positions, metadata. Useful for programmatic access or backup.

PlantUML, if your docs pipeline already speaks it.

The export engine maps canvas nodes to infrastructure resources using a rule-based system. Each node type has a set of export templates:

Typescript
// Simplified mapping example
const terraformMappings = {
  service: (node) => `
resource "aws_ecs_service" "${node.id}" {
  name            = "${node.label}"
  cluster         = aws_ecs_cluster.main.id
  task_definition = aws_ecs_task_definition.${node.id}.arn
  desired_count   = 2
}`,
  database: (node) => `
resource "aws_db_instance" "${node.id}" {
  identifier     = "${node.label}"
  engine         = "postgres"
  instance_class = "db.t3.medium"
  allocated_storage = 20
}`,
  cache: (node) => `
resource "aws_elasticache_cluster" "${node.id}" {
  cluster_id    = "${node.label}"
  engine        = "redis"
  node_type     = "cache.t3.micro"
  num_cache_nodes = 1
}`,
};

Edges become security group rules, network policies, or IAM permissions depending on the target format. A connection from a service to a database becomes an inbound rule on the database's security group allowing traffic from that service.

Groups map to VPCs, subnets, or namespaces. A group labeled "Private Subnet" in your diagram becomes an aws_subnet resource in Terraform with map_public_ip_on_launch = false.

The exports are a strong starting point, not production-ready infrastructure code. They get the structure right: which services exist, how they connect, what resources they need. They set reasonable defaults for instance sizes, replica counts, and configurations.

What you'll need to customize:

  • Secrets and credentials. The export uses placeholder values. You need to add real connection strings, API keys, and passwords.
  • Sizing. Defaults are conservative (t3.medium, db.t3.medium). Scale up or down based on your actual load.
  • Networking details. CIDR blocks, availability zones, and region-specific configurations need your input.
  • CI/CD integration. The export generates infrastructure definitions, not deployment pipelines.

The honest pitch: this saves you 60-70% of the boilerplate work. You still need an engineer to review, customize, and deploy the output. But starting from a generated Terraform file is way faster than starting from scratch.

Every export format is on the free tier: Terraform, Docker Compose, Kubernetes, Mermaid, PlantUML, SVG, PNG, and JSON. If you can draw it, you can export it. Pro, at $5/month with a 7-day trial, adds the parts that turn an export into a running project: the agent repo pack, PDF docs, verified GitHub repo creation, and watermark-free sharing.

Going from a diagram to a scaffolded, committed repo in one workflow is one of the most common reasons people upgrade, right after hitting the daily generation limit.

Check pricing for current plan details.