DEV Community

静亭雅苑
静亭雅苑

Posted on

Designing Public Support Records Without Leaking Private Data

Designing Public Support Records Without Leaking Private Data

A public support ledger can build trust. It shows that real readers chose to support the site, and it gives new readers a sense of who the audience is. But a ledger is also a privacy surface. The same row that makes a site feel human can expose an email address, a transaction reference, or a membership decision that should never be public.

On wuhuajin.com, I added a small support ledger to the subscription page. The design went through several revisions, mostly driven by one question: what does a reader actually need to see, and what is only useful to the site owner?

This article describes the field choices, the API boundary, and the display-name rules I settled on.


Start with the public purpose

A public support record has three legitimate purposes:

  1. Social proof: someone supported the site.
  2. Transparency: the site is not hiding its support activity.
  3. Recognition: a reader can choose to be thanked by name.

It does not need to serve:

  • payment reconciliation;
  • fraud investigation;
  • membership administration;
  • tax or accounting;
  • customer support.

Those are internal jobs. Mixing them into the public table is how private data leaks.

So the public record is a separate, deliberately small projection of the internal payment record. The internal record can be richer; the public DTO is not.


The five public fields

The public table shows:

Field Example Why it is public
Display name 用户4821 or a chosen nickname Recognition without exposing an account
Amount 5 or 100 Social proof and transparency
Payment method 微信 / 支付宝 Context for the amount
Date 2026-07-23 Freshness and ordering
Note 加油,继续写 A human message, after moderation

That is it. No email, no transaction ID, no membership expiry, no internal decision note, no reviewer name.

The date is stored as a date, not a timestamp. A precise timestamp adds little to a public ledger and can be correlated with other activity. The display uses the site’s local date.

The amount is shown exactly. For this site, the amounts are small and the ledger is meant to be transparent. If the site ever accepts large or sensitive payments, the display should switch to a range or a “supporter” label instead of an exact number.

The payment method is limited to a small enum. It never includes an account name, a card brand, a bank, or a transaction reference.


The fields that stay private

The internal application record contains more:

  • email address;
  • transaction reference or order ID;
  • payment evidence, if any;
  • reviewer identity;
  • decision note;
  • membership start and expiry;
  • risk flags and duplicate status.

None of these belong in the public response.

The most important one is the transaction reference. It is not a password, but it is a unique identifier that can be used to look up a payment, challenge a refund, or correlate a reader across systems. It should be treated as private by default.

Email is the second. Even if the local part looks harmless, it is a persistent identifier. It should never be used to generate a display name.

Membership expiry is the third. A public “member until 2027-01-01” row tells everyone something about a reader’s purchase history. The reader can see their own expiry after signing in; the public ledger does not need it.


Display names: do not derive from email

The first version of the form used the part before the @ sign as a fallback display name. It seemed convenient, but that leaks part of the email address, and it can accidentally expose a real name or a workplace.

The revised rule is:

  1. If the reader provides a display name, use it after basic moderation.
  2. If the reader leaves it empty, generate a neutral label such as 用户4821.
  3. If the reader explicitly asks to be anonymous, use 支持者 or 用户, not a random identifier that implies a specific person.

The random label is not tied to the email hash. It is a short random suffix generated at display time and stored with the public record. It gives the row a stable identity without revealing the account.

The label 用户 is intentionally generic. It says “a user supported the site” without implying a name, a location, or a relationship. 支持者 is slightly warmer and works well for a one-off tip.

The rule also applies to old records: if a row has no display name, the API returns a generated label, not an email prefix.


The form: do not ask for consent you do not need

The earlier form included a sentence asking the reader to agree that the site would publish their nickname, amount, payment method, date, and note. That sentence was removed.

The reason is simple: if those fields are genuinely non-sensitive and necessary for the public ledger, the site should explain them in the privacy policy and minimize them, not turn the form into a consent ceremony. A checkbox that everyone clicks without reading does not create meaningful consent.

What the form does need is:

  • a short explanation of what will appear in the public ledger;
  • a link to the privacy policy;
  • a separate optional checkbox for “I want to apply for membership” (a product action, not a data-publication consent);
  • a note field with a clear character limit.

