This commit is contained in:
233
README.md
233
README.md
@@ -1,75 +1,206 @@
|
||||
# Nuxt Minimal Starter
|
||||
# Policy UI
|
||||
|
||||
Look at the [Nuxt documentation](https://nuxt.com/docs/getting-started/introduction) to learn more.
|
||||
Nuxt.js application for managing insurance policies, quotes, and customer relationships.
|
||||
|
||||
## Setup
|
||||
## Overview
|
||||
|
||||
Make sure to install dependencies:
|
||||
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
|
||||
# npm
|
||||
npm install
|
||||
# Enter the development shell
|
||||
nix develop
|
||||
|
||||
# pnpm
|
||||
# Install dependencies (first time only)
|
||||
pnpm install
|
||||
|
||||
# yarn
|
||||
yarn install
|
||||
|
||||
# bun
|
||||
bun install
|
||||
```
|
||||
|
||||
## Development Server
|
||||
|
||||
Start the development server on `http://localhost:3000`:
|
||||
|
||||
```bash
|
||||
# npm
|
||||
npm run dev
|
||||
|
||||
# pnpm
|
||||
# Start development server
|
||||
pnpm dev
|
||||
|
||||
# yarn
|
||||
yarn dev
|
||||
|
||||
# bun
|
||||
bun run dev
|
||||
```
|
||||
|
||||
## Production
|
||||
The application will be available at `http://localhost:3000`.
|
||||
|
||||
Build the application for production:
|
||||
### Using Node.js/pnpm
|
||||
|
||||
If you don't have Nix installed:
|
||||
|
||||
```bash
|
||||
# npm
|
||||
npm run build
|
||||
# Install dependencies
|
||||
pnpm install
|
||||
|
||||
# pnpm
|
||||
# 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
|
||||
|
||||
# yarn
|
||||
yarn build
|
||||
|
||||
# bun
|
||||
bun run build
|
||||
# Preview production build
|
||||
pnpm preview
|
||||
```
|
||||
|
||||
Locally preview production build:
|
||||
## 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
|
||||
# npm
|
||||
npm run preview
|
||||
# Install dependencies
|
||||
helm repo add bjw-s https://bjw-s-labs.github.io/helm-charts
|
||||
helm dependency build ops/chart
|
||||
|
||||
# pnpm
|
||||
pnpm preview
|
||||
|
||||
# yarn
|
||||
yarn preview
|
||||
|
||||
# bun
|
||||
bun run preview
|
||||
# Install the chart
|
||||
helm install policy-ui ops/chart --namespace <namespace>
|
||||
```
|
||||
|
||||
Check out the [deployment documentation](https://nuxt.com/docs/getting-started/deployment) for more information.
|
||||
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=<namespace>
|
||||
```
|
||||
|
||||
2. Install the Helm chart:
|
||||
```bash
|
||||
helm install policy-ui ops/chart --namespace <namespace>
|
||||
```
|
||||
|
||||
3. For production, override values:
|
||||
```bash
|
||||
helm install policy-ui ops/chart --namespace <namespace> \
|
||||
--set controllers.main.containers.main.image.tag=<version> \
|
||||
--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]
|
||||
|
||||
Reference in New Issue
Block a user