← back to Marketing Command Center
README.md
57 lines
# Marketing Command Center
Modular marketing dashboard for Designer Wallcoverings. Express shell mounts
self-contained modules; basic-auth gated; deploys to Kamatera.
## Run
```
npm install && PORT=9661 npm start # http://127.0.0.1:9661 (admin / DWMarketing2026!)
```
## MODULE CONTRACT ← every module builder MUST follow this exactly
A module is **fully self-contained** in three files. Build ONLY these — never
touch `server.js`, `public/app.js`, `public/index.html`, or another module's files.
1. **`modules/<id>/index.js`** — exports:
```js
module.exports = {
id: '<id>', // url-safe, matches the registry entry
title: 'Human Title',
icon: '📣', // one emoji for the nav
mount(router) { // express.Router(), mounted at /api/<id>
router.get('/things', (req,res) => res.json({ ... }));
router.post('/draft', express.json? ) // body is already JSON-parsed by the shell
},
};
```
- Keep all state/data under `data/<id>-*.json` or a `data/` file you own.
- Secrets come from `process.env` (see `.env.example`); NEVER hardcode keys.
- If a required key is missing, run in **mock mode** and return real-shaped
mock data with `{ mock: true }` so the panel still works. Do not crash.
2. **`public/panels/<id>.html`** — the panel markup (no `<html>`/`<head>`; just the
inner content). Use the shared CSS primitives in `public/style.css`
(`.card`, `.btn`, `.btn.gated`, `.pill`, `.grid`, `.row`, `label`, `.muted-banner`).
3. **`public/panels/<id>.js`** — registers an initializer:
```js
window.MCC_PANELS = window.MCC_PANELS || {};
window.MCC_PANELS['<id>'] = { init(root){ /* fetch /api/<id>/..., render into root */ } };
```
## Conventions
- **Gated actions** (anything that SENDS or SCHEDULES to the outside world —
Constant Contact campaign sends, etc.) must: (a) be a distinct endpoint,
(b) require an explicit confirm in the UI, (c) default to **dry-run/draft**,
(d) check CAN-SPAM fields (physical address + unsubscribe) before allowing a send,
(e) never auto-send. Style gated buttons with `.btn.gated`.
- **Brand voice** for any generated copy/layout: `require('../../lib/brand.js')`.
- Money/identity/customer-facing = staged + Steve-approved, never autonomous.
## Modules (registry.js)
- `constant-contact` — campaigns, contacts, lists, calendar; draft + schedule (gated sends)
- `calendar` — marketing calendar: retail/holiday/awareness dates + campaign schedule
- `copy` — suggested copy: subject lines, email + social body (LLM-backed, brand voice)
- `layouts` — on-demand HTML/CSS email + social layout mockups