Revolutionary AI-powered CLI that generates production-ready infrastructure code, architectural diagrams, and comprehensive documentation from natural language descriptions. Supports Terraform, Kubernetes, Docker, CloudFormation, and more with multi-provider AI backends including OpenAI, Groq, AWS Bedrock, and Ollama.
Project description
SnapInfra
AI-powered infrastructure code generation from natural language
Transform plain English into production-ready infrastructure code. Generate Terraform, Kubernetes manifests, Docker configurations, and architectural diagrams using state-of-the-art AI models.
pip install snapinfra
snapinfra "Create a 3-tier AWS architecture with load balancer and RDS"
Key Features
- Multi-Provider AI: OpenAI, Groq, AWS Bedrock, Ollama support
- Production-Ready: Security best practices and scalability built-in
- Interactive Chat: Refine and iterate on your infrastructure
- Architecture Diagrams: Auto-generated Mermaid diagrams
- Cross-Platform: Works on Windows, macOS, and Linux
Quick Start
Install
pip install snapinfra
Set API Key
# Free Groq API (recommended)
export GROQ_API_KEY="your-api-key"
# Or OpenAI
export OPENAI_API_KEY="your-api-key"
Generate Infrastructure
# AWS Infrastructure
snapinfra "terraform for AWS VPC with public/private subnets"
# Kubernetes
snapinfra "k8s deployment for nginx with ingress"
# Docker
snapinfra "docker-compose for React app with PostgreSQL"
# With specific AI provider
snapinfra -b groq "serverless architecture with API Gateway and Lambda"
Supported Infrastructure
| Platform | Templates | Features |
|---|---|---|
| Terraform | AWS, Azure, GCP | Multi-cloud, modules, best practices |
| Kubernetes | Deployments, Services, Ingress | RBAC, security policies, monitoring |
| Docker | Dockerfiles, Compose | Multi-stage, optimization, security |
| CloudFormation | Serverless, Containers | AWS native, nested stacks |
| Ansible | Configuration, Deployment | Automation, orchestration |
| Helm | Charts, Values | Kubernetes package management |
AI Providers
| Provider | Speed | Cost | Best For |
|---|---|---|---|
| Groq | Ultra-fast | Free tier | Development, prototyping |
| OpenAI | Fast | Pay-per-use | Production, complex scenarios |
| AWS Bedrock | Fast | Enterprise | AWS environments |
| Ollama | Variable | Free | Privacy, offline usage |
Setup Examples
Groq (Recommended)
export GROQ_API_KEY="gsk_..."
snapinfra -b groq "terraform for EKS cluster"
OpenAI
export OPENAI_API_KEY="sk-..."
snapinfra -b openai -m gpt-4 "complex microservices architecture"
Local with Ollama
# No API key needed
snapinfra -b ollama "docker setup for development"
Common Use Cases
Cloud Infrastructure
# Complete AWS setup
snapinfra "3-tier architecture: ALB, ECS, RDS with monitoring"
# Multi-cloud
snapinfra "hybrid setup: AWS primary, Azure DR"
# Serverless
snapinfra "event-driven architecture with Lambda and SQS"
Container Orchestration
# Microservices
snapinfra "k8s platform: ingress, services, deployments, monitoring"
# Development environment
snapinfra "docker-compose: app, database, redis, monitoring"
# Production setup
snapinfra "helm chart for multi-tier application"
Development Workflows
# CI/CD
snapinfra "GitHub Actions: test, build, deploy to EKS"
# Infrastructure as Code
snapinfra "Terraform modules for reusable VPC patterns"
# Security
snapinfra "k8s network policies and RBAC for microservices"
Advanced Features
Interactive Chat Mode
snapinfra "basic AWS setup"
# SnapInfra generates initial code
# Continue refining: "add monitoring", "make it multi-region", "add security groups"
Architecture Diagrams
# Auto-generates Mermaid diagrams
snapinfra "AWS infrastructure with architecture diagram"
# Creates both code and visual representation
Multiple Output Formats
# Save to files
snapinfra -o main.tf "terraform VPC setup"
Batch Processing
# Multiple environments
snapinfra "terraform modules for dev, staging, prod"
# Different cloud providers
snapinfra "same app architecture for AWS, Azure, GCP"
Configuration
Environment Variables (Simple)
# Choose your AI provider
export GROQ_API_KEY="gsk_..."
export OPENAI_API_KEY="sk_..."
TOML Config (Advanced)
# ~/.config/snapinfra/config.toml
default_backend = "groq"
[backends.groq]
type = "groq"
api_key = "$GROQ_API_KEY"
default_model = "llama-4-scout-17b"
[backends.openai]
type = "openai"
api_key = "$OPENAI_API_KEY"
default_model = "gpt-4"
[backends.bedrock]
type = "bedrock"
aws_profile = "default"
aws_region = "us-east-1"
CLI Reference
Basic Usage
snapinfra [OPTIONS] "your infrastructure description"
Common Options
-b, --backend TEXT AI provider (groq, openai, bedrock, ollama)
-m, --model TEXT Specific model to use
-o, --output FILE Save code to file
-q, --quiet Non-interactive mode
--list-models Show available models
--validate / --no-validate Run validation after generation (default from config)
--save-validation-report Save validation report to the project directory
--report-format [markdown|json|text] Format for saved validation report
Examples
snapinfra -b groq "k8s setup"
snapinfra -o main.tf "terraform VPC"
snapinfra --clipboard "docker compose"
Why Choose SnapInfra?
For Developers
- Generate infrastructure faster than manual coding
- Learn best practices through AI-generated examples
- Consistent, documented infrastructure code
- Works with your existing tools and workflows
For Teams
- Standardize infrastructure patterns across projects
- Reduce knowledge silos with documented code
- Faster onboarding with readable, explained infrastructure
- Multi-environment consistency (dev/staging/prod)
For Enterprises
- Security best practices built into every template
- Compliance-ready configurations
- Cost-optimized resource specifications
- Integration with existing CI/CD pipelines
Enterprise Support
Professional Services
- Custom AI model integration
- Enterprise template development
- Team training and onboarding
- Architecture review and optimization
Support Channels
- GitHub Issues: Bug reports and feature requests
- Enterprise Support: Priority support and SLA
- Community: Discussions and examples
Compliance & Security
- SOC 2 compliant infrastructure templates
- CIS benchmarks integration
- Security scanning and validation
- Audit logging and compliance reporting
Development
From Source
git clone https://github.com/manojmaheshwarjg/snapinfra-cli.git
cd snapinfra-cli
pip install -e ".[dev]"
Testing
pytest
pytest --cov=snapinfra
Contributing
- Fork the repository
- Create a feature branch
- Add tests for new functionality
- Ensure all tests pass
- Submit a pull request
Project Structure
src/snapinfra/
├── cli/ # Command-line interface
├── backends/ # AI provider implementations
├── config/ # Configuration management
├── types/ # Data models and types
└── utils/ # Utility functions
License
Apache License 2.0
SnapInfra is open-source software licensed under the Apache License 2.0. This means:
- Commercial use allowed
- Modification and distribution permitted
- Patent protection provided
- Private use permitted
- Must include license and copyright notice
- Must state changes made to the code
Built by developers, for developers
GitHub • PyPI • Issues • Discussions
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file snapinfra-1.0.4.tar.gz.
File metadata
- Download URL: snapinfra-1.0.4.tar.gz
- Upload date:
- Size: 154.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6abb5cb47777a368be85cd449c2797c08cc13700406c898e98da995d953de98a
|
|
| MD5 |
a93246a355dd616e4d988dac728254cc
|
|
| BLAKE2b-256 |
e5b71e640cd736c0bd205bccec4c971ebb352033d94dd80b1bcad8b9ebbb95a9
|
File details
Details for the file snapinfra-1.0.4-py3-none-any.whl.
File metadata
- Download URL: snapinfra-1.0.4-py3-none-any.whl
- Upload date:
- Size: 164.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
950b8aa43dcb7a8ebe084ccb10d0db0983465d375a664f126a3f44c96e43f85a
|
|
| MD5 |
f0410596e8539479baeec313eeecb1df
|
|
| BLAKE2b-256 |
fd62df12c8c379798f6745f084c7e6d43b6af3bf6c609e710abe3c80eee89c2c
|