Skip to content

TechWizard27/ai-shell-command-generator

Repository files navigation

AI Shell Command Generator

A smart, AI-powered web application that translates natural language into shell commands for both Bash and PowerShell. This project is fully containerized with Docker for easy local development and is ready for production-grade deployment with Kubernetes.

Screenshot of the applicatation

Key Features

  • Live AI Command Generation: Translates natural language prompts into shell commands in real-time using the Groq API.
  • Cross-Platform Support: Generates commands for both Bash (Linux/macOS) and PowerShell (Windows) simultaneously.
  • Robust Backend: Built with FastAPI, including rate limiting and comprehensive error handling.
  • Containerized Environment: The entire application (backend and frontend) runs in Docker containers for a seamless setup experience.
  • Kubernetes Ready: The application is fully deployable in a Kubernetes cluster, demonstrating scalable, resilient, and production-ready orchestration.

Technology Stack

  • Backend: FastAPI (Python), Uvicorn
  • AI Integration: Groq API (openai/gpt-oss-120b model, feel free to change)
  • Frontend: Vanilla JavaScript, HTML5, CSS3
  • Web Server: Nginx
  • Containerization: Docker, Docker Compose
  • Orchestration: Kubernetes

Local Development Setup (with Docker Compose)

To run this project locally for development, you will need Docker and Docker Compose installed.

  1. Clone the Repository:

    git clone https://github.com/TechWizard27/ai-shell-command-generator.git
    cd ai-shell-command-generator
    
  2. Set Up Environment Variables: Create a .env file by copying the example file.

    cp .env.example .env
    

    Open the newly created .env file and add your Groq API key and define the model:

    GROQ_API_KEY=xxxxxxxxxxxxxxxxxxxx
    MODEL_NAME=your preferred model
    
  3. Build and Run with Docker Compose:

    docker-compose up --build
    

    This command will build the Docker images and start both the backend and frontend services.

  4. Access the Application: Open your web browser and navigate to http://localhost:8080.

Kubernetes Deployment

This project is configured for a declarative, production-style deployment on Kubernetes.

Prerequisites

  • A running Kubernetes cluster (e.g., enabled in Docker Desktop, Minikube, or a cloud provider like GKE/EKS/AKS).
  • kubectl command-line tool configured to connect to your cluster.
  • Local Docker Images: The deployment is configured with imagePullPolicy: Never, so it requires the application's Docker images to be available in your local image cache. Please ensure you have run docker-compose build at least once before proceeding.

Deployment Steps

  1. Create the Groq API Key Secret: Before deploying, you must create a Kubernetes Secret to securely store your API key. Replace your_actual_groq_api_key_here with your real key.

    kubectl create secret generic groq-api-key-secret --from-literal=GROQ_API_KEY=your_actual_groq_api_key_here
    
  2. Deploy the Application: Apply all the manifest files located in the kubernetes directory. This single command will create all the necessary Deployments, Services, and ConfigMaps.

    kubectl apply -f kubernetes/
    
  3. Check the Status: Wait a minute for all components to start. You can monitor the status of the pods with:

    kubectl get pods
    

    You should see both the ai-shell-backend-deployment and ai-shell-frontend-deployment pods in a Running (1/1) state.

  4. Access the Application: Open your web browser and navigate to http://localhost:30008.

Teardown

To remove all created Kubernetes resources, run:

kubectl delete -f kubernetes/

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published