Files
SlpSoftware/aidlc-docs/features/redesign-modern-timetravel/inception/application-design/contact-api-contract.md
T
SluijsensandClaude Sonnet 5.5 0854e3a096 Thema-fundament: variant (B/E) x modus (licht/donker), tijdreis-knop en overgang
Vervangt rood/paars door tokens per variant en modus, voegt ModeToggle en
icoon-knop VariantToggle toe, VariantRenderer met lazy E-chunk, dither-overgang
(uit bij minder beweging), theme-init.js tegen themaflits en tests.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-09 21:14:11 +01:00

28 KiB
Raw Blame History

Contact Form & Offerings — Draft API Contract

Version: 0.3.1-draft (2026-11-09) — incorporates the reviews of SLS Software - CMS (API side), CMS & API (ASF website) and AndreaSlopFotografie (ASF CMS/hosting) and the product decisions of Bryan (admin view in scope, spam stored as spam, captcha fail-open). Status: DRAFT for confirmation by the builders. Product decisions still open are marked [Bryan] (see § 10). Source of truth once agreed: the OpenAPI document generated by the CMS (AddOpenApi/MapOpenApi), exported as a committed artifact in SlpModularCms so cms-client can generate types from it. This file carries the behaviour agreements and the intended shape. Compatibility: breaking changes → /api/v2; additive changes allowed within /api/v1. The frontend package cms-client follows semver.

1. Scope

  1. New Contact/Forms module (own DbContext + additive migration per host, own Module class, like Modules.Offerings): token endpoint, submit endpoint, admin endpoints, background jobs.
  2. GET /api/v1/offerings gains the optional field category.
  3. Per-site configuration (host-based: Api.SlpSoftware, Api.AndreaSlopFotografie, ...).

All paths are same-origin (/api/v1/...) through "the reverse proxy of the host" (nginx for SLP; ASF production will be IIS — do not hard-code nginx). No CORS. The site id is derived from the host/config, never from the request body.

