Skip to content

Phase 7 — Customer Dashboard (`apps/dashboard`)

Goal: every customer screen in the build inventory (1–36), on the decided frontend stack, against the staging APIs.

Done when: every screen works end to end in staging, the Playwright suite for sign-up → key and top-up → balance passes after every staging deploy, and the wording rule holds everywhere.

Lane B: P7.01 and P7.02 can start once phase 1’s shared types exist. Every later task needs its APIs from phases 5 and 6. Build against mocks if the API isn’t ready, but a task is only done against staging.

Stack (decided; ../architecture/tech-stack.md Dashboard Frontend):

  • UI: shadcn/ui on Tailwind, with generic primitives in packages/ui-web (with Storybook) and app-bound components in apps/dashboard/src/components/
  • Data and state: TanStack Router and Query, Zustand, axios
  • Tests: Vitest with React Testing Library, and Playwright
  • Brand: ../product/design-system/
ID Task Who Needs Status
P7.01 ui-web components Agent — merged — through the integration branch, code #65 (#14 closed)
P7.02 App shell and states (34–36) Agent P7.01, P1.09 merged — through the integration branch, code #65 (#20 closed)
P7.03 Auth screens (1–4, 7) Agent P7.02, P5.01, P5.05, P5.06 merged — 1–4 code #1; 7 through the integration branch, code #65 (#29 closed)
P7.04 Onboarding (5–6) Agent P7.03, P5.07 merged — through the integration branch, code #65 (#29 closed)
P7.05 Overview (8) Agent P7.02, P5.08 merged — through the integration branch, code #65 (#25 closed); API code #31
P7.06 Usage (9) Agent P7.02, P5.08 merged — through the integration branch, code #65 (#26 closed); API code #32
P7.07 Request logs (10–11) Agent P7.02, P5.08, P5.09 merged — through the integration branch, code #65 (#26 closed); API code #32
P7.08 API keys (12–15) Agent P7.02, P5.07 merged — through the integration branch, code #65 (#25 closed); API code #31
P7.09 Billing (16–21, no 18) Agent P7.02, P6.04, P6.07 merged — through the integration branch, code #65 (#27 closed); API code #32. The checkout iframe (code #55) is superseded by the direct collections API (decisions log, Top-ups through Niobi’s direct collections API); the top-up screen changes in phase 6. Exact fees and amounts code #95, code #97; billing history from the daily rollup code #98
P7.10 Workspaces (22–25) Agent P7.02, P5.04 merged — through the integration branch, code #65 (#28 closed); API code #33
P7.11 Team (26–28) Agent P7.02, P5.05 merged — through the integration branch, code #65 (#28 closed); API code #33
P7.12 Settings (29–33) Agent P7.02, P5.02, P5.06, P5.10 merged — through the integration branch, code #65 (#29 closed); API code #32
P7.13 View-as banner Agent P7.02, P5.12 merged — code #43
P7.14 Wording, accessibility and end-to-end tests Agent P7.03–P7.13 in part — code #47 merged (wording guard, accessibility pass, Playwright on the mock). Left: sign-up and a charged call against staging, and running after each staging deploy and nightly

Who: Agent · Needs: —

Add the generic primitives the screens need, each with Storybook stories and themed from the brand tokens:

  • form inputs, select, checkbox, switch
  • table with column chooser
  • side drawer, dialog, toast
  • tabs, skeleton, empty state
  • date range picker, chart wrapper

Charts follow one consistent visual system.

Who: Agent · Needs: P7.01, P1.09

  • Routing: TanStack Router with org and workspace ids in every route.
  • Switchers: the org switcher and the workspace switcher (showing each workspace’s currency).
  • Navigation: sidebar plus the docs link.
  • API layer: an axios client with the session cookie and CSRF-safe defaults; TanStack Query setup.
  • States: 404, no-access, and empty states with a call to action.
  • Spec: ../product/build-inventory.md screens 34–36, Org and workspace in the URL, API docs links
  • Done when: switching org or workspace keeps you on the same screen, and a Member following a link to a workspace they can’t see gets no-access, not an error.

