Skip to main content

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

  1. Navigate to your project directory:

    cd /path/to/your/project
    
  2. Run Spectra:

    spectra init
    
  3. 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.vercel.app/)
    export SPECTRA_API_URL='https://your-api.vercel.app/'
    

API Server (Vercel):

  • 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

  1. Install API dependencies:

    pip install -r api/requirements.txt
    
  2. 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)

  3. Run the API server:

    uvicorn api.index:app --host 127.0.0.1 --port 8000
    
  4. Test the CLI:

    export SPECTRA_API_URL='http://127.0.0.1:8000/'
    spectra init
    

Deployment

Deploy API to Vercel

  1. Install Vercel CLI:

    npm install -g vercel
    
  2. Login to Vercel:

    vercel login
    
  3. Deploy:

    vercel deploy
    
  4. Set environment variables:

    vercel env add OPENROUTER_API_KEY
    # Paste your OpenRouter API key when prompted
    # Get free key from https://openrouter.ai/keys
    
  5. Redeploy to apply changes:

    vercel --prod
    
  6. Update CLI to use production API:

    export SPECTRA_API_URL='https://your-api.vercel.app/'
    

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, or pyproject.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
  • OpenRouter API key (for the API server) - Get free key from https://openrouter.ai/keys
  • Internet connection (to call the API)
  • Upstash Redis (optional, for production job queue)

Troubleshooting

CLI can't connect to API

  • Check that SPECTRA_API_URL is 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

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

spectra_cli-0.1.1.tar.gz (12.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

spectra_cli-0.1.1-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

Details for the file spectra_cli-0.1.1.tar.gz.

File metadata

  • Download URL: spectra_cli-0.1.1.tar.gz
  • Upload date:
  • Size: 12.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for spectra_cli-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a05b01b844dddf5c24ebf7ed9d06b590e93a3913a50afe907f83fe8bb3781c3b
MD5 35c234192832f07ed19d4c71718041ff
BLAKE2b-256 9dfa79f46a6f80ecca6deababaff7d2c1f8bec795b82494a7c704dea37f821ad

See more details on using hashes here.

File details

Details for the file spectra_cli-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: spectra_cli-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 11.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for spectra_cli-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3a255638c5194f0f203824314d59e29020eccb1bbfdd0908e587de22803f977f
MD5 2a7c47bf4428d1e57407ce5a15d86149
BLAKE2b-256 4e70ce63765a87692f1858c1916af2044c4cd6e7bad5f852ccd210f7ed0f408d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page