Skip to content

Proposal: visitor (member) authentication + per-visitor data #289

Description

@dazzakiller

Hi — I've built a visitor-facing auth system and a per-visitor data framework on top of Instatic (fork: dazzakiller/Instatic, rebased onto v0.0.13). Before opening a PR, I wanted to gauge whether this is in scope / of interest.

The gap it fills: Instatic's auth is admin-only, so member portals, gated content, and personalised visitor pages aren't possible today. This adds the visitor side while keeping it fully decoupled from admin auth.

Two layers:

  1. Visitor auth — register/login/logout, Argon2id, separate session cookie + middleware (different name, different tables, different code — zero runtime coupling to admin auth, enforced by an architecture-gate test), rate limiting + lockout, CSRF, member groups, page-level access control, password reset, an admin Members management UI, and built-in login/register pages.
  2. Per-visitor data — site-builder-defined custom profile fields; two new perVisitor loop sources (visitor.current for "Welcome {name}" / custom fields, visitor.owned-rows for "your tenders"-style listings); form submissions auto-stamp the owning visitor; and the fields surface in the editor's {} binding picker.

Design principles I followed: 95%+ of published pages stay static on disk (auth adds ~0.1ms to the hot path); all visitor logic lives in new files with a ~20-line core diff; IDOR-safe by construction (visitor identity derives only from the validated session cookie, never request input).

Full design docs (PRD, review cycle, architecture, data-framework spec) are in docs/proposals/visitor-auth/
(https://github.com/dazzakiller/Instatic/tree/upstream-rebase/docs/proposals/visitor-auth) on the upstream-rebase branch. tsc -b clean, full test suite at parity with upstream main, dedicated security-gate tests for the IDOR boundary. Rebased cleanly onto v0.0.13.

Scope: ~10,700 lines across ~93 files (47 new). It's large because the two layers are inseparable (data depends on auth).

Transparency: built with AI assistance; I reviewed, tested, and verified every change against the full suite myself. Happy to walk through any part on a call.

Is this something you'd consider in scope? If so, I'll open a PR and split it into review-friendly commits. If not, no worries — I'll keep it as a fork.

— Dazza

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions