Skip to main content

admin

Read this when you change the administration app at https://admin.tadoku.app.

Source: frontend/apps/admin. Development host: admin.tadoku.dev.lab.

Scope​

  • The dashboard (pages/index.tsx) shows the latest official contest, leaderboards and the total user count.
  • The CMS (pages/pages/, pages/posts/, pages/announcements/) manages pages, blog posts and announcements per namespace. It includes a CodeMirror editor, version history, and previews sanitised with DOMPurify and rehype-sanitize. CMS copy, such as the Contact and About pages, is changed here rather than in code.
  • Users (pages/users.tsx) can be listed, banned or unbanned, and granted or denied per-user feature access. A row's actions menu also files an account deletion through app/users/DeleteAccountDialog.tsx, which requires the account's email address and a reason and is disabled for administrators; see Account deletion.
  • Languages (pages/languages.tsx) manages the immersion language list.

pages/_app.tsx requires an identity session and the admin role from Tadoku API. It sends visitors without a session to the authv2 login page and shows other users an access-denied screen.

Stack​

  • Next.js 13 Pages Router, with feature code in app/ imported as @app/*, Tailwind CSS and the legacy ui components.
  • React Query 3 hooks call Tadoku API (immersion, content, authz and profile) through the generated client, which validates every response. See the API reference.
  • The app also uses react-hook-form, Luxon, Jotai for the session, with accounts read from GET /identity/session.
  • frontend/packages/ui/app-urls.tsx derives authv2, home and browser API URLs from the current branch host. SSR passes them through its provider; browser API calls resolve their endpoint at call time. Logout uses POST /identity/logout. SSR forwards Cookie and X-Dev-Branch to the private API endpoint and never caches session responses. Session initialization is scoped to the request.
  • The next.config.js NEXT_PUBLIC_* variables work as they do in webv2.

Commands​

From frontend/:

pnpm --filter admin dev # port 3000
pnpm --filter admin lint
pnpm --filter admin exec tsc --noEmit
pnpm --filter admin build