Skip to main content
Customers sign up, open support tickets, see their invoices, and read published help articles. They never see each other’s data.
1

Collections

  • customers: email (unique, email format), full_name, company
  • tickets: subject (required), body (Long Text), status (Select: open, pending, closed), priority (Select)
  • invoices: number, amount (Number), due_date (Date), paid (Boolean)
  • articles: title, content (Text Editor), status (Select: draft, published)
Relations: customers → tickets (one_to_many), customers → invoices (one_to_many).
2

Guard

Guard customers on the customers collection, login field email, registration on. Optionally turn on email verification.
3

Permissions for the default user role

4

Row policies

5

Protect sensitive fields

Add a beforeUpdate hook on tickets that rejects changes to priority from customers, and one on customers that blocks changes to email if you don’t want customers changing their login.
6

Notify support

afterInsert hook on tickets that emails your support inbox with ctx.Msg().Send(...).
7

Frontend

Create an end_users key with your portal’s origin. Pages: sign-up, login, my tickets, new ticket, my invoices, help center.

Test isolation

  1. Register two customers, A and B.
  2. As A, create a ticket. As B, list tickets: A’s ticket must not appear.
  3. As B, GET /collections/tickets/{A's ticket id}: expect 404.
  4. As B, PUT the same ID: expect 404.
Run this test whenever you change roles or policies.