# Humand Backoffice

Administration dashboard for the Humand platform.

---

## Requirements

| Tool    | Version  | Enforced via                        |
| ------- | -------- | ----------------------------------- |
| Node.js | `24.11.1`| `engines` in `package.json` / `.nvmrc` |
| Bun     | `1.3.11` | `packageManager` in `package.json`  |

---

## Installation

### 1. Install NVM (if not installed)

Verify NVM is installed:

```bash
nvm --version
```

If not installed, follow the [NVM installation guide](https://github.com/nvm-sh/nvm#installing-and-updating).

### 2. Install the correct Node.js version

```bash
nvm install
```

This reads the `.nvmrc` file and installs Node.js `24.11.1`.

### 3. Use the correct Node.js version

```bash
nvm use
```

### 4. Install Bun

The project uses **Bun** as its package manager. The exact version is pinned in `package.json` via the `packageManager` field.

**Option A — via Homebrew:**

```bash
brew install bun
```

**Option B — specific version:**

```bash
curl -fsSL https://bun.sh/install | bash -s "bun-v1.3.11"
```

### 5. Install dependencies

```bash
bun install
```

> **Note:** Bun applies patches to `i18next` and `react-i18next` automatically during install via its native patch system (`patchedDependencies` in `package.json`). No postinstall scripts needed.

---

   ## Available Scripts

### Development

| Command                    | Description                                                                                         |
| -------------------------- | --------------------------------------------------------------------------------------------------- |
| `bun start`                | Start development server at [http://localhost:3000](http://localhost:3000)                         |
| `bun run start:dev`| Start with **material-hu & hu-translations HMR** enabled for real time library development [Check docs](#additional-resources)                               |
| `bun run start:stg`        | Start with staging environment configuration                                                       |
| `bun run start:prd`        | Start with production environment configuration                                                    |
| `bun run start:slot1`      | Start with slot1 environment configuration                                                         |
| `bun run start:slot2`      | Start with slot2 environment configuration                                                         |
| `bun run start:windows`    | Start development server (Windows compatible)                                                      |

### Build & Preview

| Command         | Description                                    |
| --------------- | ---------------------------------------------- |
| `bun run build` | Build for production (outputs to `build/`)     |
| `bun run serve` | Preview the production build locally           |

### Code Quality

| Command            | Description                                        |
| ------------------ | -------------------------------------------------- |
| `bun run lint`     | Run Biome lint and format checks                   |
| `bun run tsc`      | TypeScript check (non-strict mode)                 |
| `bun run tsc:strict` | TypeScript check (strict mode)                   |
| `bun run tsc:watch` | TypeScript check in watch mode                    |
| `bun run tsc:strict:diff` | TypeScript strict check with diff output      |


---

## Deployment Scripts

Located in the `.scripts/` directory:

| Script                            | Description                                                      |
| --------------------------------- | ---------------------------------------------------------------- |
| `.scripts/create-new-aux-qa-branch.sh` | Create a new `aux-qa/` branch from current branch               |
| `.scripts/deploy-test.sh`         | Deploy current branch to test environment                        |
| `.scripts/deploy-qa.sh`           | Deploy `qa` branch to QA environment                             |
| `.scripts/update-env-vars.sh`     | Update environment variables in GitHub for all environments      |

---

## Resources
###### Development mode plugins

In this mode, the Vite development server runs with two additional plugins enabled. These plugins facilitate real-time updates, allowing you to immediately see changes made to either the material-hu or hu-translations libraries during development.
- [Development Mode - Vite plugins](https://github.com/HumandDev/material-hu/blob/main/vite/README.md)

---
