Skip to content

Admin panel ​

The admin SPA (@aw-chat/admin) is for operators and content authors. It talks to the same @aw-chat/server over /admin/* (and uses /files/ for media). End users never see this UI.

Deploy ​

  1. Bootstrap a super-admin against the production database:

    bash
    pnpm --filter @aw-chat/server admin:create <username> <password> [email]
  2. Build and host the SPA:

    • Docker (recommended): API_ORIGIN=<api-hostname> required; leave VITE_API_BASE empty so nginx same-origin-proxies /admin/* and /files/*.
    • Same-origin static: empty VITE_API_BASE, serve dist from the API host.
    • Separate origin: VITE_API_BASE=<api public URL> + add admin origin to CORS_ORIGINS (and widen CSP connect-src).

Docker: apps/admin/Dockerfile (nginx). See Deployment.

Auth ​

  • Credentials live in Postgres admin_users (scrypt). Env ADMIN_USER / ADMIN_PASS are ignored.
  • Login sets a revocable HttpOnly/Secure/SameSite HMAC session cookie (ADMIN_SESSION_SECRET, default TTL 1h, hard maximum 8h).
  • Only a non-secret UI marker is kept in sessionStorage; logout revokes the server-side session immediately.
  • Failed logins are limited per account and per client IP. Set TRUST_PROXY_HOPS to the exact production reverse-proxy count.

Permissions ​

PermissionGates
manage_postsChannel posts, media, schedule/publish
manage_reasonsComplaint / CSAT / request topic lists
view_logsAdmin audit log
view_feedbackCSAT + complaints tables
manage_usersCreate / edit / deactivate admins
moderate_commentsComment queue, hide/delete, mute/ban

Super-admins (is_super) implicitly have every permission. The last active super-admin cannot be removed or demoted.

Main surfaces ​

AreaPurpose
Posts / editorAuthor channel posts (rich text, media, buttons, comments toggle)
StatisticsChannel engagement charts (STATS_TZ buckets hours)
ReasonsNested request topics + flat complaint/CSAT labels
CSAT / ComplaintsRatings and formal complaints from the SDK
CommentsModeration queue (reported / filtered / hidden / deleted)
Comment bans / moderatorsPer-channel mute/ban; assign in-feed moderators
UsersAdmin account management
LogsAudit trail (admin_logs)

Channel vs Intercom ​

Admins do not run the Intercom inbox inside this SPA. Support conversations and tickets are handled in Intercom. This panel owns channel content, CSAT / complaints, reasons, comment moderation, and admin IAM.

Data residency: Data model.

AW Chat SDK — integration & platform handoff docs.