# Technical Specification

### Architecture Overview

The system follows a **modular, service-oriented architecture** for managing benefit schemes, applications, and configurations for the UBI Provider platform. It consists of:

* **Frontend applications**
* **Backend services**
* **Headless CMS**
* **PostgreSQL database**

***

### Components & Interactions

* **Benefits Provider App (React)** communicates with **Provider Backend (NestJS)**.
* **Provider Backend** uses **Catalog Manager APIs** (from Strapi CMS via Provider Middleware) to fetch and manage benefit catalogs, applications, and configurations.
* Both **Strapi (Catalog Manager)** and **Provider Backend** persist data in **PostgreSQL** databases.

***

### Components & Tech Stack

#### 1. Benefits Provider App

* Built with **React (v18)**, **Vite**, and **Chakra UI**.
* Consumes REST APIs from **Provider Backend** for:
  * Benefit listing
  * Application submission
  * Status tracking
* **Key technologies:**
  * **React**: Frontend component library
  * **Vite**: Build tool and development server
  * **React Router DOM**: Routing for React apps
  * **Chakra UI**: UI component library
  * **TypeScript (v5)**: Type safety

***

#### 2. Provider Backend

* Built with **NestJS (v11)**, exposes REST APIs for the frontend.
* Integrates with **Catalog Manager (Strapi CMS)** via **Provider Middleware APIs**.
* Uses **Prisma ORM** with **PostgreSQL** for data persistence.
* Provides **Swagger API documentation**.
* **Key technologies:**
  * **NestJS**: Backend framework
  * **PostgreSQL**: Relational database
  * **Prisma ORM**: Database abstraction
  * **Swagger**: API documentation
  * **Scheduling (NestJS)**: Cron-like job handling
  * **Axios / HTTP client**: External requests
  * **TypeScript (v5)**: Type safety

***

#### 3. Catalog Manager

* Headless CMS built with **Strapi**.
* Manages benefit catalogs and configurations.
* Uses **PostgreSQL** for database storage.
* **Key technologies:**
  * **Node.js (v18+)**: Runtime environment
  * **Strapi**: Headless CMS framework
  * **PostgreSQL**: Database driver
  * **React / React Router DOM**: For CMS frontends (if needed)
