> ## Documentation Index
> Fetch the complete documentation index at: https://shivamgoyal.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Azure Container Apps

> Deploy CodeNull AI Backend to Azure Container Apps

# Deploying to Azure Container Apps

Azure Container Apps is a serverless container service that enables you to run microservices and containerized applications on a serverless platform. This guide covers the process of deploying the CodeNull AI Backend to Azure Container Apps.

## Testing Locally with Docker

Before deploying to Azure, it's recommended to test your application locally:

<Steps>
  <Step title="Build the Docker image">
    ```bash theme={null}
    docker build --tag codenull-ai-backend .
    ```

    This compiles your application into a Docker image.
  </Step>

  <Step title="Run the container locally">
    ```bash theme={null}
    docker run -d --name codenull-ai-backend -p 8000:8000 codenull-ai-backend
    ```

    This starts a container with your application accessible at [http://localhost:8000](http://localhost:8000).
  </Step>
</Steps>

## Login to Azure

Before deploying to Azure, you need to authenticate:

```bash theme={null}
az login
```

## Creating Azure Resources

If you haven't already created a resource group, create one with:

```bash theme={null}
az group create --name web-fastapi-codenull-rg --location westus2
```

## Deploying to Azure Container Apps

Azure Container Apps allows you to deploy directly from your local source code:

```bash theme={null}
az containerapp up \
    --resource-group web-fastapi-codenull-rg \
    --name web-codenull-app \
    --ingress external \
    --target-port 8000 \
    --source .
```

This command:

* Creates a new container app called `web-codenull-app`
* Configures it with external ingress to allow public access
* Maps it to port 8000 (the port your application listens on)
* Builds and deploys the application from the current directory

## Viewing Your Deployment

To view details about your deployed container app:

```bash theme={null}
az containerapp show -n web-codenull-app -g web-fastapi-codenull-rg
```

Your application should now be accessible at the URL provided in the output (e.g., `https://<your-app-name>.<region>.azurecontainerapps.io/`).

## API Endpoints

All endpoints (except health check) use the base path `/codenull/ai/api/v1/`. Here are some of the available endpoints:

1. **Health Check**: `GET /health`
2. **Chat Completion**: `POST /codenull/ai/api/v1/chat-completion`
3. **Generate Website**: `POST /codenull/ai/api/v1/generate-website`
4. **Optimize SEO**: `POST /codenull/ai/api/v1/optimize-seo`
5. **Evaluate Website**: `POST /codenull/ai/api/v1/evaluate-website`

For comprehensive documentation, visit the [API Reference](/api-reference).

## Next Steps

For production deployments, we recommend:

* [Production Deployment with Azure Container Registry](/deployment/production-deployment)
* [Monitoring your deployed application](/deployment/monitoring)
