# Policy UI Nuxt.js application for managing insurance policies, quotes, and customer relationships. ## Overview Policy UI is a modern web application built with: - **Nuxt 4** - Vue 3 framework with server-side rendering - **@nuxt/ui** - Component library for consistent UI - **Tailwind CSS** - Utility-first CSS framework - **TypeScript** - Type-safe development ## Features - Policy management and tracking - Quote comparison and selection - Customer relationship management - Workload task management (back-office) - Document handling and generation - Responsive design ## Development ### Prerequisites - **Nix** (recommended) or Node.js 20+ and pnpm 10+ ### Using Nix (Recommended) The project uses Nix for reproducible development and builds. ```bash # Enter the development shell nix develop # Install dependencies (first time only) pnpm install # Start development server pnpm dev ``` The application will be available at `http://localhost:3000`. ### Using Node.js/pnpm If you don't have Nix installed: ```bash # Install dependencies pnpm install # Start development server pnpm dev ``` ## Building ### With Nix ```bash # Build the application nix build .#policy-ui # The built application will be in the Nix store ``` ### With pnpm ```bash # Build the application pnpm build # Preview production build pnpm preview ``` ## Infrastructure ### Nix Flake The project uses a Nix flake for reproducible builds and Docker image creation: - **`packages.policy-ui`** - Builds the Nuxt application - **`packages.dockerImage`** - Creates a Docker image with Node.js and the built app - **`devShells.default`** - Provides Node.js, pnpm, and Helm in the development shell ### Docker Image The Docker image is built using Nix and includes: - Node.js runtime - Built Nuxt application (`.output` and `node_modules`) - Configured to run on port 3000 ### Helm Chart A Helm chart is provided for Kubernetes deployment at `ops/chart/`: ```bash # Install dependencies helm repo add bjw-s https://bjw-s-labs.github.io/helm-charts helm dependency build ops/chart # Install the chart helm install policy-ui ops/chart --namespace ``` The chart includes: - Deployment with 1 replica (configurable) - ClusterIP service on port 3000 - Health checks (liveness/readiness) - Environment variables for API endpoints - Ingress support (disabled by default) ### CI/CD The `.gitea/workflows/build-and-publish.yaml` workflow: - Triggers on push to `main` branch - Builds Docker image using Nix - Pushes to Gitea Container Registry - Packages and pushes Helm chart to Gitea Helm registry ## Configuration ### Environment Variables The application uses the following environment variables: | Variable | Description | Default | |----------|-------------|---------| | `NUXT_PUBLIC_CUSTOMER_API_BASE` | Customer API base URL | `https://dev.api.corredorconect.com/customer/api/v1` | | `NUXT_PUBLIC_POLICY_API_BASE` | Policy API base URL | `https://dev.api.corredorconect.com/policy/api/v1` | | `NUXT_PUBLIC_PROVIDERS_API_BASE` | Providers API base URL | `https://dev.api.corredorconect.com/provider/api/v1` | | `NUXT_PUBLIC_WORKLOAD_API_BASE` | Workload API base URL | `https://dev.api.corredorconect.com/workload/api/v1` | | `NUXT_PUBLIC_DOCUMENT_API_BASE` | Document API base URL | `https://dev.api.corredorconect.com/document/api` | | `NUXT_PUBLIC_POLICY_API_TOKEN` | Policy API authentication token | Required | ### API Endpoints The application connects to the following backend services: - **Customer API** - Customer and policy data - **Policy API** - Policy management and quotes - **Providers API** - Insurance provider information - **Workload API** - Back-office task management - **Document API** - Document storage and retrieval ## Deployment ### Kubernetes 1. Create the required secret: ```bash kubectl create secret generic policy-ui-secrets \ --from-literal=policyApiToken='your-token-here' \ --namespace= ``` 2. Install the Helm chart: ```bash helm install policy-ui ops/chart --namespace ``` 3. For production, override values: ```bash helm install policy-ui ops/chart --namespace \ --set controllers.main.containers.main.image.tag= \ --set ingress.main.enabled=true \ --set ingress.main.hosts[0].host=policy-ui.example.com ``` ### Docker ```bash # Build the image with Nix nix build .#dockerImage # Load the image docker load < result # Run the container docker run -p 3000:3000 \ -e NUXT_PUBLIC_POLICY_API_TOKEN=your-token \ gitea.corredorconect.com/software-engineering/policy-ui:latest ``` ## Project Structure ``` policy-ui/ ├── app/ # Nuxt app directory │ ├── components/ # Vue components │ ├── pages/ # File-based routing │ └── assets/ # Static assets ├── ops/ # Infrastructure │ └── chart/ # Helm chart ├── .gitea/ # CI/CD workflows │ └── workflows/ ├── flake.nix # Nix flake configuration └── package.json # Node.js dependencies ``` ## License [Your License Here]