Generate production-ready DevOps files for your projects using AI
Project description
Spectra CLI
🎯 Generate production-ready DevOps files for your projects using AI
Spectra CLI scans your project, identifies the tech stack, and automatically generates production-ready DevOps files including:
- Dockerfile - Multi-stage, optimized Docker images
- docker-compose.yml - Local development setup
- GitHub Actions CI/CD - Automated build and deployment workflows
Features
- 🔍 Smart Project Scanning - Automatically detects your tech stack (Node.js, Python, Java, Go, Rust, PHP, etc.)
- 🤖 AI-Powered Generation - Uses Gemini AI to generate production-ready DevOps files
- ⚡ Lightning Fast - Instant responses for common stacks via template caching (80% of users)
- 🔄 Async Processing - Background job queue for custom stacks with real-time progress
- 🔒 Production-Ready - Follows best practices for security and performance
- 🚀 Zero Configuration - Works out of the box with sensible defaults
Installation
Option 1: Global install (recommended for users)
Install via pipx (isolated global CLI):
# Install pipx if needed
python3 -m pip install --user pipx && python3 -m pipx ensurepath
# Install the Spectra CLI globally (after PyPI publish)
pipx install spectra-cli
# Use from any project
spectra init
If you prefer using pip:
pip install --user spectra-cli
spectra init
Option 2: Install from Source (Development)
# Clone the repository
git clone https://github.com/yourusername/spectra-cli.git
cd spectra-cli
# Create a virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Install in editable mode
pip install -e .
Option 3: Install via pip (Production)
pip install spectra-cli
Quick Start
-
Navigate to your project directory:
cd /path/to/your/project
-
Run Spectra:
spectra init -
That's it! Spectra will:
- Scan your project
- Detect your tech stack
- Generate Dockerfile, docker-compose.yml, and CI/CD workflows
Performance
System Design v2 includes major performance improvements:
- Template Caching: Common stacks (Python, Node.js, Go, Rust, Java) get instant responses (<1 second)
- Async Job Queue: Custom stacks use background processing with real-time polling
- No Timeouts: Architecture solves Vercel timeout issues completely
See API_V2_DOCS.md for detailed architecture documentation.
Configuration
Environment Variables
CLI:
SPECTRA_API_URL- API endpoint URL (default:https://spectra-cli-f7h0.onrender.com/)export SPECTRA_API_URL='https://your-custom-api.example.com/'
API Server (for self-hosting):
OPENROUTER_API_KEY- OpenRouter API key (get from https://openrouter.ai/keys - free tier available)UPSTASH_REDIS_URL- Upstash Redis URL (optional, for production job queue)UPSTASH_REDIS_TOKEN- Upstash Redis token (optional)
Command Options
# Scan a specific directory
spectra init /path/to/project
# Use a custom API URL
spectra init --api-url https://custom-api.example.com/
# Check version
spectra version
Local Development
Running the API Locally
-
Install API dependencies:
pip install -r api/requirements.txt
-
Set OpenRouter API key:
export OPENROUTER_API_KEY='your-openrouter-api-key-here'
Get your free API key from https://openrouter.ai/keys (no credit card required)
-
Run the API server:
uvicorn api.index:app --host 127.0.0.1 --port 8000
-
Test the CLI:
export SPECTRA_API_URL='http://127.0.0.1:8000/' spectra init
Deployment
Production API
The Spectra CLI uses a production API hosted on Render at https://spectra-cli-f7h0.onrender.com/. The CLI works out of the box without any configuration needed.
Self-Hosting the API
If you want to host your own instance of the API:
-
Deploy to Render, Vercel, or any Python hosting platform
-
Set environment variables:
OPENROUTER_API_KEY- Your OpenRouter API key (get from https://openrouter.ai/keys)UPSTASH_REDIS_URL- (Optional) For job queueUPSTASH_REDIS_TOKEN- (Optional) For job queue
-
Configure CLI to use your instance:
export SPECTRA_API_URL='https://your-custom-api.example.com/'
See DEPLOYMENT.md for detailed deployment instructions.
Project Structure
spectra-cli/
├── spectra/ # CLI package
│ ├── __init__.py
│ ├── main.py # CLI entry point
│ ├── scanner.py # Project scanner
│ └── client.py # API client
├── api/ # Serverless API
│ ├── index.py # FastAPI app
│ └── requirements.txt
├── requirements.txt # CLI dependencies
├── pyproject.toml # Package configuration
├── vercel.json # Vercel config
└── README.md
Supported Tech Stacks
- Node.js - Detected via
package.json - Python - Detected via
requirements.txt,Pipfile, orpyproject.toml - Java (Maven) - Detected via
pom.xml - Java (Gradle) - Detected via
build.gradle - Go - Detected via
go.mod - Rust - Detected via
Cargo.toml - PHP - Detected via
composer.json
Requirements
- Python 3.8 or higher
- Internet connection (to call the API)
Troubleshooting
CLI can't connect to API
- Check that
SPECTRA_API_URLis set correctly - Verify the API server is running (if testing locally)
- Check your network connection
No files generated
- Ensure your project contains recognizable files (package.json, requirements.txt, etc.)
- Check that the API is responding correctly
- Review API logs for errors
API errors
- Verify
OPENROUTER_API_KEYis set correctly on the server - Get your free API key from https://openrouter.ai/keys (no credit card required)
- Check OpenRouter API status at https://openrouter.ai/status
- For job queue issues, verify
UPSTASH_REDIS_URLandUPSTASH_REDIS_TOKENare set (optional) - See API_V2_DOCS.md for troubleshooting
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
MIT License - see LICENSE file for details
Support
For issues and questions:
- Open an issue on GitHub
- Check the documentation
- Review the troubleshooting section
Built with ❤️ by the Spectra team
Project details
Release history Release notifications | RSS feed
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 spectra_cli-0.1.2.tar.gz.
File metadata
- Download URL: spectra_cli-0.1.2.tar.gz
- Upload date:
- Size: 12.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
45c73be9c6798c7035cddb8586ff723069d2f3f84d43be887bf6fd125f956b63
|
|
| MD5 |
e60b0d07772223aa1dfc6c6182a9c163
|
|
| BLAKE2b-256 |
df2a9642db1a9a3a4033c2af33be7f64e63fe07ed99d728cdb0a9b894d75a28d
|
File details
Details for the file spectra_cli-0.1.2-py3-none-any.whl.
File metadata
- Download URL: spectra_cli-0.1.2-py3-none-any.whl
- Upload date:
- Size: 11.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dc568d37019cf78c5d2d425edd54d1e9fccc6955a67d4c79c443081903f927f7
|
|
| MD5 |
6e0da3f02309d8cb665ccc6617fe9b47
|
|
| BLAKE2b-256 |
ce2e848fb85a1f9345d15f66c2c7d3859d934ea298d61f0d72b83c64d4f75300
|