Who: Agent · Needs: P7.02, P5.01, P5.05, P5.06

  • Sign-up: email and password with a live password check, Google, GitHub and GitLab, Turnstile, and one consent checkbox. It does not save prompts and responses unless the customer opts in later under Data & privacy (backlog #17).
  • Sign-in: highlights the last method used, and asks for two-factor or a passkey when on.
  • Other screens: reset password, verify email (editable address, resend countdown), accept invitation.
  • Spec: ../product/build-inventory.md screens 1–4 and 7; ../product/dashboard-scope.md Auth; backlog #17
  • Done when: each flow works in staging, and the content-saving notice is visible before the account is created.

Who: Agent · Needs: P7.03, P5.07

  • Choose models and currency: the default models pre-checked, and the currency preselected from the user’s country. One click accepts.
  • Your API key: the key shown once, a copy button, and the sample curl (the same snippet as the docs quickstart). Then land on Overview.
  • Spec: ../product/build-inventory.md screens 5–6; ../product/dashboard-scope.md Onboarding
  • Done when: a new user goes from sign-up to a working curl in under a minute in staging, and the key exists only in memory (auth-security.md R5).

Who: Agent · Needs: P7.02, P5.08

The workspace balance, last-24-hour spend and requests, alerts, the quickstart curl, a docs link and an “Add credits” button.

  • Spec: ../product/build-inventory.md screen 8
  • Done when: the numbers match the API, and a low-balance alert appears when the balance is under the threshold.

Who: Agent · Needs: P7.02, P5.08

  • Chart: spend, requests and tokens, with a date range and timezone.
  • Breakdown: by model, provider, key and member.
  • Scope toggle: this workspace or all workspaces. Different currencies are never added together.
  • Freshness: an “as of a few minutes ago” note.
  • Spec: ../product/build-inventory.md screen 9; ../product/dashboard-scope.md Usage Analytics
  • Done when: the all-workspaces view with two currencies shows them separately.

Who: Agent · Needs: P7.02, P5.08, P5.09

  • Table: time, model, status, latency, tokens, cost in credits, key and member.
  • Filters and columns: filters for each field, and a column chooser.
  • Detail drawer: the full record. It shows stored content only to Owners and Admins, and never during view-as.
  • Spec: ../product/build-inventory.md screens 10–11; ../product/dashboard-scope.md Request Logs
  • Done when: filters map to time-bounded queries, and a Member sees no content control.

Who: Agent · Needs: P7.02, P5.07

  • Key list.
  • Create: name, owner, expiry, spend cap and reset period, and models. It nudges the user to set a cap.
  • Reveal: shown once, and the user must confirm it’s saved.
  • Detail drawer: edit, rotate and revoke, with confirmation.
  • Spec: ../product/build-inventory.md screens 12–15; ../architecture/api-key-security.md section 4
  • Done when: rotate shows the new key once and the old key fails immediately (checked against staging), and the full key never reaches browser storage.

Who: Agent · Needs: P7.02, P6.04, P6.06, P6.07

  • Balance (16): with active holds.
  • Top-up (17): credits, fee and total; pending, success and failed states.
  • Screen 18 is removed: moving credits is a support request (decisions log, Credit moves are support-only).
  • Transactions (19).
  • Rates (20): this workspace’s currency, with the API reference link.
  • Billing details (21): required before the first top-up.
  • Spec: ../product/build-inventory.md screens 16–21, Wording rule
  • Done when: a mock top-up in staging moves the balance, and no balance shows a currency symbol.

Who: Agent · Needs: P7.02, P5.04

  • List: no cross-workspace total.
  • Create: name, currency, members.
  • Settings: currency read-only once funded; delete only after the balance is moved out, and never the last workspace.
  • Members.
  • Spec: ../product/build-inventory.md screens 22–25
  • Done when: each rule is enforced in the UI and by the API.

Who: Agent · Needs: P7.02, P5.05

Members, invitations (resend and revoke), change role, and the remove-member dialog (revoke or reassign their keys).

Who: Agent · Needs: P7.02, P5.02, P5.06, P5.10

  • Profile.
  • Security: password, linked logins, passkeys, two-factor with backup codes, sessions, and log out everywhere.
  • Organization: name, transfer ownership, delete.
  • Data & privacy: the content-logging toggle for the current workspace.
  • Notifications: low-balance threshold and email.
  • Spec: ../product/build-inventory.md screens 29–33
  • Done when: each setting works against staging, and the content toggle change appears in the audit log.

Who: Agent · Needs: P7.02, P5.12

While staff are viewing as a customer: a persistent “Viewing as” banner with an exit button, and every write control disabled. The API already refuses writes, so the UI only has to make that clear.

  • Spec: ../product/build-inventory.md View as customer
  • Done when: the banner shows for the whole session, and a write attempt is visibly blocked.

P7.14 — Wording, accessibility and end-to-end tests

Section titled “P7.14 — Wording, accessibility and end-to-end tests”

Who: Agent · Needs: P7.03–P7.13

  • Wording pass: credits are never money. No “wallet”, no “cash”, no currency symbol on a balance; currency appears only on the top-up amount and the workspace’s currency label.
  • Accessibility: a basic pass on keyboard, labels and contrast.
  • Playwright:
    • sign-up → onboarding → key → call
    • top-up → balance → charged call
    • run after every staging deploy and nightly
  • Spec: ../product/build-inventory.md Wording rule; ../architecture/cicd.md section 2
  • Done when: the Playwright suites pass in the pipeline, and a text search finds no forbidden money wording in customer-facing strings.