Admin dashboard for BitcoinDeepa DCA. Vite + React + shadcn/ui, React Router (data mode), TanStack Query, nuqs.
bun install
cp .env.example .env # VITE_API_URL = BitcoinDeepa-DCA-BE URL
bun run devSign-in uses the backend's Better Auth (/api/admin-auth). Only admins can sign in; create the first one on the backend with bun run admin:create --email <email> --name "<name>", then add others from the Admins page.
The backend's admin sign-in is also the OAuth server of its read-only DB MCP (POST /mcp, backend docs/mcp.md). When an admin connects Claude, the backend sends them to /login (the sign-in continues the OAuth request: oauthProviderClient() in auth-client.ts sends the page's signed query along) and then to /oauth/consent to allow the client once. Both pages only act on a request the backend signed.
/audit-log reads the backend's audit trail (GET /admin/audit-log): every dashboard request, sign-in (failed ones too), sign-out, MCP client consent and DB MCP query, with the admin, IP and result. Filters live in the URL like the other lists; Details shows everything an entry recorded.
It's a single-page app: vercel.json rewrites every path to index.html, so a direct link or a refresh on /members, /login or /oauth/consent loads the app instead of Vercel's 404 (files that exist, like /assets/*, are still served as they are). VITE_API_URL is read at build time: after changing it in Vercel, redeploy.
Add the version's section to CHANGELOG.md, bump version in package.json, and merge dev into main. The release workflow (.github/workflows/release.yml, same as the backend's) tags the merge commit vX.Y.Z and publishes the GitHub release with that section as its notes. A merge that doesn't bump the version releases nothing; a missing section fails the run and tags nothing (add it and push to main again). To redo a release's notes, run the workflow by hand with its tag.
src/
app/ # providers, router, layouts, app-level pages
features/ # one folder per feature, imported only through its index.ts
<feature>/
api/ # one function per backend endpoint
hooks/ # use-<feature>.ts (queries + mutations), use-<feature>-filters.ts (nuqs)
components/
pages/
types.ts # API types and enums
index.ts
components/ # shared: ui/ (shadcn), data-table/, app-sidebar, app-header, page-header, status-badge
hooks/ lib/ # shared hooks and helpers (lib/api.ts: apiFetch / apiPost)
Features import each other only through their index.ts.
All tables use TanStack Table (v9) through components/data-table: useDataTable (server-side pagination), DataTable, DataTablePagination and DataTableSearch. Define columns per feature with createColumnHelper<DataTableFeatures, Row>() and keep filters/page in the URL with nuqs (see features/members/pages/members-page.tsx). Below md the same table renders as cards: set meta.mobileRole (title, subtitle, aside, hidden) on a column to place it. Pass onRowClick to open a details sheet, with the open row id in the URL too.
Every page has the same shape: PageHeader (icon, title, description, Refresh), filters, the table, a details Sheet on row click, and Dialog / AlertDialog for actions.