Skip to content
Maxwell CollinsContact

Hub, one sign-in for a twelve-product property platform

The single sign-in gateway in front of every product in the property suite, for owners, inspectors and service companies.

What it achieved

One sign-in opens every product in the suite, with no stealable tokens, hijacked redirects or surprise logouts.

The short version

One sign-in opens all twelve products of a property-software ecosystem, with no stealable tokens, hijacked redirects or surprise logouts. They are the data API, the owner portal, the inspection, field-service and property-management products, five mobile apps and the admin dashboard. Maxwell built this single sign-on gateway (Hub), the one front door to every product. A user registers or signs in once, picks a product and arrives already signed in. It handles registration with a password-strength meter, a guided first-run setup, and sign-in by email or Google. It closes the three classic browser traps: stolen tokens, sign-in pages turned into redirect attacks, and logouts when several tabs refresh at once.

The problem

Twelve products cannot have twelve logins, and every separate login is another place for a security mistake. Single sign-on in the browser has three well-known traps. Tokens get stored where scripts can steal them, sign-in pages get turned into redirect attacks, and single-use refresh tokens log users out when several tabs refresh at once.

In use

  1. A user registers or signs in at Hub, with a password-strength meter and a guided first-run setup.
  2. They choose a product, and Hub sends them there already signed in.
  3. The sign-in token lives only in memory, and the refresh token sits in a cookie that page scripts cannot read.
  4. With five tabs open, exactly one tab refreshes the session, and the others pick up the result.
  5. A link that tries to send the user to an outside site after sign-in is refused.

What it achieved

  • Users sign in once and reach all twelve products from one place.
  • Users with many tabs open stay signed in: exactly one refresh call goes out per refresh event, however many tabs are open, where single-use refresh tokens would otherwise log them out.
  • A change to the data API cannot quietly break sign-in: all 45 of the endpoints Hub calls are contract-tested.
  • The security choices cannot drift as agents change the code: every change is held to sixteen invariants and ten structural rules.

The full record

On this page
In one sentence

Maxwell built the suite's Hub, the single sign-on gateway for a twelve-product property-technology ecosystem, which keeps access tokens in memory only, keeps refresh tokens in HttpOnly cookies, blocks open redirects with a return-address firewall and runs multi-tab leader election so exactly one browser tab refreshes the single-use tokens, governed by a sixteen-invariant constitution and ten structural rules, contract-tested against 45 the suite's API endpoints, in 3,396 lines of application code across 58 files and three shared packages with 189 test cases. He builds by directing AI agents, and he built this system that way.

tests
189
invariants
16
products served
12
API endpoints
45

What it does

Hub is the one front door for every product in the ecosystem: the suite's data API, the owner portal, the inspection, field-service and property-management products on the web, the five mobile apps, and the internal administration dashboard. A user signs in once at Hub and is signed in everywhere. No product has its own login; Hub is the first piece of infrastructure deployed, before any product that depends on it.

The screens and routes

  • Register and log in. Public pages for creating an account and signing in, with a password-strength meter.
  • Onboarding. A guided wizard for a new user's first steps.
  • Select product. After sign-in, the user chooses which product to open, and Hub sends them there already signed in.
  • Five server routes handle login, registration, token refresh, and setting and clearing the refresh cookie.
  • A health endpoint that reports whether the suite's API is reachable by actually calling it, returning a 503 when it is not.

How the tokens are kept safe

  • Access tokens in memory only. The short-lived access token lives in browser memory and nowhere else: never in cookies, local storage, session storage or IndexedDB. Closing the tab discards it on purpose.
  • Refresh tokens in HttpOnly cookies. The long-lived refresh token is set by Hub's own server route as an HttpOnly, Secure, SameSite=Strict cookie shared across the ecosystem's domain, so page scripts can never read it and every product shares one sign-in.
  • No token checks in the browser. JSON Web Token verification happens only on the server; the browser receives the user's claims through a useAuth hook.
  • Fail closed. Any authentication error signs the user out instead of guessing.

Multi-tab leader election

Refresh tokens are single-use. If a user has five tabs open and all five try to refresh at once, four of them would spend an already-used token and sign the user out. Hub elects one leader tab using BroadcastChannel and Atomics; the leader makes exactly one refresh call and shares the new token with the other tabs. Cross-origin isolation headers are set so the shared memory this needs is available.

The open-redirect firewall

After sign-in Hub returns the user to where they came from. Every return_to address is validated against the ecosystem's allowed destinations, so a crafted link cannot use Hub's sign-in page to send a user to an attacker's site.

Sign-in providers

Email and password, and Google through the suite's API's redirect flow. Apple and Microsoft sign-in are designed into the same flow, with Apple using the API's mobile endpoint and Microsoft using its own client-side library.

The shared packages

  • auth: the auth provider, the in-memory token store, the token manager, the broadcast coordinator for leader election, and the useAuth, useLogin and useRegister hooks every product uses.
  • api-client: a typed client for the suite's API's auth and profile endpoints, which turns every API failure into a typed error so the interface never shows a raw fetch error.
  • ui: the shared buttons, inputs, spinner and password-strength components.

What Hub consumes

Hub is mapped to 45 of the suite's API endpoints: authentication (8), OAuth (4), profile (6), company (8), membership (5), party (4), app (7) and session (3).

What it achieved

  • One sign-in for twelve products. Every product in the ecosystem authenticates through Hub.
  • 189 test cases in 3,702 lines of tests across 15 files, plus consumer contract tests and browser journey tests.
  • Sixteen invariants and ten structural rules that govern every change.
  • The tab-refresh race removed: exactly one refresh call per refresh event, however many tabs are open.

The problem it solves

An ecosystem of twelve products cannot have twelve logins. Users expect to sign in once, and every separate login is another place for a security mistake. Single sign-on in the browser has well-known traps: tokens stored where scripts can steal them, sign-in pages that can be turned into redirect attacks, and single-use refresh tokens that log users out when several tabs refresh at once. Hub solves all three in one place, so no product team has to solve them again.

How he built it

Maxwell wrote Hub's constitution before any code: sixteen invariants covering token storage, package naming, no local authentication, leader election, cross-origin isolation headers, snake_case API fields, server-only token verification, return-address validation, a contract test for every API call, typed errors, UUIDv7 identifiers, fail-closed errors, the quality gate, test-first development, Hub's place as the first infrastructure deployed, and local HTTPS in development. Every agent working in the repository must list the invariants that apply to its task before writing a line. He directed AI agents to build it test-first, with every the suite's API call covered by a Pact consumer contract test and agents required to confirm each endpoint, field and permission level through the ecosystem's contract server and the database schema itself, never from documentation. pnpm gate (type checks, lint, unit tests, contract tests and bundle-size limits) is the only accepted checkpoint, and after two failed agents on one task the work stops, is reverted, and the task description is fixed before another agent is sent in.