Skip to main content

Customer Portal — Domain Model

Status: populated Owner: Product Engineering (Frontend) Last updated: 2026-04-18

1. Overview

The customer-portal is a stateless frontend. It has no persistent domain entities of its own. The domain objects described here are view-layer representations — shaped from API responses for rendering purposes.

2. View Models

AuthSession

Held in Next.js server-side session cookie (encrypted). Never exposed to client JS.

FieldTypeSource
userIdstringJWT sub
accountIdstringJWT claim account_id
emailstringJWT claim email
rolesstring[]JWT claim roles (should include customer)
accessTokenstringPlatform JWT
expiresAtISO8601JWT exp

ApiKeyListItem

FieldTypeNotes
keyIdstringULID key_*
namestringUser-supplied label
scopesstring[]sms:send, sms:read, billing:read
statusactive | revoked
lastUsedAtISO8601 | null
createdAtISO8601

ApiKeyCreated

FieldTypeNotes
keyIdstring
rawKeystringShown once; never stored
scopesstring[]
createdAtISO8601

MessageLogEntry

FieldTypeNotes
messageIdstringULID
tostringE.164
fromstringSender ID
bodystring
statusqueued | sent | delivered | failed
submittedAtISO8601
deliveredAtISO8601 | null
operatorNamestring | null
errorCodestring | null

WebhookConfig

FieldTypeNotes
webhookIdstring
urlstringHTTPS only
eventsstring[]
signingSecretstring | nullShown once at creation
statusactive | disabled
createdAtISO8601

Invoice

FieldTypeNotes
invoiceIdstring
periodStartISO8601
periodEndISO8601
totalMessagesnumber
amountDuestringPre-formatted currency string
statuspaid | open | overdue
pdfUrlstring | nullPre-signed URL

UsageSummary

FieldTypeNotes
currentPeriodStartISO8601
messagesSentnumber
messagesDeliverednumber
deliveryRatenumber0–1 float
creditBalancestringCurrency-formatted

3. UI State (client-side only)

StateLocationPurpose
newKeyModal open/closed/api-keys pageControls key creation modal
rawKeyValue/api-keys pageHeld in state; cleared on modal close
messageFiltersURL search paramsDate range, status, to/from inputs
testSmsForm/send-test pagereact-hook-form field values