← back to Rentv Adintel

docs/DEPLOYMENT_ADVERTISER_VIEWER.md

73 lines

# RENTV Advertiser Intelligence — Deployment & Local Run

Plain-English instructions to run the viewer locally. The app is the house stack —
**Express + PostgreSQL + a vanilla front-end**, Node 20+, served on port **9814**.

## Run it locally (five steps)

```bash
# 1. Create the database (PostgreSQL 16+ must be running)
createdb rentv_advertisers

# 2. Install dependencies
npm install

# 3. Create the tables
npm run db:migrate

# 4. Load the RENTV seed data (5 verified advertisers, CoStar content-partner,
#    panelist-only participants, dated rate + audience snapshots, source policies)
npm run db:seed

# 5. Start the app
npm start
```

Then open **http://localhost:9814** and click through to `/advertisers`.

To reset from scratch: `npm run db:reset` (drops + re-migrates + re-seeds).

## Health check

```bash
curl http://localhost:9814/healthz
# -> {"ok":true,"service":"rentv-adintel", ...}
```

## Environment variables

Copy `.env.example` to `.env` and fill in what you need. The app boots with **none of the
optional connectors configured** — it runs on DEMO fixtures. Key variables:

| Variable | Purpose | Default |
|----------|---------|---------|
| `PORT` | HTTP port | `9814` |
| `APP_BASE_URL` | Base URL for links | `http://localhost:9814` |
| `AUTH_SECRET` | Session/auth secret | `replace-me` (set a real one) |
| `DATABASE_URL` | Postgres DSN; overrides socket settings when set | empty |
| `PGHOST` / `PGDATABASE` | House convention: `/tmp` socket, db `rentv_advertisers` | `/tmp` / `rentv_advertisers` |
| `SEARCH_PROVIDER` | `manual` \| `google_cse` \| `brave` \| `bing` \| `serper` | `manual` |
| `GOOGLE_SERVICE_ACCOUNT_JSON_BASE64` + `GA4_PROPERTY_ID` + `GSC_SITE_URL` | Go GA4/GSC from DEMO → LIVE (see `ANALYTICS_CONNECTORS.md`) | empty |
| `GOOGLE_ADS_ENABLED` + `GOOGLE_ADS_*` | Optional Google Ads connector | `false` |
| `GMAIL_IMPORT_ENABLED` + `GMAIL_*` | Optional admin-only Gmail import | `false` |
| `ALLOW_AUTOMATED_PUBLIC_WEB_RESEARCH` | Master switch for automated fetching | `false` |
| `DEFAULT_REQUESTS_PER_MINUTE` | Conservative crawl rate | `6` |
| `EXPORT_MAX_ROWS` | Export row cap | `100000` |

Secrets are **server-only** and redacted from logs. Never commit `.env`.

## Tests

```bash
npm test            # node --test test/*.test.js
```

Expect the scoring / types / compliance suites to pass; the classification and
export-filter suites guard-skip until those teammate modules land.

## Live deploy is Steve-gated

A **live/production deploy is gated** — do not push this to a public host without Steve's
explicit approval. Local run is unrestricted; going live (DNS, public host, Kamatera,
real credentials, sending to any list) is a human-approval step.