Add guest/try-now option — play without account #12

Open
opened 2026-04-19 07:23:29 +00:00 by forgejo-lila · 0 comments
Owner

Context

The app currently requires Google or GitHub login before users can do anything. This creates friction — new users can't see what the app offers before committing to an account.

What to do

Allow anonymous users to play a limited singleplayer quiz without signing in.

Files to change

  • apps/api/src/routes/gameRouter.ts — currently all game routes go through requireAuth middleware. Make auth optional on game routes, or create a separate guest route.
  • apps/api/src/middleware/authMiddleware.ts — consider adding an optionalAuth middleware that attaches user info if present but doesn't reject anonymous requests.
  • apps/web/src/routes/play.tsx — the beforeLoad guard redirects to /login if no session. Change to allow anonymous access.
  • apps/web/src/routes/index.tsx or login.tsx — add a 'Try without account' button that navigates directly to /play.

Acceptance criteria

  • A new user can visit the site and start a quiz without logging in
  • The quiz functions identically to the authenticated version
  • Guest sessions are not persisted (no stats, no history)
  • A prompt to create an account appears after completing a guest quiz
  • Authenticated users see no difference in their experience

Notes

The GameSessionStore (in apps/api/src/gameSessionStore/) is already anonymous — sessions are keyed by UUID, not user ID. No backend game logic changes should be needed.

## Context The app currently requires Google or GitHub login before users can do anything. This creates friction — new users can't see what the app offers before committing to an account. ## What to do Allow anonymous users to play a limited singleplayer quiz without signing in. ## Files to change - `apps/api/src/routes/gameRouter.ts` — currently all game routes go through `requireAuth` middleware. Make auth optional on game routes, or create a separate guest route. - `apps/api/src/middleware/authMiddleware.ts` — consider adding an `optionalAuth` middleware that attaches user info if present but doesn't reject anonymous requests. - `apps/web/src/routes/play.tsx` — the `beforeLoad` guard redirects to `/login` if no session. Change to allow anonymous access. - `apps/web/src/routes/index.tsx` or `login.tsx` — add a 'Try without account' button that navigates directly to `/play`. ## Acceptance criteria - A new user can visit the site and start a quiz without logging in - The quiz functions identically to the authenticated version - Guest sessions are not persisted (no stats, no history) - A prompt to create an account appears after completing a guest quiz - Authenticated users see no difference in their experience ## Notes The `GameSessionStore` (in `apps/api/src/gameSessionStore/`) is already anonymous — sessions are keyed by UUID, not user ID. No backend game logic changes should be needed.
forgejo-lila added the
feature
label 2026-04-19 07:23:29 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: forgejo-lila/lila#12
No description provided.