This guide provides instructions for deploying PromptWizard in various environments.
- Local Development
- Docker Deployment
- Cloud Deployment
- Environment Variables
- Security Considerations
- Troubleshooting
- Python 3.8+
- Node.js 18+
- npm or yarn
-
Navigate to the API directory:
cd api -
Create a virtual environment:
python -m venv venv
-
Activate the virtual environment:
- Windows:
venv\Scripts\activate - macOS/Linux:
source venv/bin/activate
- Windows:
-
Install dependencies:
pip install -r requirements.txt
-
Start the API server:
python app.py
The API will be available at http://localhost:5000.
-
Navigate to the UI directory:
cd ui -
Install dependencies:
npm install
-
Create a
.env.localfile with the following content:NEXT_PUBLIC_API_URL=http://localhost:5000 -
Start the development server:
npm run dev
The UI will be available at http://localhost:3000.
- Docker
- Docker Compose
-
Clone the repository:
git clone https://github.com/microsoft/PromptWizard.git cd PromptWizard -
Create a
.envfile in the root directory with your API keys:GOOGLE_API_KEY=your_gemini_api_key OPENAI_API_KEY=your_openai_api_key -
Build and start the containers:
docker-compose up -d
-
Access the UI at http://localhost:3000
If you prefer to deploy the API and UI separately:
cd api
docker build -t promptwizard-api .
docker run -p 5000:5000 -e GOOGLE_API_KEY=your_key -e OPENAI_API_KEY=your_key promptwizard-apicd ui
docker build -t promptwizard-ui .
docker run -p 3000:3000 -e NEXT_PUBLIC_API_URL=http://localhost:5000 promptwizard-ui- Create two App Services (one for API, one for UI)
- Deploy the API:
cd api az webapp up --sku B1 --name promptwizard-api - Deploy the UI:
cd ui az webapp up --sku B1 --name promptwizard-ui - Configure environment variables in the Azure Portal
- Build and push Docker images to Azure Container Registry
- Deploy containers using Azure CLI or Azure Portal
- Configure networking to allow communication between containers
- Create two Elastic Beanstalk environments
- Deploy the API:
cd api eb init && eb create promptwizard-api
- Deploy the UI:
cd ui eb init && eb create promptwizard-ui
- Configure environment variables in the Elastic Beanstalk console
- Create an ECS cluster
- Define task definitions for API and UI
- Create services for each task
- Configure load balancers and networking
- Build and push Docker images to Google Container Registry
- Deploy the API:
cd api gcloud run deploy promptwizard-api --image gcr.io/your-project/promptwizard-api - Deploy the UI:
cd ui gcloud run deploy promptwizard-ui --image gcr.io/your-project/promptwizard-ui - Configure environment variables in the Cloud Run console
GOOGLE_API_KEY: API key for Google GeminiOPENAI_API_KEY: API key for OpenAIFLASK_ENV: Set toproductionfor production deploymentFLASK_APP: Set toapp.py
NEXT_PUBLIC_API_URL: URL of the PromptWizard APINEXT_PUBLIC_DEFAULT_MODEL: Default model to use (Gemini, GPT-4, etc.)
- API Keys: Never commit API keys to version control. Use environment variables or secrets management.
- CORS: The API has CORS enabled for the frontend. In production, restrict CORS to your frontend domain.
- Rate Limiting: Consider implementing rate limiting to prevent abuse.
- Input Validation: All user input is validated, but be cautious when deploying to production.
- HTTPS: Always use HTTPS in production environments.
-
API Connection Error:
- Check if the API server is running
- Verify the
NEXT_PUBLIC_API_URLenvironment variable - Check network connectivity between UI and API
-
Model API Errors:
- Verify API keys are correct
- Check if you have sufficient quota/credits
- Ensure the model is available in your region
-
Docker Issues:
- Run
docker-compose logsto view container logs - Check if ports are correctly mapped
- Verify environment variables are set correctly
- Run
For more help, please open an issue on the GitHub repository.