A modern web application that converts cloud infrastructure text descriptions into interactive diagrams and vice versa. Built with Next.js, React Flow, and TypeScript.
- 🔄 Bidirectional conversion between YAML and diagrams
- 🎨 Interactive diagram editor with drag-and-drop interface
- 📝 Real-time YAML editor with syntax highlighting
- 🌙 Dark/Light mode support
- 🎯 Snap-to-grid and auto-layout functionality
- 🔌 Support for various cloud infrastructure elements
- 🚀 Generate Terraform configurations for AWS, GCP, and Azure
- Node.js 18.x or later
- npm or yarn
# Clone the repository
git clone https://github.com/yourusername/cloud-text2diagram.git
# Navigate to the project directory
cd cloud-text2diagram
# Install dependencies
npm install
# or
yarn install
# Start the development server
npm run dev
# or
yarn devVisit http://localhost:3000 to see the application.
The application uses a simple YAML format to describe cloud infrastructure:
elements:
web-server:
type: compute
specs:
cpu: 2
memory: "4GB"
metadata:
position:
x: 100
y: 200
connections:
- to: database
protocols:
postgresql: 5432
http: 8080
networks:
main-vpc:
specs:
cidr: "10.0.0.0/16"
metadata:
position:
x: 50
y: 100
size:
width: 400
height: 300
contains:
- web-server
- database- Compute (
type: compute): Virtual machines or servers with configurable CPU and memory - Database (
type: database): Database instances with configurable engine and storage - Load Balancer (
type: loadbalancer): Traffic distribution with protocol and algorithm settings - Storage (
type: storage): Object storage services with configurable capacity - Queue (
type: queue): Message queues and brokers (RabbitMQ, Kafka) - CDN (
type: cdn): Content Delivery Networks for edge caching - API Gateway (
type: apigateway): API management with auth and rate limiting - Firewall (
type: firewall): Network security with inbound/outbound rules - Network: Container for grouping related elements with CIDR range
The application can generate Terraform configurations for your cloud infrastructure diagrams. This feature supports:
-
Multiple Cloud Providers:
- AWS (using AWS provider)
- GCP (using Google Cloud provider)
- Azure (using AzureRM provider)
-
Generated Resources:
- Compute instances (EC2, Compute Engine, Virtual Machines)
- Databases (RDS, Cloud SQL, Azure SQL)
- Load Balancers (ALB/NLB, Cloud Load Balancing, Azure Load Balancer)
- Storage (S3, Cloud Storage, Blob Storage)
- Message Queues (SQS/SNS, Pub/Sub, Service Bus)
- CDN (CloudFront, Cloud CDN, Azure CDN)
- API Management (API Gateway, Cloud Endpoints, API Management)
- Network Security (Security Groups, Firewall Rules, Network Security Groups)
- Networking (VPC, VPC Networks, Virtual Networks)
To generate Terraform configurations:
- Create your infrastructure diagram using the visual editor or YAML
- Click the "Generate Terraform" button in the toolbar
- Wait for the generation to complete
- Click "Download Terraform" to save the configuration as
main.tf
The generated Terraform configurations include:
- Provider configuration
- Resource definitions with best practices
- Network configuration and security
- Required variables with default values
- Output values for important resources
To add a new element type to the infrastructure diagram tool, follow these steps:
-
Create the Node Component
// src/components/nodes/cloud-[type].tsx "use client"; import { [IconName] } from "lucide-react"; import { CloudNodeShell, CloudNodeShellProps } from "./cloud-node-shell"; interface Cloud[Type]NodeProps { data: { label: string; } & CloudNodeShellProps["specs"]; } export function Cloud[Type]Node({ data: { label, ...specs }, }: Cloud[Type]NodeProps) { return <CloudNodeShell label={label} icon={[IconName]} specs={specs} />; }
-
Register the Node Type in diagram-editor.tsx
- Import the component
- Add to nodeTypes object
- Add to the Select dropdown
- Add default data in the addNode callback
-
Update Infrastructure Parser
- Add type mapping in parseInfrastructureText
- Add type mapping in generateInfrastructureText
-
Update Documentation
- Add element type description in documentation-sidebar.tsx
src/
├── app/ # Next.js app router
├── components/
│ ├── nodes/ # Cloud infrastructure node components
│ ├── edges/ # Edge components for connections
│ ├── ui/ # Reusable UI components
│ └── ...
├── hooks/ # Custom React hooks
├── lib/ # Utility functions and parsers
└── styles/ # Global styles
We welcome contributions! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- React Flow for the diagram functionality
- shadcn/ui for the beautiful UI components
- Next.js for the React framework
- Monaco Editor for the YAML editing experience
Built with ❤️ by André Treib
