---
name: "Ferrero AC Booking Tool"
client: Ferrero
status: active
server: local
tech: [HTML, CSS, JavaScript, Node.js]
local_path: /Users/ai_leed/Documents/Projects/Oliver/ferrero-ac-creator
deploy: node server.js
url: http://localhost:3456
tags: [ferrero, booking, omg, csv, box]
created: 2026-04-14
port: 3456
---

## Overview

ferrero-ac-creator is a browser-based tool for generating and managing Ferrero communication asset (AC) bookings. It transforms user input into CSV files formatted for import into the OMG media booking system. The tool enables marketing teams to efficiently create, bulk-edit, and export asset booking records with computed fields (Title, Category, Media Type, etc.) derived from master filenames, asset metadata, and ISO codes. It supports both browser-based CSV download and server-side export directly to a Box folder for OMG ingestion.

## Tech Stack

- **Frontend:** HTML5, CSS3, vanilla JavaScript (no frameworks or external libraries)
- **Backend:** Node.js (stdlib only, zero npm dependencies)
- **Database:** None
- **Infrastructure:** Local HTTP server
- **AI/ML:** None
- **Key libraries:** None (single-file, zero-dependency architecture)

## Architecture

This is a **zero-dependency single-page application** with minimal backend:

**Frontend (`index.html`)**
- Single-file HTML document containing all markup, CSS, and JavaScript
- Input table with editable rows: Master File Name, Local Meta ID, Asset Type, Media Type, Aspect Ratio, ISO Code, and date pickers (Supply/Live/End dates)
- Interactive features:
  - Row selection with checkboxes
  - Bulk edit modal for dropdown and date fields across multiple rows
  - `runAnalyse()` function that transforms input rows into output rows with computed fields
  - CSV export to browser download or via server POST
  - All dropdown data (Asset Type, Media Type, Aspect Ratio, ISO Code) embedded as JavaScript arrays

**Backend (`server.js`)**
- Minimal Node.js HTTP server listening on port 3456
- Two responsibilities:
  1. Serves `index.html` as static file (SPA host)
  2. `POST /api/send-to-omg` — receives CSV data and writes to hardcoded Box folder path (`OMG_OUTPUT_DIR`)

**Data Flow**
1. User populates input table manually or via bulk edit
2. Click "Analyse" → `runAnalyse()` executes transformation logic
3. Title generation mirrors Excel Column J formula: parses Master File Name segments, looks up asset/media type codes, combines with aspect ratio, ISO code, Local Meta ID
4. Output table populated with computed columns: Title, Status (always "Booked"), Category, Media, Sub Media, Destination, Format, Language, Country, Creative Execution, Quantity
5. User exports via "Download CSV" (browser) or "Send to OMG" (server POST with campaign number)
6. CSV written with headers: `Title,Status,Category,Media,Sub media,Destination,Format,Supply date,Live date,End date,Special instructions,Language,Country,Creative Execution,Quantity`

```
┌─────────────────────────────────────────┐
│         index.html (SPA)                │
│  ┌─────────────────────────────────────┐│
│  │ Input Table (editable rows)         ││
│  │ - Master File Name, Local Meta ID   ││
│  │ - Dropdowns: Asset, Media, Ratio... ││
│  │ - Date pickers                      ││
│  └─────────────────────────────────────┘│
│            ↓ runAnalyse()                │
│  ┌─────────────────────────────────────┐│
│  │ Output Table (computed fields)      ││
│  │ - Title (from Excel formula logic)  ││
│  │ - Category, Media, Destination...   ││
│  └─────────────────────────────────────┘│
│   ↓ Download CSV    ↓ Send to OMG        │
└─────────────────────────────────────────┘
         ↓ browser              ↓ POST /api/send-to-omg
    .csv file            ┌──────────────────┐
                         │   server.js      │
                         │ Write to Box dir │
                         └──────────────────┘
```

## Dev Commands

```bash
# Start the development server
node server.js

# Open in browser
# http://localhost:3456

# Or open index.html directly (download CSV works without server)
open index.html
```

## Deployment

- **Server:** Local development only (no production deployment documented)
- **Deploy:** `node server.js` (manual, no automated CI/CD)
- **URL:** http://localhost:3456
- **Port:** 3456
- **Service:** None (manual process, not systemd)
- **Local path:** /Users/ai_leed/Documents/Projects/Oliver/ferrero-ac-creator

## Environment Variables

`OMG_OUTPUT_DIR` — Hardcoded in `server.js` to a specific user's Box folder path. Must be manually updated per machine for "Send to OMG" feature to work. Current value points to `/Users/pauljohns/Library/CloudStorage/Box-Box/AUTOMATION_MAIN/OMG_NIFI/OMG_CORE_AC_INGEST`

## API / Endpoints

- **`POST /api/send-to-omg`**
  - Accepts JSON payload with CSV data and 7-digit campaign number
  - Writes file as `OMG{campaign_number}_ACINGEST.csv` to `OMG_OUTPUT_DIR`
  - Returns success/error response
  - Requires valid campaign number (7 digits)

- **`GET /`**
  - Serves `index.html` static file

## Known Issues

- **Hardcoded Box path:** `OMG_OUTPUT_DIR` in `server.js` is hardcoded per machine; must be manually updated for each developer/environment
- **No authentication:** Recent git commit (1638e95) adds "session-based login page and auth middleware" but details not documented — verify implementation status
- **No npm install:** Zero dependencies by design, but limits extensibility; any future library additions require architectural changes
- **Dropdown data maintenance:** All dropdown values embedded in `index.html` as JavaScript arrays; requires manual editing to update (originally sourced from `Example/AC_Booking.xlsx`)
- **Excel formula parity:** Title generation mirrors Excel Column J formula; changes to formula logic must be synced manually

## Git

- **Remote:** git@bitbucket.org:zlalani/ferrero-ac-creator.git
- **Branch:** Main/develop (not specified in documentation)
- **Recent activity:** Auth middleware added (commit 1638e95); last commit from Bitbucket web UI suggests active maintenance

## Sessions
### 2026-04-14 – Project catalogued
**Done:** Added to Obsidian second brain.

---
## Change Log
| Date | Requested | Changed | Files |
|------|-----------|---------|-------|
| 2026-04-14 | Initial setup | Note created | — |