DM Portal App
App:
apps/dm· **Port: 3002 · Audience: Internal digital marketing team and HITL reviewers
The DM Portal is the internal-facing interface for the agency’s own team. Reviewers use it to manage work across all tenants simultaneously — approving agent outputs, intervening in pipelines, raising ad-hoc requests, and monitoring the health of all active campaigns.
Status
| Layer | Status |
|---|---|
| App scaffold, login, sidebar, routing | [Live] |
| Dark / light / system theme toggle | [Live] |
| Topbar (profile, theme, sign-out) | [Live] |
| Sidebar client switcher — mandatory, no “All Tenants” | [Live] |
| Tenant gate — blocks content until client is selected | [Live] |
| Agents screen — real-time Socket.IO monitoring grid | [Live] |
| Users screen — TenantMember-based, owner/reviewer/admin/member roles | [Live] |
Tenant switch audit logging — tenant.switched to MongoDB | [Live] |
| Core review/approval screens | [Unverified] |
| Agent-dependent screens (live monitoring, pipeline control) | [To Build] |
Contents
| Doc | What it covers |
|---|---|
| Screens | All DM Portal screens (P1–P8) — cross-tenant reviewer interface |
| Screen Flows | Navigation flows — overview, approval queues, activity detail, escalation |
| Knowledge Base | What DM reviewers can do — upload/remove docs per tenant, sandbox, retrieved context in activity detail |
Key Screens
| ID | Screen | Route | Status |
|---|---|---|---|
| P1 | Mission Control | /overview | [Live] — stat cards + pending/running lists (max 10 each) |
| P2 | Approvals Queue | /approvals | [Live] — unified blog+social dm_review queue |
| P3 | Activity Detail | /activities/[id] | [To Build] — requires SSE agent infra |
| P4 | Activities | /activities | [Live] — 4-view browser (list/grouped/calendar/kanban) |
| P5 | Reports | /reports | [Unverified] |
| P6 | Agents | /agents | [Live] — real-time Socket.IO monitoring |
| P7 | Users | /users | [Live] — tenant-scoped user list |
| P9 | Context | /context | [Live] — view + revise; no approve |
| P10 | Strategy | /strategy | [Live] — view + status change + revise; no approve |
| P10b | Deliverable Plan | /strategy/deliverable-plan | [Live] — view only; no approve |
| P11 | Goals | /goals | [Live] — goal cards + archived plans link |
| P11b | Archived Goals | /goals/archived | [Live] — archived plan accordion |
| P12 | Deliverables | /deliverables | [Live] — expandable rows + per-item links + period picker |
| P13 | Activity Log | /activity-log | [Live] — 100-entry timeline |
| P14 | Calendar | /calendar | [Live] — react-big-calendar, read-only |
| P20 | Channel Health | /channels/health | [Live] — channel health grid; amber badge when suggestions pending |
| P22 | Channel Detail | /channels/[id] | [Live] — Suggestions tab (default) + Insights tab; full approve/dismiss/execute controls |
Key Behaviours
- Cross-tenant — A reviewer sees all assigned tenants in one queue, not one at a time
- HITL enforcement — No agent output is published without passing through this portal’s approval flow
- Bulk actions — Reviewers can approve/reject multiple items at once
- Live streaming — Activity output streams in real time (SSE) during agent execution
- Rejection feedback — Reviewer notes on a rejection are appended to the agent’s prompt on retry
Tech
- Framework: Next.js 15 (App Router)
- Auth: Cookie-based (
dm_access_token/dm_refresh_token). Calls/auth/v1/loginwithapp: "dm". JWT verified server-side in(dm)/layout.tsx. Roles allowed:reviewer,admin,super_admin. - Theming:
next-themes— Light / Dark / System, three-way cycle toggle in topbar. CSS tokens via Tailwind v4@theme inline. - Real-time: Socket.IO —
agent:eventfor live agent monitoring. SSE planned:GET /dm/v1/activities/:id/stream. - API prefix:
/dm/v1— scope-aware access control viarequireDMAccess(allowsreviewer,admin,super_admin).GET /dm/v1/users— TenantMember-based; per-tenant or all accessible tenantsGET /dm/v1/agents— all activeagentConfigrows (read-only)POST /dm/v1/tenant/switch— validates access + writestenant.switchedaudit logGET /dm/v1/context— client context with status and change log (in calendar.ts)POST /dm/v1/context/revise— trigger context regeneration (enqueuescontext-file-writer)GET /dm/v1/strategy— strategy + versions + change logPOST /dm/v1/strategy/status— change status (draft/pending_review/rejected only)POST /dm/v1/strategy/revise— trigger strategy regeneration (enqueuesstrategy-writer)GET /dm/v1/goals— goals with current-period activity progressGET /dm/v1/goals/archived— archived deliverable plans with their goalsGET /dm/v1/deliverables— templates + per-item Deliverable rows + inProgress countsGET /dm/v1/deliverable-plan— plan with goals, templates, strategyStatusGET /dm/v1/channels/health-summary?tenantId=— channel health overview (includespendingSuggestionsCountper channel)GET /dm/v1/channel-action-items?tenantId=&channelId=— list action items for a channelGET /dm/v1/channel-action-items/channel-info?tenantId=&channelId=— channel metadata + latest insightPOST /dm/v1/channel-action-items/generate— trigger action suggestion generationPATCH /dm/v1/channel-action-items/:id/status— approve / dismiss / donePOST /dm/v1/channel-action-items/:id/execute— execute approved item → Activity + agent queue
- Tenant switching: Sidebar
SidebarTenantSwitcher— mandatory, no “All Tenants” option. “Switch client” label hidden when only 1 tenant. Setsdm_active_tenant+dm_active_tenant_namecookies viaPOST /api/tenant/switch(which calls/dm/v1/tenant/switchfor audit logging). Tenant list fromGET /auth/v1/me/tenants. - Tenant gate: Layout blocks page content if no tenant selected. Auto-selects via
/api/tenant/auto-selectif only 1 tenant. Shows “Select a client to continue” if multiple tenants and none chosen. - Related API doc: api/dm.md