Skip to Content
Apps & PortalsDm PortalDM Portal App

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

LayerStatus
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

DocWhat it covers
ScreensAll DM Portal screens (P1–P8) — cross-tenant reviewer interface
Screen FlowsNavigation flows — overview, approval queues, activity detail, escalation
Knowledge BaseWhat DM reviewers can do — upload/remove docs per tenant, sandbox, retrieved context in activity detail

Key Screens

IDScreenRouteStatus
P1Mission Control/overview[Live] — stat cards + pending/running lists (max 10 each)
P2Approvals Queue/approvals[Live] — unified blog+social dm_review queue
P3Activity Detail/activities/[id][To Build] — requires SSE agent infra
P4Activities/activities[Live] — 4-view browser (list/grouped/calendar/kanban)
P5Reports/reports[Unverified]
P6Agents/agents[Live] — real-time Socket.IO monitoring
P7Users/users[Live] — tenant-scoped user list
P9Context/context[Live] — view + revise; no approve
P10Strategy/strategy[Live] — view + status change + revise; no approve
P10bDeliverable Plan/strategy/deliverable-plan[Live] — view only; no approve
P11Goals/goals[Live] — goal cards + archived plans link
P11bArchived Goals/goals/archived[Live] — archived plan accordion
P12Deliverables/deliverables[Live] — expandable rows + per-item links + period picker
P13Activity Log/activity-log[Live] — 100-entry timeline
P14Calendar/calendar[Live] — react-big-calendar, read-only
P20Channel Health/channels/health[Live] — channel health grid; amber badge when suggestions pending
P22Channel 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/login with app: "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:event for live agent monitoring. SSE planned: GET /dm/v1/activities/:id/stream.
  • API prefix: /dm/v1 — scope-aware access control via requireDMAccess (allows reviewer, admin, super_admin).
    • GET /dm/v1/users — TenantMember-based; per-tenant or all accessible tenants
    • GET /dm/v1/agents — all active agentConfig rows (read-only)
    • POST /dm/v1/tenant/switch — validates access + writes tenant.switched audit log
    • GET /dm/v1/context — client context with status and change log (in calendar.ts)
    • POST /dm/v1/context/revise — trigger context regeneration (enqueues context-file-writer)
    • GET /dm/v1/strategy — strategy + versions + change log
    • POST /dm/v1/strategy/status — change status (draft/pending_review/rejected only)
    • POST /dm/v1/strategy/revise — trigger strategy regeneration (enqueues strategy-writer)
    • GET /dm/v1/goals — goals with current-period activity progress
    • GET /dm/v1/goals/archived — archived deliverable plans with their goals
    • GET /dm/v1/deliverables — templates + per-item Deliverable rows + inProgress counts
    • GET /dm/v1/deliverable-plan — plan with goals, templates, strategyStatus
    • GET /dm/v1/channels/health-summary?tenantId= — channel health overview (includes pendingSuggestionsCount per channel)
    • GET /dm/v1/channel-action-items?tenantId=&channelId= — list action items for a channel
    • GET /dm/v1/channel-action-items/channel-info?tenantId=&channelId= — channel metadata + latest insight
    • POST /dm/v1/channel-action-items/generate — trigger action suggestion generation
    • PATCH /dm/v1/channel-action-items/:id/status — approve / dismiss / done
    • POST /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. Sets dm_active_tenant + dm_active_tenant_name cookies via POST /api/tenant/switch (which calls /dm/v1/tenant/switch for audit logging). Tenant list from GET /auth/v1/me/tenants.
  • Tenant gate: Layout blocks page content if no tenant selected. Auto-selects via /api/tenant/auto-select if only 1 tenant. Shows “Select a client to continue” if multiple tenants and none chosen.
  • Related API doc: api/dm.md

© 2026 Leadmetrics — Internal use only