Availability gate — decided (Bryan, 2026-11-09): the statuses (CMS disabled / maintenance, set by the master) block only the CMS, i.e. changing data and settings through the admin. Public content is always available. The gate therefore applies to admin/CMS routes only; the public routes GET /api/v1/offerings, GET /api/v1/contact-messages/token and POST /api/v1/contact-messages must stay reachable (a visitor's contact request is public site functionality, not a CMS change). Today AvailabilityMiddleware returns 503 for everything under /api/ (bypass list limited); the CMS must align this with the decision (public routes on the bypass list or gate limited to admin routes), and the bypass must never cover admin routes. The frontend still treats 503/network errors as a failure with the mailto fallback as a safety net.

2. Public endpoints

2.1 GET /api/v1/contact-messages/token

Issues a server-signed token used for the minimum-time check, bound to the site. Tokens use ASP.NET DataProtection (key ring in the DB survives deploys), not a custom HMAC secret. The key ring must be persistent per host (DB or shared directory; on IIS it must survive app-pool recycles) and use a per-site purpose string, so an SLP token is invalid on ASF. (Already covered by the host-level AddCmsDataProtection, keys in the database; Contact only uses an IDataProtector with purpose SlpModularCms.Contact.Token.{siteId}; no own key ring or table.)

200 application/json

{ "token": "<opaque signed string>", "minSeconds": 3, "captcha": null }
  • captcha is null when disabled, else { "provider": "friendlycaptcha", "siteKey": "..." }.
  • Token carries issue time + site id; valid for e.g. 120 minutes. Not stored.
  • Rate-limited; 429 with Retry-After.
  • The client fetches the token lazily after hydration, on first focus/interaction, not on page load (prerender contains no token; crawlers do not use up the limit).

2.2 POST /api/v1/contact-messages

Headers: Content-Type: application/json, Idempotency-Key: <uuid> (required).

Request body:

{
  "name": "Jan Jansen",
  "email": "jan@example.nl",
  "subject": "website",
  "message": "Ik wil graag een offerte voor …",
  "hpCheck": "",
  "token": "<from 2.1>",
  "captchaToken": null
}
Field Type Required Rules
name string yes trimmed, 1–100 chars; control characters rejected
email string yes trimmed, 1–254 chars, regex ^[^\s@]+@[^\s@]+\.[^\s@]{2,}$, no control characters
subject string yes trimmed, 1–100 chars; opaque value chosen by the site (a package id, slug, or other); no slug regex; stored as given, never validated against offerings. The label of other is per site (ASF: "Overig").
message string yes trimmed, 1–2000 chars
hpCheck string no (a missing key counts as empty; CMS-U3) honeypot; must be empty. The JSON name is fixed hpCheck; the DOM name/id in the site is free. Deliberately implausible name (not website/url) to avoid password-manager autofill; render with autocomplete="off", tabindex="-1", aria-hidden, off-screen
token string yes from 2.1
captchaToken string | null when captcha enabled verified server-side

Responses:

  • 202 Accepted — { "status": "received" }. Identical body and status for genuine and spam submissions (honeypot filled, token too young, captcha failed) so bots learn nothing. Replays with the same Idempotency-Key (24 h) return the same 202 without storing twice.
  • 400 application/problem+json — validation errors (§ 3): field validation; expired, forged or other-site token (all answered as errors.token: ["expired"], so the endpoint is no oracle; the client fetches a fresh token and retries once automatically); missing or non-UUID Idempotency-Key (errors.idempotencyKey: ["required" | "invalid"]).
  • 413 application/problem+json — body too large (MaxRequestBodySize per endpoint, e.g. 16 KB, with our own ProblemDetails shape).
  • 429 application/problem+json — rate limit; header Retry-After: <seconds> (the existing OnRejected sets neither body nor Retry-After yet). This is a separate, first-executed CMS unit: it changes the behaviour of existing policies (login/refresh/sentry-tunnel), the admin frontend must cope with it and PipelineTests need adjusting. Retry-After comes from MetadataName.RetryAfter (available for fixed/sliding window limiters).
  • 503 — should not occur for the public routes (see § 1); if it does (e.g. host down behind the proxy), the client shows the mailto fallback.
  • 5xx application/problem+json — generic; no internal detail.

3. Error shape (ProblemDetails)

{
  "type": "about:blank",
  "title": "Validation failed",
  "status": 400,
  "errors": { "name": ["required"], "email": ["invalid"], "message": ["tooLong"] }
}

The type URI is configurable per host (Contact:ProblemTypeBase), default about:blank, so no site domain is hard-coded in a module used by two sites; clients map on errors, never on type. Codes: required, tooLong, invalid, expired (token only; also for forged/other-site tokens). A body that cannot be bound (broken JSON, wrong types) answers 400 with errors.body = ["invalid"] in the same problem shape, without echoing values (implemented in CMS-U3). The errors mapping is custom (not the default ASP.NET ValidationProblemDetails). Messages are not localized by the API; the client maps messages[field][code]. Client-side validation uses the same limits and codes.

4. Server behaviour agreements

  1. Store first, mail after commit. Validate → store and commit (status: new, mailStatus: pending) → respond 202. Mail is not fire-and-forget in the request scope: a BackgroundService/queue picks up pending rows, sends via IEmailSender/IMailAvailability (returns MailSendResult, does not throw) and updates mailStatus and mailAttempts. A short sweep (every few minutes) catches pending rows left by a crash; failed rows are retried with backoff up to a configurable max attempts (so a first outage does not mean 24 h delay). A mail failure never fails the request. If Email:Smtp:Host is not configured: store only, show a notice in the admin.
  2. Stored entity ContactMessage: id (GUID), siteId, receivedAt, name, email, subject, message, status (new | read | archived | spam [Bryan] | later converted), mailStatus (pending | sent | failed + the existing error code, e.g. auth_failed, rejected_sender, timeout_*), mailAttempts, retentionUntil (fixed per row at insert; a config change does not apply retroactively). id and status exist so a message can later become an assignment for quotes/invoices (not built now). No IP address is stored.
  3. Retention: per site, default 12 months; a daily BackgroundService (pattern: IntegrityCheckBackgroundService) deletes messages with retentionUntil < now and idempotency records older than 24 h. Database backups may keep messages longer: mention in the privacy statement or shorten backup retention. The admin can delete a single message (right to erasure).
  4. Spam (captcha behind an ICaptchaVerifier interface with a Null implementation when disabled): honeypot must be empty; elapsed time since token issue ≥ minSeconds; optional captcha verified server-side; rate limit policy ContactForm (defaults, config RateLimiting:ContactForm: 5 submissions per 10 minutes per client IP; token endpoint 20 per 10 minutes). Spam is answered with the normal 202. Decided (Bryan): instead of discarding, honeypot/too-young submissions are stored with status: spam (never mailed, retention 30 days) so a real visitor who tripped the check (autofill, very fast typist) is not lost silently; the visitor still sees the normal thank-you. Cap on spam rows (suggestion of AndreaSlopFotografie and SLS Software - CMS): per site at most N spam rows per day (default e.g. 200; Contact:MaxSpamRowsPerDay); above N the submission still gets the normal 202 but is only counted and logged, not stored. Spam rows are excluded from the unread counter and hidden from the default admin list (separate filter), so spam content is never shown first. Spam rows are stored with retentionUntil = receivedAt + 30 days, so the retention job works on each row's own retentionUntil. Timing: spam may be slightly faster (skips mail); accepted consciously. Captcha provider failure (timeout/5xx of the verify endpoint): decided fail-open with a log entry. Captcha ships disabled (honeypot + time + rate limit); it is a per-site switch for when abuse appears.
  5. Client IP: release prerequisite — on CMS master (d9cc539) the rate-limit policies are plain global buckets; the per-client partitioning (ClientPartitionKey) and ForwardedHeaders exist only on the unmerged ASF branch feature/identity-email-notifications. A ContactForm policy of 5 per 10 minutes as a global bucket would block the whole site after five submissions, so the contact routes must not be enabled on a public host before the per-client partitioning is on the base branch. The rate limit needs ForwardedHeaders:KnownProxies on each host (set on the test hosts; ASF production on IIS will differ), otherwise all visitors share one bucket (5 per 10 minutes for the whole site).
  6. Privacy / logging: never log name, email, message or the request body for this route; the Sentry SDK request body/PII is explicitly off for it (BeforeSend scrubbing; extra rule in the existing SecurityEventProcessor; a test proves a logged exception holds no body); client side: no form fields in Sentry breadcrumbs or replay (masked). Log only status codes, site id and outcome. Configuration errors of the mail setup are logged as Error (so the Sentry rule fires) in the style of identity_mail_failed, without addresses or content.
  7. Idempotency: table (key, siteId, createdAt, statusCode; no request content, no PII), unique index, cleaned after 24 h by the retention job; in-memory is not enough. Spam submissions also get a key record so replay behaviour is identical. Same key → same response, no second row, no second mail.
  8. Mail safety: From = fixed site sender on Email:AllowedFromAddresses; Reply-To = visitor e-mail (never as From: SPF/DMARC). Reject/strip control characters (EmailAddressRules exists) in name, email, subject before use in mail headers; HTML-encode all values in the body; never put subject 1:1 in the mail subject line (sanitize, cut at 100). The recipient address never appears in client-reachable config or in OpenAPI examples.
  9. Availability gate / 503: see § 1.
  10. CSP (frontend/host): connect-src 'self' suffices for the same-origin API. A captcha provider needs more (per provider and version, e.g. Friendly Captcha v1 api.friendlycaptcha.com/eu-api.friendlycaptcha.eu, v2 global.frcapi.com; widget script via npm bundle = 'self', else script-src; possible 'wasm-unsafe-eval', worker-src blob:, inline styles). The module documents the required directives per provider/version; the site adds them and tests in a real browser. The captcha provider must be named in the privacy statement.

5. Per-site configuration

Server (appsettings per host, Contact: section):

Setting Example Notes
Contact:Enabled false safety switch (release condition, § 4.5): while false both public contact routes answer 404 with an empty body and nothing runs; the client treats 404 on the token route as "form not available" and shows the mailto fallback. Enabled per host after the per-client rate-limit partitioning is on the base branch
Contact:RecipientEmail — never exposed to the client. ASF: env-only (no ASF addresses in code or committed config); SLP may keep a committed default
Contact:SenderEmail — must be on Email:AllowedFromAddresses; env-only for ASF
Contact:RetentionMonths 12
Contact:MinSeconds 3
Contact:TokenLifetimeMinutes 120
Contact:Captcha:Enabled / Provider / SiteKey / Secret false secret via secrets manager
RateLimiting:ContactForm 5 / 10 min

Frontend per-site options (not API): subject options and labels (incl. the label of other), reply-time text, privacy sentence and link target (ASF: "Lees in de privacyverklaring wat ik met je gegevens doe." → /privacyverklaring), per-field message texts.

5a. Form fields and on/off switch (decided by Bryan, 2026-11-09)

  • Fixed fields for now (name, email, subject, message). A form builder with per-site field definitions is not part of this feature; it can come later as its own feature (field definitions as CMS data). The model stays extendable (additive migrations, contract versioned).
  • Two-layer switch: (1) host level Contact:Enabled (deployment, default off, release condition § 4.5); (2) a CMS switch for the owner: singleton resource GET /api/v1/contact-settings and PUT /api/v1/contact-settings (AdminOnly, body { "enabled": true|false }, stored as data, default false). The form is active only when both are on. When either is off, GET .../token and POST .../contact-messages answer 404 with an empty body and the client shows the mailto fallback. Admin screen "Berichten" gets a visible switch ("Contactformulier aan/uit"). Implemented in CMS-U4 (API) and CMS-U6 (UI); CMS-U3 builds the gate behind an interface so U4 adds the CMS switch without rewriting the filter.

6. Admin endpoints (CMS) — decided: in scope, full version

AdminOnly (Owner + Administrator). Module appears in /System/capabilities so the admin menu "Berichten" only shows on hosts with the module. Decided by Bryan (2026-11-09): RESTful routes without an /admin segment. That an admin may use an endpoint does not require a separate admin route: the same resource is used by everyone, access is controlled by the authorization policy (AdminOnly = Owner + Administrator) and, for public endpoints, by the [PublicSiteEndpoint] marker. This supersedes both /api/v1/admin/contact-messages and /api/v1/contact-messages/admin.

  • POST /api/v1/contact-messages — public (submit, § 2.2). GET /api/v1/contact-messages/token — public (§ 2.1); the {id} routes use the constraint {id:guid} so token never collides.
  • GET /api/v1/contact-messages — AdminOnly: list with paging; filter ?status=new|read|archived|spam (default excludes spam); the response carries the unread count (spam excluded).
  • GET /api/v1/contact-messages/{id:guid} — AdminOnly: detail.
  • PATCH /api/v1/contact-messages/{id:guid} — AdminOnly: status new/read/archived.
  • DELETE /api/v1/contact-messages/{id:guid} — AdminOnly: hard delete (no soft delete), for erasure requests.
  • POST /api/v1/contact-messages/{id:guid}/resend — AdminOnly: resend mail; itself rate-limited (policy RateLimiting:ContactResend, no mail-bomb button); mailStatus and error code visible.
  • The public client (cms-client) only uses the two public routes.
  • Offerings: categories are CMS data with RESTful CRUD under /api/v1/offerings/categories (AdminOnly), see § 7 (not offerings/admin/categories, and no longer an appsettings list). Existing offerings/admin... routes are out of scope for this feature (see the open item on a later RESTful refactor).
  • Spam rows: excluded from the unread counter and the default list; separate filter.

7. Offerings change

Decided by Bryan (2026-11-09, supersedes the appsettings list): categories are data managed in the CMS, not settings. They are part of Offerings: a sub-section/dialog inside the Offerings admin screen (not a new page). Bryan starts with the categories Websites and Onderhoud (he currently offers complete packages and new builds; takeover/"overname" is not decided yet), created by him in the CMS (not seeded in code).

Model: OfferingCategory (id, name, sortOrder), unique name (case-insensitive), nullable categoryId on Offering. Routes (RESTful, no /admin): GET /api/v1/offerings/categories (AdminOnly; list), POST /api/v1/offerings/categories, PUT /api/v1/offerings/categories/{id:guid}, DELETE /api/v1/offerings/categories/{id:guid} (all AdminOnly). Deleting a category that is still used by offerings is rejected (409 ProblemDetails) until those offerings are moved. Offering create/update accept categoryId (must exist) instead of free text; renaming a category updates every offering through the relation. Admin read DTOs carry categoryId and category (name).

Public GET /api/v1/offerings item gains "category": "Websites" — the category name as string or null (shape unchanged for the frontend). null/empty → no chip. The public response also carries the additive fields categoryId (GUID string or null) and displayOrder (int); the SLP site ignores both. Decision (CMS-U0, 2026-11-09): one URL and one DTO for everybody (GET /api/v1/offerings; the former admin DTO is removed); writes are POST /api/v1/offerings, PUT|DELETE /api/v1/offerings/{id:guid} and PUT /api/v1/offerings/order ({ "orderedIds": [...] }), all AdminOnly. The frontend builds chips from distinct non-empty values in order of first appearance, counts itself, and shows chips only when there are 4 or more packages. Existing fields unchanged (see aidlc-docs/features/react-frontend/construction/react-frontend-app/functional-design/packages-api-handoff.md). Array order = display order; exactly one featured: true. Independent of the form; can start immediately.

8. OpenAPI sketch (intended shape; the CMS exports the definitive document)

openapi: 3.0.3
info: { title: SLP CMS public API, version: 0.2.0-draft }
paths:
  /api/v1/contact-messages/token:
    get:
      responses:
        '200': { description: token, content: { application/json: { schema: { $ref: '#/components/schemas/ContactToken' } } } }
        '429': { $ref: '#/components/responses/RateLimited' }
  /api/v1/contact-messages:
    post:
      parameters:
        - { name: Idempotency-Key, in: header, required: true, schema: { type: string, format: uuid } }
      requestBody:
        required: true
        content: { application/json: { schema: { $ref: '#/components/schemas/ContactMessageRequest' } } }
      responses:
        '202': { description: received, content: { application/json: { schema: { $ref: '#/components/schemas/Received' } } } }
        '400': { $ref: '#/components/responses/Validation' }
        '413': { $ref: '#/components/responses/TooLarge' }
        '429': { $ref: '#/components/responses/RateLimited' }
components:
  responses:
    Validation:
      description: validation failed (also expired/forged token and bad Idempotency-Key)
      content: { application/problem+json: { schema: { $ref: '#/components/schemas/ValidationProblem' } } }
    TooLarge:
      description: body too large
      content: { application/problem+json: { schema: { $ref: '#/components/schemas/Problem' } } }
    RateLimited:
      description: too many requests
      headers: { Retry-After: { schema: { type: integer }, description: seconds } }
      content: { application/problem+json: { schema: { $ref: '#/components/schemas/Problem' } } }
  schemas:
    Problem:
      type: object
      properties: { type: { type: string }, title: { type: string }, status: { type: integer } }
    ValidationProblem:
      allOf:
        - $ref: '#/components/schemas/Problem'
        - type: object
          properties:
            errors:
              type: object
              additionalProperties: { type: array, items: { type: string, enum: [required, tooLong, invalid, expired] } }
    ContactToken:
      type: object
      required: [token, minSeconds]
      properties:
        token: { type: string }
        minSeconds: { type: integer }
        captcha: { type: object, nullable: true, properties: { provider: { type: string }, siteKey: { type: string } } }
    ContactMessageRequest:
      type: object
      required: [name, email, subject, message, hpCheck, token]
      properties:
        name: { type: string, minLength: 1, maxLength: 100 }
        email: { type: string, minLength: 1, maxLength: 254 }
        subject: { type: string, minLength: 1, maxLength: 100 }
        message: { type: string, minLength: 1, maxLength: 2000 }
        hpCheck: { type: string, maxLength: 0 }
        token: { type: string }
        captchaToken: { type: string, nullable: true }
    Received:
      type: object
      properties: { status: { type: string, enum: [received] } }

9. Frontend package expectations (cms-client, headless, by subpath)

  • cms-client/contact: useContactForm, contactFormReducer, validateContact, createContactClient, types, default Dutch messages.
  • Messages: messages[field][code] with Dutch defaults identical to the ASF texts ("Vul je naam in.", "De naam is te lang.", "Vul je e-mailadres in.", "Het e-mailadres is te lang.", "Dit e-mailadres is ongeldig.", "Kies een soort shoot." → generic "Kies een onderwerp.", "Schrijf hier je vraag.", "Het bericht is te lang."), plus texts for 429 (shows "probeer het over X minuten" from Retry-After), 413, network/5xx/503, expired token. Fully overridable per site.
  • Field ids: derived from idPrefix + logical field name; a site can keep its own DOM names, ids and test ids; payload mapping lives in the client, not in the site.
  • Idempotency-Key: one UUID per attempt series; reused on "opnieuw proberen" until success; a new key after success/reset; provided by the hook.
  • States: editing | sending | sent | failed pure reducer; sent never reverts; edits and second submit while sending are ignored; input kept on failed. Spam gets the same 202, so there is one success path. The submit button is not blocked for minSeconds; the server answers early submissions with the normal 202 and stores them as spam (never mailed).
  • Token: fetched lazily after hydration on first focus/interaction; on errors.token = ["expired"] one fresh token and an automatic repeat, then the error message. No Date.now on the client.
  • Preselect: { subject, key } with change counter; unknown value ignored; the site reads the query string.
  • Captcha slot: slot data { provider, siteKey, onToken(token), onExpired() }; the site renders the widget client-only after hydration, reserves a fixed height (no layout shift), puts no captcha HTML in prerendered output, resets the widget when the token expires; with captcha: null the slot renders nothing and takes no space.
  • Fallback: on failure the hook returns { failed: true }; the site renders the mailto fallback without the address in static HTML (assembled after hydration).
  • Honeypot slot: field name configurable (hpCheck default).
  • Boundary: no imports from the consuming app. Developed first in slp-software-frontend/src/cms-client/ (decision of the user), then moved to SlpModularCms. cms-client/offerings (typed client from OpenAPI) follows later.

10. Open items

  • [Bryan, decided 2026-11-09] Admin view for contact messages is in scope, full version (list with paging and unread count, detail, status new/read/archived, delete, resend mail).
  • [Bryan, decided 2026-11-09] Honeypot/too-fast submissions are stored with status: spam (30 days, never mailed).
  • [Bryan, decided 2026-11-09] Captcha provider failure: fail-open; captcha ships disabled.
  • [Bryan, decided 2026-11-09, revised] Categories are data managed in the CMS inside the Offerings admin (sub-section, not a new page), not an appsettings list. Starting categories: Websites and Onderhoud. (The earlier decision "fixed list in appsettings" is superseded.)
  • SLS Software - CMS: confirm the build plan incl. Retry-After in OnRejected, own ProblemDetails mapping, DataProtection tokens, idempotency table, retry job, AvailabilityMiddleware aligned with the decision "only the CMS/admin is blocked, public content stays available" (public offerings + contact routes reachable, admin routes still gated), capabilities entry.
  • CMS & API: decide other (label per site) vs ASF overig; plan the ASF migration to cms-client as an own ASF-web feature (not part of this feature; existing ContactForm/reducer tests can serve as acceptance tests).
  • Host: ForwardedHeaders:KnownProxies per host; reverse-proxy route /api/v1/ for test and production (nginx for SLP, IIS for ASF production).
  • [Bryan, decided 2026-11-09] Existing routes with an /admin segment are refactored to RESTful routes now, in this feature (Bryan maintains both websites and prefers doing it now): Offerings (GET/POST offerings/admin, PUT/DELETE offerings/admin/{id}, admin/reorder, admin/{id}/move-up|down) in phase 1 together with the admin-frontend call sites and tests, before the category work; Availability POST admin/status in phase 2 after the merge of the ASF branch (that branch touches Availability and master/slave callers must be checked).
  • Reviews received 2026-11-09: SLS Software - CMS, CMS & API, AndreaSlopFotografie; folded into v0.2.0 and v0.3.x.

10a. Notes for the CMS builder on the availability gate (from review)

  • The latest commit on the CMS branch (701091f, "Beschikbaarheidspoort blokkeert alleen de API, niet de website en de admin") touches the same middleware: build on it; limiting the gate to admin/CMS routes is a second step, not a rewrite.
  • Prefer an explicit allowlist of public routes (offerings GET, contact token GET, contact POST) over a prefix exception, so a new admin endpoint can never fall under the bypass by accident; add a test proving that every endpoint without [PublicSiteEndpoint] (iterating all endpoints, including all admin routes) still returns 503 when the gate is closed. (Replaces the earlier prefix test /api/v1/admin/*; the repo has no common admin prefix.)

11. Suggested CMS build order (from the review; build only after Bryan confirms the whole)

(a) category on Offerings (migration on existing SLP and ASF databases; field in admin forms and tests); (b) OnRejected / Retry-After / ProblemDetails unit (existing policies, PipelineTests); (c) Contact module: storage, token, submit, idempotency, spam checks; (d) mail background service + retry; (e) admin API; (f) admin UI. Build and test per unit.