Listoca

Web app

The admin area, with users, entitlements and feature flags, for support.

The web app (TanStack Start) is a Supabase client like the native app, but online only: it reads and writes Postgres directly under the same row level security, and holds no secret key. The session lives in cookies, so server functions (route guards, the first render) see the same user.

Pages

PathFor
/login, /signup, /verify, /forgot-password, /two-factorsign-in
/accountprofile, password, second factor, plan, deletion
/adminplatform admins

Data access lives in src/modules/<feature>/lib/queries.ts as TanStack Query options. Listoca has no web version of the app (A14): the web app is the operator's admin area.

Admin

Admins (the app_role claim, from user_roles) see users with search and paging, and per user: details, role, ban, password reset, deletion, entitlements, RevenueCat events and activity. Reads go through admin RPCs and admin-only policies; actions that need Supabase's admin API go through the admin-users Edge Function. Admins can't change their own role, ban or delete themselves.

Make someone an admin from the admin area, or in SQL: insert into user_roles (user_id, role) values ('<user id>', 'admin');

Sync

/admin/sync is what PowerSync Cloud's dashboard shows for an instance, for the self-hosted service. It refreshes every 10 seconds:

  • whether sync works: PowerSync reaches the database, the sync config is active and its first copy is done, or what's wrong;
  • metrics since the service started: open sync connections, replication lag, data and operations synced, rows replicated, bucket storage, closed connections by outcome;
  • the replication slot: last change replicated, bytes behind, WAL status and how much WAL is left before Postgres drops the slot;
  • the errors and warnings PowerSync reports, the replicated tables, and the running sync config;
  • Reprocess, which rebuilds every bucket from the database (devices download again).

The page reads through the admin-sync Edge Function, which calls PowerSync's admin API with POWERSYNC_ADMIN_TOKEN and its Prometheus metrics at POWERSYNC_METRICS_URL. PowerSync accepts the token as PS_ADMIN_TOKEN (powersync/service.yaml, api.tokens) and serves metrics on port 9464 (telemetry.prometheus_port); both answer only on the Docker network, and Caddy answers 404 for /api/admin/* on the public sync host. Locally everything is set up (docker-compose.yml, supabase/config.toml); in production, set the same random token as POWERSYNC_ADMIN_TOKEN in the repository's .env and in functions.env. With PowerSync Cloud, use its dashboard and leave POWERSYNC_URL empty: the page then says it isn't connected.

On this page