This guide provides comprehensive instructions for setting up the Customer Chatbot Solution Accelerator for local development across Windows and Linux platforms.
This application consists of two separate services that run independently:
- Backend API - FastAPI REST API server for the frontend
- Frontend - React-based e-commerce user interface with integrated chat
⚠️ Critical: Each service must run in its own terminal/console window
- Do NOT close terminals while services are running
- Open 2 separate terminal windows for local development
- Each service will occupy its terminal and show live logs
All paths in this guide are relative to the repository root directory:
customer-chatbot-solution-accelerator/ ← Repository root (start here)
├── src/
│ ├── api/ ← Backend FastAPI application
│ │ ├── app/ ← Main application code
│ │ │ ├── routers/ ← API endpoint routes
│ │ │ ├── services/ ← Business logic services
│ │ │ ├── plugins/ ← Agent plugins
│ │ │ └── utils/ ← Utility functions
│ │ ├── .env ← Backend environment config
│ │ └── requirements.txt ← Python dependencies
│ ├── App/ ← Frontend React application
│ │ ├── src/ ← React/TypeScript source
│ │ ├── package.json ← Frontend dependencies
│ │ └── env.example ← Frontend env template
│ ├── tests/ ← Unit and integration tests
│ ├── start-local.bat ← Windows startup script
│ └── start-local.sh ← Linux/Mac startup script
├── infra/ ← Azure infrastructure (Bicep)
├── documents/ ← Documentation (you are here)
├── .vscode/ ← VS Code configuration
└── azure.yaml ← Azure Developer CLI config
Before starting any step, ensure you are in the repository root directory:
# Verify you're in the correct location
pwd # Linux/macOS - should show: .../customer-chatbot-solution-accelerator
Get-Location # Windows PowerShell - should show: ...\customer-chatbot-solution-accelerator
# If not, navigate to repository root
cd path/to/customer-chatbot-solution-acceleratorInstall these tools before you start:
- Visual Studio Code with the following extensions:
- Python 3.11+. Important: Check "Add Python to PATH" during installation.
- PowerShell 7.0+ (Windows)
- Node.js (LTS) - Required for frontend development
- Git
- Azure CLI
- Azure Developer CLI (azd)
# Install Python 3.11+ and Git
winget install Python.Python.3.11
winget install Git.Git
# Install Node.js for frontend
winget install OpenJS.NodeJS.LTS
# Install Azure CLI
winget install Microsoft.AzureCLI
# Install Azure Developer CLI
winget install Microsoft.Azd# Install WSL2 first (run in PowerShell as Administrator):
# wsl --install -d Ubuntu
# Then in WSL2 Ubuntu terminal:
sudo apt update && sudo apt install python3.11 python3.11-venv git curl nodejs npm -y# Install prerequisites
sudo apt update && sudo apt install python3.11 python3.11-venv git curl nodejs npm -y# Install prerequisites
sudo dnf install python3.11 python3.11-devel git curl gcc nodejs npm -yChoose a location on your local machine where you want to store the project files.
-
Open your terminal or command prompt. Navigate to your desired directory and clone the repository:
git clone https://github.com/microsoft/customer-chatbot-solution-accelerator.git
-
Navigate to the project directory:
cd customer-chatbot-solution-accelerator -
Open the project in Visual Studio Code:
code .
The repository includes pre-configured VS Code settings in .vscode/ directory:
- launch.json - Debug configurations for Python FastAPI backend
- settings.json - Python, linting, and testing configurations
VS Code should automatically prompt you to install recommended extensions. If not, install these manually:
ms-python.python- Python language supportms-python.vscode-pylance- Python language serverms-python.black-formatter- Code formattingms-python.isort- Import sortingms-python.flake8- Lintingms-azuretools.vscode-bicep- Bicep supportms-vscode.azure-account- Azure account management
Before running the application locally, authenticate with Azure:
# Login to Azure CLI
az login
# Set your subscription (replace with your subscription ID)
az account set --subscription "your-subscription-id"
# Verify authentication
az account showFollow these steps to set up and run the application locally:
Before running locally, you need Azure resources deployed. If you haven't already:
# Initialize Azure Developer CLI
azd init
# Deploy to Azure (this creates all required resources)
azd up📖 Detailed Deployment: Follow the Deployment Guide for complete instructions.
- Navigate to
src/api/directory - If resources were provisioned using
azd provisionorazd up, environment variables are automatically configured in.azure/<env-name>/.env - Copy or create a
.envfile insrc/api/with the required values:
# App Configuration
APP_ENV="dev"
ALLOWED_ORIGINS_STR="*"
# Azure AI Foundry
AZURE_AI_AGENT_ENDPOINT="https://your-ai-services.services.ai.azure.com/api/projects/your-project"
AZURE_AI_AGENT_MODEL_DEPLOYMENT_NAME="gpt-4o-mini"
AZURE_FOUNDRY_ENDPOINT="https://your-ai-services.services.ai.azure.com/api/projects/your-project"
# Azure OpenAI
AZURE_OPENAI_ENDPOINT="https://your-openai.openai.azure.com/"
AZURE_OPENAI_DEPLOYMENT_NAME="gpt-4o-mini"
AZURE_OPENAI_API_VERSION="2025-01-01-preview"
# Azure AI Search
AZURE_AI_SEARCH_ENDPOINT="https://your-search.search.windows.net"
AZURE_SEARCH_ENDPOINT="https://your-search.search.windows.net"
AZURE_SEARCH_INDEX="policies"
AZURE_SEARCH_PRODUCT_INDEX="products"
# Azure Cosmos DB
COSMOS_DB_ENDPOINT="https://your-cosmos.documents.azure.com:443/"
COSMOS_DB_DATABASE_NAME="ecommerce_db"
AZURE_COSMOSDB_DATABASE="ecommerce_db"
AZURE_COSMOSDB_CONVERSATIONS_CONTAINER="chat_sessions"
# Foundry Agents
FOUNDRY_CHAT_AGENT="chat-agent-name"
FOUNDRY_PRODUCT_AGENT="product-agent-name"
FOUNDRY_POLICY_AGENT="policy-agent-name"
USE_FOUNDRY_AGENTS="True"
USE_AI_PROJECT_CLIENT="True"Note: Set
APP_ENV="dev"for local development. This enables DefaultAzureCredential for authentication.
- Navigate to
src/App/directory - Copy
env.exampleto.env:
cp src/App/env.example src/App/.env- Update the
.envfile:
VITE_API_BASE_URL=http://127.0.0.1:8000/
VITE_ENVIRONMENT=developmentTo run the application locally, your Azure account needs the following role assignments on the deployed resources:
# Get your principal ID
PRINCIPAL_ID=$(az ad signed-in-user show --query id -o tsv)
# Assign Cosmos DB Built-in Data Contributor role
az cosmosdb sql role assignment create \
--account-name <cosmos-account-name> \
--resource-group <resource-group> \
--role-definition-name "Cosmos DB Built-in Data Contributor" \
--principal-id $PRINCIPAL_ID \
--scope "/"# Assign Search Index Data Contributor role
az role assignment create \
--assignee $PRINCIPAL_ID \
--role "Search Index Data Contributor" \
--scope "/subscriptions/<subscription-id>/resourceGroups/<resource-group>/providers/Microsoft.Search/searchServices/<search-name>"Note: After Azure deployment is complete, the post-deployment script assigns these roles automatically. You may only need to do this manually if permissions are missing.
Open your terminal and navigate to the repository root folder:
# Navigate to the project root folder
cd customer-chatbot-solution-accelerator
# Create virtual environment in the root folder
python -m venv .venv
# Activate virtual environment (Windows PowerShell)
.venv\Scripts\Activate.ps1
# Activate virtual environment (Windows Command Prompt)
.venv\Scripts\activate.bat
# Activate virtual environment (macOS/Linux)
source .venv/bin/activateNote: After activation, you should see
(.venv)in your terminal prompt indicating the virtual environment is active.
# Navigate to the API folder (while virtual environment is activated)
cd src/api
# Upgrade pip
python -m pip install --upgrade pip
# Install Python dependencies
pip install -r requirements.txtFor convenience, use the provided startup scripts that handle starting both services:
Windows:
cd src
.\start-local.batmacOS/Linux:
cd src
chmod +x start-local.sh
./start-local.sh📋 Terminal Reminder: This section requires two separate terminal windows - one for the Backend API and one for the Frontend. Keep both terminals open while running.
# Navigate to the API folder (with virtual environment activated)
cd src/api
# Run the backend API
python -m uvicorn app.main:app --host 127.0.0.1 --port 8000 --reload# Navigate to the frontend folder
cd src/App
# Install frontend dependencies (first time only)
npm install
# Run the frontend development server
npm run devAlternatively, run the backend in debug mode:
- Open VS Code
- Go to Run and Debug (Ctrl+Shift+D)
- Select "Python: Backend" from the dropdown
- Click the green play button or press F5
Before using the application, confirm all services are running correctly:
| Terminal | Service | Command | Expected Output | URL |
|---|---|---|---|---|
| Terminal 1 | Backend API | python -m uvicorn app.main:app --port 8000 --reload |
INFO: Application startup complete |
http://127.0.0.1:8000 |
| Terminal 2 | Frontend (Dev) | npm run dev |
Local: http://localhost:5173/ |
http://localhost:5173 |
1. Check Backend API:
# In a new terminal
curl http://127.0.0.1:8000/health
# Expected: {"status":"healthy"} or similar JSON response2. Check Frontend:
- Open browser to http://localhost:5173
- Should see the Customer Chatbot e-commerce UI
- If authentication is configured, you may be redirected to Azure AD login
Service not starting?
- Ensure you're in the correct directory (
src/apifor backend,src/Appfor frontend) - Verify virtual environment is activated (you should see
(.venv)in prompt) - Check that port is not already in use (8000 for API, 5173 for frontend dev)
- Review error messages in the terminal
Can't access services?
- Verify firewall isn't blocking ports 8000 or 5173
- Try
http://localhost:portinstead ofhttp://127.0.0.1:port - Ensure services show "startup complete" messages
Azure authentication errors?
- Ensure you're logged in with
az login - Verify
APP_ENV="dev"is set in.env - Check that your account has the required RBAC roles on Azure resources
The project includes unit tests and code quality tools:
# Navigate to the API directory
cd src/api
# Run tests with pytest
pytest tests/ -v
# Run tests with coverage report
pytest tests/ -v --cov=app --cov-report=htmlOnce all services are running (as confirmed in Step 7), you can:
- Access the Application: Open
http://localhost:5173in your browser to explore the Customer Chatbot UI - Browse Products: Navigate the e-commerce interface and browse the product catalog
- Test Chat: Use the integrated chat assistant to ask questions about products or policies
- Explore the Code: Review the codebase starting with
src/api/app/directory
# Check available Python versions
python3 --version
python3.11 --version
# If python3.11 not found, install it:
# Ubuntu: sudo apt install python3.11
# macOS: brew install python@3.11
# Windows: winget install Python.Python.3.11# Recreate virtual environment
rm -rf .venv # Linux/macOS
# or Remove-Item -Recurse .venv # Windows PowerShell
python -m venv .venv
# Activate and reinstall
source .venv/bin/activate # Linux/macOS
# or .\.venv\Scripts\Activate.ps1 # Windows
pip install -r src/api/requirements.txt# Fix ownership of files
sudo chown -R $USER:$USER .# PowerShell execution policy
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
# Long path support (Windows 10 1607+, run as Administrator)
New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" -Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force# Login to Azure CLI
az login
# Set subscription
az account set --subscription "your-subscription-id"
# Test authentication
az account show# Check environment variables are loaded
env | grep AZURE # Linux/macOS
Get-ChildItem Env:AZURE* # Windows PowerShell
# Validate .env file format
cat src/api/.env | grep -v '^#' | grep '=' # Should show key=value pairs- Deployment Guide - Instructions for Azure deployment
- Technical Architecture - Solution architecture details
- App Authentication Setup - Configure application authentication
- Delete Resource Group - Steps to safely delete Azure resources
- Quota Check - Verify Azure quotas before deployment