The privacy policy carries the detailed disclosure. The form carries the immediate expectation.

This is a small but important distinction: consent is for optional or sensitive processing; transparency is for expected, minimized public data.


The note field

The note is the only free-text field in the public record. It is also the highest-risk field, because readers can type anything.

The API applies four rules:

  1. Length limit: a short maximum, such as 80 characters.
  2. Plain text only: no HTML, no links, no Markdown rendering.
  3. PII redaction: remove email addresses, phone numbers, and long digit strings that look like transaction IDs.
  4. Moderation: the admin can hide a note without deleting the payment record.

The note is combined with the old “public message” field. There is no separate public message and private payment note in the current form. One field, one purpose: a short message that may appear in the ledger.

If a reader needs to send a private message, the form links to the contact page instead. That keeps the public field public and the private channel private.


The API boundary

The public endpoint returns a sanitized DTO, not a database row:

{
  "name": "用户4821",
  "amount": 5,
  "method": "微信",
  "date": "2026-07-23",
  "note": "加油"
}
Enter fullscreen mode Exit fullscreen mode

The implementation uses an explicit mapper:

function toPublicRecord(row) {
  return {
    name: publicName(row),
    amount: row.amount,
    method: row.method,
    date: row.paid_at.slice(0, 10),
    note: sanitizeNote(row.note),
  };
}
Enter fullscreen mode Exit fullscreen mode

It does not use SELECT * and then delete fields in the response. An allowlist mapper is easier to audit: if a new private column is added to the table, it does not automatically appear in the API.

The admin endpoint is separate and requires authentication. It returns the full record, including email and transaction reference. The two endpoints do not share a serializer.

A useful test is to assert that the public JSON never contains the private keys:

expect(Object.keys(publicRecord)).toEqual([
  'name', 'amount', 'method', 'date', 'note'
]);
Enter fullscreen mode Exit fullscreen mode

That test catches accidental field additions better than a visual review.


Ordering and pagination

The public ledger is ordered by date descending, then by ID descending. The ID is not exposed; it is only used to make the order stable when two records share a date.

Pagination is cursor-based on (date, id), not offset-based. Offset pagination on a frequently updated table can skip or duplicate rows when a new record arrives between requests.

The public response includes a nextCursor that encodes the last date and ID. The cursor is opaque and signed, so a client cannot use it to probe internal IDs.


Test data and empty states

A public ledger with test rows is worse than no ledger. The test rows look real, they pollute the social proof, and they may contain names or addresses that were never meant to be public.

The release checklist includes a query for known test patterns:

SELECT id, email, amount, method, note
FROM support_records
WHERE email LIKE '%test%'
   OR note LIKE '%test%'
   OR display_name IN ('测试', 'test');
Enter fullscreen mode Exit fullscreen mode

The result must be reviewed before launch. Deleting a row is a decision; the important part is to verify the public endpoint after cleanup, not just assume the script worked.

An empty state is also useful:

No public support records yet.

It is honest, and it avoids filling the table with fake rows to make the page look active.


What I would change next

  • Add a “hide my record” request path. A reader should be able to ask for removal without editing the payment record.
  • Separate the public projection into its own table. The current mapper is safe, but a materialized public table would make the boundary even clearer.
  • Add a moderation queue for notes. Right now the admin hides a note manually. A small queue with approve/hide actions would scale better.
  • Add an aggregate view. A “supporters this month” count is often more useful than a long list, and it exposes less.

The lesson

A public support ledger is a product surface, not a database view. The design should start from the smallest set of fields that serves the public purpose, then enforce that boundary in the API.

The rules that mattered most:

  • never derive a display name from an email address;
  • keep transaction references and membership expiry private;
  • use an allowlist serializer, not a redacted row;
  • make the note plain text and moderated;
  • do not turn expected public data into a consent checkbox;
  • verify the public endpoint after test-data cleanup.

Those rules make the ledger useful without making it a privacy problem.


This article describes the public support ledger on wuhuajin.com. The ledger shows display name, amount, payment method, date, and an optional note; email addresses and transaction references remain private.


Originally published on wuhuajin.com.

Top comments (0)