AI-Powered Infrastructure as Code Generator
Generate production-ready infrastructure code from natural language descriptions with interactive visual diagrams.
π€ AI-Powered Generation - Describe your infrastructure in plain English and get production-ready IaC code
π Interactive Diagrams - Visualize your infrastructure with interactive flow diagrams powered by React Flow
π¬ Conversational Interface - Iterate on your infrastructure through a chat-based interface
π― Structured Schema - Custom Infra0 schema that maps infrastructure resources to visual components
π Real-time Streaming - Watch your infrastructure being built step-by-step with streaming workflows
π³ Docker Ready - Containerized deployment for easy setup and scaling
Infra0 consists of three main components:
infra0/
βββ cli/ # Command-line interface
βββ visualizer/
β βββ server/ # Node.js backend with AI integration
β βββ ui/ # Next.js frontend with interactive diagrams
βββ scripts/ # Docker and deployment scripts
- Frontend: Next.js 15, React 19, TypeScript, Tailwind CSS, React Flow
- Backend: Node.js, Express, MongoDB, TypeScript
- AI: Anthropic Claude (via AI SDK) and Gemini Google (via AI SDK)
- CLI: Commander.js, TypeScript
- Infrastructure: Pulumi (TypeScript)
- Containerization: Docker
- Node.js 18+ and pnpm
- Docker (optional, for containerized deployment)
- MongoDB instance
- Anthropic or Gemini API key
-
Clone the repository
git clone https://github.com/your-org/infra0.git cd infra0 -
Install dependencies
pnpm install
-
Set up environment variables
Create
.env.developmentfiles in the respective directories:visualizer/server/.env
# Database NODE_ENV=development
visualizer/server/.env.development
# Database MONGODB_URI=mongodb://localhost:27017/infra0 # AI Configuration ANTHROPIC_API_KEY=your_anthropic_api_key_here or GOOGLE_GENERATIVE_AI_API_KEY=your_gemini_api_key_here # JWT JWT_SECRET=your_jwt_secret_here JWT_EXPIRES_IN=7d # Server PORT=4000
visualizer/ui/.env.local
NEXT_PUBLIC_API_URL=http://localhost:4000/apicli/.env.development
# Docker Image Configuration
INFRA0_UI_IMAGE_URL=infra0/visualizer-ui:latest
INFRA0_UI_IMAGE_PLATFORM=linux/amd64
INFRA0_UI_HOST_PORT=3000
INFRA0_UI_CONTAINER_PORT=3000-
Start the development environment
# Start both frontend and backend pnpm dev:visualizer # Or start everything including CLI pnpm dev
-
Access the application
- Frontend: http://localhost:3000
- Backend API: http://localhost:4000
-
Start a New Project
- Open the web interface at http://localhost:3000
- Click "New Project" or describe your infrastructure needs
-
Describe Your Infrastructure
Create an AWS VPC with public and private subnets, an RDS PostgreSQL database, and an ECS cluster with a load balancer -
View Generated Code
- Get production-ready Pulumi TypeScript code
- Interact with the visual diagram
- Configure individual components
-
Initialize a new project
cd cli pnpm dev init -p project_path -
Render the visualizer
pnpm dev render
Input:
I need a serverless API with a Lambda function, API Gateway,
DynamoDB table, and proper IAM roles for a user management system
Output:
- Complete Pulumi TypeScript code
- Interactive infrastructure diagram
- Configurable component properties
- Deployment-ready structure
infra0/
βββ cli/
β βββ src/
β β βββ actions/ # CLI actions (init, render)
β β βββ commands/ # Command definitions
β β βββ main.ts # CLI entry point
β βββ package.json
βββ visualizer/
β βββ server/
β β βββ src/
β β β βββ controller/ # API controllers
β β β βββ llm/ # AI integration
β β β βββ model/ # MongoDB models
β β β βββ services/ # Business logic
β β β βββ types/ # TypeScript definitions
β β βββ package.json
β βββ ui/
β βββ app/ # Next.js app router
β βββ components/ # React components
β βββ types/ # Frontend types
β βββ package.json
βββ package.json # Root workspace config
# Development
pnpm dev # Start all services
pnpm dev:visualizer # Start frontend and backend only
# Building
pnpm build # Build all packages
pnpm server:inject-ui-build # Build UI and inject into server
# Docker
pnpm ui:docker-build # Build Docker image
pnpm ui:docker-run # Run Docker containerPOST /api/conversations- Create new conversationGET /api/conversations/:id- Get conversationPOST /api/conversations/:id/messages- Add messagePOST /api/auth/register- User registrationPOST /api/auth/login- User login
Infra0 have support to both Anthropic's Claude and Google's Gemini to:
- Parse Natural Language - Understand infrastructure requirements from user descriptions
- Generate Pulumi Code - Create production-ready TypeScript code
- Create Schema - Generate structured Infra0 schema for visualization
- Optimize Architecture - Suggest best practices and optimizations
The Infra0 schema maps infrastructure resources to visual components:
interface Infra0 {
resources: Record<string, Infra0Resource>;
diagram: {
nodes: Infra0Node[];
edges: Infra0Edge[];
};
}
interface Infra0Resource {
type: string; // Pulumi type (e.g., "aws:ec2:Vpc")
config: Record<string, any>; // Constructor arguments
dependsOn?: string[]; // Dependencies
}
interface Infra0Node {
id: string; // Matches resource key
label: string; // Display name
parent?: string; // For nesting
group?: string; // For styling
}# Build the Docker image
pnpm ui:docker-build
# Run the container
pnpm ui:docker-run# Build
docker build -t infra0/visualizer-ui ./visualizer/ui
# Run
docker run -p 3000:3000 infra0/visualizer-uiWe welcome contributions! Please see our contributing guidelines:
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Make your changes
- Add tests if applicable
- Commit your changes:
git commit -m 'Add amazing feature' - Push to the branch:
git push origin feature/amazing-feature - Open a Pull Request
- Follow TypeScript best practices
- Add JSDoc comments for public APIs
- Write tests for new features
- Update documentation as needed
- Follow the existing code style
- π New Cloud Providers - Add support for Azure, GCP
- π¨ UI/UX Improvements - Enhanced diagram interactions
- π€ AI Enhancements - Better prompt engineering
- π Documentation - Tutorials and examples
- π§ͺ Testing - Unit and integration tests
- π§ DevOps - CI/CD improvements
This project is licensed under the MIT License - see the LICENSE file for details.
- π Bug Reports: Create an issue
- π‘ Feature Requests: Start a discussion
- Multi-cloud Support - Azure and GCP integration
- Advanced Diagrams - 3D visualization and animations
- Team Collaboration - Real-time collaborative editing
- Infrastructure Testing - Automated validation and testing
- Cost Optimization - AI-powered cost analysis
- Security Scanning - Built-in security best practices
- Version Control - Git integration for infrastructure changes
Made with β€οΈ by Developers, for Developers
Empowering infrastructure teams to build faster and smarter