Stedefast

Getting Started

Admin Panel

2 min read

Every Stedefast site ships with a built-in admin panel at /admin. It provides comment moderation, analytics dashboards, and settings — all gated behind BetterAuth email/password authentication backed by your Cloudflare D1 database.

Accessing the admin

Navigate to https://your-site.com/admin. You'll be redirected to /admin/auth/sign-in if you aren't logged in.

Sign in with the email and password you set up in BetterAuth. There's no separate admin user table — authentication is handled entirely by BetterAuth sessions stored in D1.

Built-in pages

Dashboard (/admin)

The landing page shows summary stats (total comments, total claps, page views) and quick-links to each module section.

Content (/admin/content)

A read-only browser of your site's content nodes — useful for seeing what the build pipeline produced. Full editing support is planned for a future release.

Settings (/admin/settings)

Displays your site configuration and account info. Site settings are managed in stedefast.config.ts; password changes go through BetterAuth.

Module admin pages

Each module that registers an adminRoute gets its own sidebar entry. The sections available depend on which modules you have enabled.

Analytics (/admin/analytics)

Requires AnalyticsModule to be enabled.

Shows:

  • Total page views (last 30 days)
  • Top pages table — page URL and view count
  • Custom events table — event name and count

Data is fetched live from /_modules/analytics/summary using your session's Authorization token.

Comment moderation (/admin/comments)

Requires CommentsModule to be enabled.

The moderation queue has three tabs: Pending, Approved, and Rejected.

  • Use the Approve / Reject buttons on individual rows to moderate one at a time
  • Use Approve all / Reject all to bulk-action every visible comment on the current tab
  • Select rows individually with checkboxes for targeted bulk actions
  • Approved comments are published immediately; rejected comments are hidden from readers

If requireApproval: true is set in your CommentsModule config (the default), every new comment starts in the Pending tab.

Claps (/admin/claps)

Requires ClapsModule to be enabled.

Shows a summary of clap counts stored in Cloudflare KV. Counts are also exported to dist/data/claps/counts.json at build time.

The admin panel is a client-side React SPA. Navigation between sections happens without a full page reload. The sidebar is built from the list of registered module adminRoute entries — if you disable a module, its sidebar entry disappears automatically on the next build.

Authentication

The admin is protected by a CF Pages middleware Function that checks for a valid BetterAuth session on every /admin/* request. Unauthenticated requests are redirected to /admin/auth/sign-in.

Session tokens are stored in your browser's cookies and validated against the D1 database on every request. There is no separate admin role — any user with a valid BetterAuth account can sign in.

Deploying the admin

The admin SPA is automatically built and included in dist/admin/ as part of stedefast build. No extra steps are needed. The module nav is injected into the SPA's HTML at build time, so changes to your module list take effect on the next deploy.