# Social Command: agency dashboard One web app for the whole social team: - **Clients:** live Instagram and Facebook numbers for every client, with charts, "needs attention" alerts and nightly refresh. - **Run with Claude:** runs the project's skills (`account-audit`, `weekly-plan`, `weekly-report`, custom requests) through the Claude Agent SDK. Claude writes into `clients//` and exports branded PDFs. It never publishes and never writes to Odoo. - **Documents:** preview every audit, report and calendar, and export or download the Metatroncube-branded PDF. Only `*-client` files go to clients. - **Add business:** pick any Facebook Page connected to the agency's Meta account. The dashboard creates the client folder from `clients/_template/`, fills in the handles and can run the first audit. - **Team:** live Odoo Project tasks and per-person workload from workplace.metatroncube.in. You can create tasks when `ODOO_ALLOW_WRITES=true`. It reuses the project as-is: `connector/` (Meta API), `tools/report-pdf/` (PDFs), `.claude/skills/` and `clients/`. ## Run locally (Windows) ```powershell cd dashboard npm install npm run build # builds the web app into web/dist npm run add-user -- you@metatroncube.com "Your Name" admin # prints a password once npm start # http://127.0.0.1:4310 ``` `npm run add-user` stores hashed logins in the project `.env` (`DASHBOARD_USERS`) and creates `DASHBOARD_SECRET`. Roles: - **admin** can add businesses, edit client links and run custom requests. - **member** can view everything and run audits, plans and reports. For UI development, run `npm run dev:server` and `npm run dev:web` in two terminals, then open http://localhost:5173. Other scripts: - `npm run link-clients`: links any client folder without `client.json` to its Meta Page and Odoo project (automatic name matching). ## Deploy on a server (Ubuntu example) 1. Install **Node 20+** and **Google Chrome** (for PDFs): `sudo apt install ./google-chrome-stable_current_amd64.deb`, or set `REPORT_PDF_BROWSER` to Chromium. 2. Copy the whole project folder (not just `dashboard/`). Create `.env` from `.env.example` with: - `META_SYSTEM_USER_TOKEN` - the Odoo settings, using an API key for a Project-only user - `ANTHROPIC_API_KEY` (needed for AI runs on a server) - `DASHBOARD_COOKIE_SECURE=true` - `AGENCY_NAME` 3. Install and start it: ```bash cd tools/report-pdf && npm install && cd ../../dashboard && npm install && npm run build npm run add-user -- you@metatroncube.com "Your Name" admin ``` 4. Keep it running with systemd (`/etc/systemd/system/social-command.service`): ```ini [Unit] Description=Social Command dashboard After=network.target [Service] WorkingDirectory=/srv/social-manager/dashboard ExecStart=/usr/bin/node server/index.js Restart=always User=social Environment=NODE_ENV=production [Install] WantedBy=multi-user.target ``` 5. Put it behind nginx with HTTPS (e.g. `social.metatroncube.in`). Proxy to `127.0.0.1:4310` and set `proxy_read_timeout 300s;`, since PDF export and refreshes can take a while. 6. `.mcp.json` points `odoo-mcp` at a Windows path. On the server, either install the Odoo MCP there and update the path, or leave it: AI runs still work without Odoo tools. ## Data and safety - **Generated data:** snapshots, follower and reach history, and AI-run logs live in `data/dashboard/`, which is git-ignored. - **Secrets** stay in `.env` and are never sent to the browser. - **Access:** every API route needs a signed-in session. Failed logins are rate-limited, and document paths are confined to the client's folder. - **AI runs** use a tool allow-list: - they can read files and use the read-only Meta and Odoo tools - they can only write in `clients/`, `team/` and `reports/` - the only command they can run is the PDF builder - publishing tools are blocked - **Cost:** each AI run shows its cost on the run page. An account audit is typically a few dollars. ## Reselling to other agencies This is a one-time setup: - Swap `branding/` (logo files, `report.css` colours) and set `AGENCY_NAME`. - Point `.env` at their Meta system user, Odoo instance and Anthropic key. - Keep `THIRD_PARTY_SKILLS.md` (licence notices for imported skills).