# Final Project Summary & Deployment Guide

## Recent Changes (Last 3 Git Pushes)

Here is a summary of the most recent activity on the repository:

1.  **`e3e726d`** - Timo, 3 minutes ago
    *   **Message**: `feat: Initialize BizMatch application with core UI components, routing, listing pages, backend services, migration scripts, and vulnerability management.`
    *   **Impact**: Major initialization of the application structure, including core features and security baselines.

2.  **`e32e43d`** - Timo, 10 hours ago
    *   **Message**: `docs: Add comprehensive deployment guide for BizMatch project.`
    *   **Impact**: Added documentation for deployment procedures.

3.  **`b52e47b`** - Timo, 10 hours ago
    *   **Message**: `feat: Initialize Angular SSR application with core pages, components, and server setup.`
    *   **Impact**: Initial naming and setup of the Angular SSR environment.

---

## Deployment Instructions

### 1. Prerequisites
*   **Node.js**: Version **20.x** or higher is recommended.
*   **Package Manager**: `npm`.

### 2. Building for Production (SSR)
The application is configured for **Angular SSR (Server-Side Rendering)**. You must build the application specifically for this mode.

**Steps:**
1.  Navigate to the project directory:
    ```bash
    cd bizmatch
    ```
2.  Install dependencies:
    ```bash
    npm install
    ```
3.  Build the project:
    ```bash
    npm run build:ssr
    ```
    *   This command executes `node version.js` (to update build versions) and then `ng build --configuration prod`.
    *   Output will be generated in `dist/bizmatch/browser` and `dist/bizmatch/server`.

### 3. Running the Application
To start the production server:

```bash
npm run serve:ssr
```
*   **Entry Point**: `dist/bizmatch/server/server.mjs`
*   **Port**: The server listens on `process.env.PORT` or defaults to **4200**.

### 4. Critical Deployment Checks (SSR & Polyfills)
**⚠️ IMPORTANT:**
The application uses a custom **DOM Polyfill** to support third-party libraries that might rely on browser-specific objects (like `window`, `document`) during server-side rendering.

*   **Polyfill Location**: `src/ssr-dom-polyfill.ts`
*   **Server Verification**: Open `server.ts` and ensure the polyfill is imported **BEFORE** any other imports:
    ```typescript
    // IMPORTANT: DOM polyfill must be imported FIRST
    import './src/ssr-dom-polyfill';
    ```
*   **Why is this important?**
    If this import is removed or moved down, you may encounter `ReferenceError: window is not defined` or `document is not defined` errors when the server tries to render pages containing Leaflet maps or other browser-only libraries.

### 5. Environment Variables & Security
*   Ensure all necessary environment variables (e.g., Database URLs, API Keys) are configured in your deployment environment.
*   Since `server.ts` is an Express app, you can extend it to handle specialized headers or proxy configurations if needed.

### 6. Vulnerability Status
*   Please refer to `FINAL_VULNERABILITY_STATUS.md` for the most recent security audit and known issues.
