React app shell #546
Labels
No labels
blocked
duplicate
high priority
needs
approval
needs
criteria
needs
estimate
needs
tests
question
step
doing
step
review
step
testing
step
todo
step
uat
type
admin
type
alert
type
bug
type
change
type
defect
type
dependencies
type
development
type/documentation
type
epic
type
idea
type
incident
type
investigation
type
spike
type
story
type
tests
wontfix
No project
No assignees
1 participant
Notifications
Total time spent: 1 minute 17 seconds
Due date
Smithy-bot
1 minute 17 seconds
No due date set.
Depends on
#544 Management API foundation
External/card-drop
#545 Discord OAuth + session for BOT_ADMINS
External/card-drop
Reference
External/card-drop#546
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Epic: #543
Story Points: 5
SO THAT admins have a React SPA shell (layout, auth gate, routing) served from the bot process.
Scaffold the React (TypeScript / Vite) app, wire auth gate + routing, and serve the built assets from the same Express process.
Scope
Delivers the frontend shell for epic #543. Assumes #544 exposes the Management API router split (public vs protected) and #545 provides Discord OAuth + session cookies.
In scope:
web/Vite + React + TypeScript scaffold, production build wired into the bot release, Express static + SPA fallback, client-side router, shared admin layout (nav placeholders), auth gate (redirect unauthenticated users to login), logout affordance calling #545.Out of scope: Settings / card / ops feature pages (#547–#550); OAuth implementation (#545); management REST handlers (#544 + feature stories); roles/resources UI (#551).
Acceptance criteria
GIVEN the repo is built for release
WHEN CI runs
THEN the React app under
web/compiles successfully and its production assets are available for Express to serve (copy step or equivalent documented in the bot build).GIVEN the bot process is running with Management API enabled
WHEN a browser requests a static asset from the SPA build (e.g. hashed JS/CSS)
THEN Express serves the file with correct content types and caching headers appropriate for hashed assets.
GIVEN the SPA is deployed
WHEN a browser requests a client route (e.g.
/settings) via direct navigation or refreshTHEN Express returns
index.html(SPA fallback) so client routing can handle the path.GIVEN an unauthenticated browser (no valid session cookie from #545)
WHEN they open any management UI route other than public auth paths
THEN they are redirected to the Discord login entry (
GET /auth/discordor documented equivalent) and do not see shell content.GIVEN an authenticated admin session (#545)
WHEN they open the SPA root
THEN they see a consistent shell layout (header/nav) with placeholder links for Settings, Cards, and Ops that route client-side (pages may be stubs until #547–#550).
GIVEN an authenticated admin
WHEN they use Log out in the shell
THEN the client calls
POST /auth/logout(#545), clears local UI state, and redirects to login.GIVEN local development
WHEN a developer runs the documented dev workflow
THEN they can iterate on the React app with API/auth proxied to the local Express port without manual CORS hacks for same-origin session cookies.
GIVEN automated frontend tests
WHEN CI runs
THEN tests cover at least: auth gate redirect for unauthenticated shell access (mocked session/API); router renders shell + stub routes for authenticated state.
Subtasks
web/(align with #542)index.htmlfallback on Express (coordinate mount paths with #544 public vs protected routers)POST /auth/logout(#545)Notes
web/Planning — needs/estimate → needs/tests
Story points: 5 (Fibonacci).
Rationale: Standard medium story: new
web/Vite+React+TS scaffold, CI/build wiring into the bot, Express static hosting + SPA fallback coordinated with #544 routes, client router + layout + stubs, auth gate + logout wired to #545, frontend tests, and dev/prod documentation. Depends on #544/#545 being in place; issue stays blocked until those land — no change to dependency links.Next step: QA test scripts under needs/tests.
Planning — needs/tests → needs/approval
QA scripts mapped to the acceptance criteria in the issue description. Run on a branch with this story and #544 + #545 on stage (or local equivalent with built SPA). Automated rows via
web/test suite + CI.Preconditions
POST /auth/logoutlive.BOT_ADMINSincludes a test Discord user; second non-admin account for negative cases.yarn test/yarn workspace web test(or documented command) for frontend CI.web/dist/assets/).Note: Issue remains blocked until #544 and #545 are merged to the test branch; QA below assumes both are present.
AC1 — Release/CI build produces SPA artifacts
yarn build+ bot packaging step)web/exist in path Express will serve (copy step or equivalent)AC2 — Express serves static hashed assets
GETa known hashed JS/CSS asset URLContent-Type(e.g.application/javascript,text/css)Cache-Control)index.html)AC3 — SPA fallback for client routes
GETto client route (e.g./settings,/cards)index.html(HTML document)/api/*,/auth/*)AC4 — Auth gate redirects unauthenticated users
/or/settings)GET /auth/discordor documented equivalent); no shell chrome visibleGETto stub feature route/auth/discord, callback)AC5 — Authenticated admin sees shell + stub routes
BOT_ADMINSuser; open SPA rootAC6 — Logout from shell
POST /auth/logout; UI clears local statePOST /auth/logoutnetwork tabAC7 — Local dev workflow
web/togetherAC8 — Automated frontend tests in CI
web/yarn testSubtasks / documentation / integration
/api/*incorrectlySign-off checklist
Moving to needs/approval for your review before implementation. @Vylpes