Skip to content

feat(frontend): scaffold login and My Games pages with auth#1

Open
zortos293 wants to merge 4 commits intomainfrom
capy/scaffold-login-my-games
Open

feat(frontend): scaffold login and My Games pages with auth#1
zortos293 wants to merge 4 commits intomainfrom
capy/scaffold-login-my-games

Conversation

@zortos293
Copy link
Copy Markdown
Contributor

@zortos293 zortos293 commented Apr 13, 2026

This PR scaffolds the first usable OpenStroid frontend from scratch, delivering a production-quality login experience and authenticated game library. The app uses Mantine for polished dark UI, implements robust auth with token refresh, and wires to the Boosteroid API endpoints.

Authentication

  • Centralized API config (src/api/config.ts) with configurable origin (defaults to https://cloud.boosteroid.com)
  • Axios client (src/api/client.ts) with automatic token refresh, request queuing, and raw Authorization header
  • Token persistence in localStorage (access_token, refresh_token, boosteroid_auth)
  • Login payload isolated in adapter (src/auth/login-adapter.ts) for easy field-name adjustments
  • Session restore on startup via getCurrentUser() validation; stale tokens are cleared
  • Logout clears session and redirects to login

Pages

  • Login (src/pages/LoginPage.tsx): premium gradient branding, client-side validation, 422 error handling with dismissible alert, disabled/loading states, network error messaging
  • My Games (src/pages/LibraryPage.tsx): cards with 3:4 aspect ratio covers, skeleton loading grid, empty state, error recovery with retry, responsive grid
  • Route guard (src/components/RequireAuth.tsx): redirects unauthenticated to /login, shows loading spinner during bootstrap

Architecture

  • Auth provider (src/auth/AuthContext.tsx) manages user, isAuthenticated, isLoading, isBootstrapping
  • App shell (src/layouts/AuthenticatedLayout.tsx) with frosted-glass header and branded logo
  • Header (src/components/AppHeader.tsx) with user menu, avatar, and logout action
  • Custom dark theme (src/theme/theme.ts) with brand/accent colors, Inter font, tuned radii
  • Types (src/types/index.ts) for AuthTokens, LoginCredentials, User, InstalledGame, ApiError

Open in Capy OPE-1 · Opus 4.6

@zortos293 zortos293 added the capy Generated by capy.ai label Apr 13, 2026 — with Capy AI
Copy link
Copy Markdown

@capy-ai capy-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added 1 comment

Comment thread src/pages/LoginPage.tsx Outdated
zortos293 and others added 3 commits April 13, 2026 15:16
…in boosteroid_auth, fix favicon and focus styles

- Add Vite proxy for /api -> cloud.boosteroid.com so login avoids cross-origin 403
- Default API base URL to empty (relative paths) in dev; absolute only for deploys
- Store user_data from login response as boosteroid_auth instead of placeholder 'true'
- Make response parsing envelope-resilient (handles data wrapper or flat shape)
- Handle 403/140306 error responses in login error extraction
- Replace broken &:focus inline styles with CSS module (LoginPage.module.css)
- Replace /vite.svg favicon with /favicon.svg (branded OS gradient icon)
- Pass user_data through token refresh interceptor
- Update README with proxy documentation and .env.example

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
The official client sends four fields in POST /api/v1/auth/login:
  email, password, remember_me, cf-turnstile-response

Our code only sent {email, password}, causing error 140306
('Something wrong with your data') on correct credentials. The server
validates credentials first (wrong creds → 142299), then checks the
Turnstile token (missing token → 140306).

Changes:
- Add react-turnstile dependency for Cloudflare Turnstile widget
- Add Turnstile captcha widget to LoginPage with dark theme
- Add 'Remember me' checkbox matching the official form
- Include cf-turnstile-response and remember_me in login payload
- Lowercase email before sending (matching official client)
- Update password minimum length from 4 to 8 (matching official)
- Make Turnstile site key configurable via VITE_TURNSTILE_SITE_KEY
- Add cookieDomainRewrite to Vite proxy for server-set cookies
- Reset Turnstile widget after failed login attempts
- Disable submit button until Turnstile verification completes
- Update README and .env.example with Turnstile configuration

For local development, set VITE_TURNSTILE_SITE_KEY=1x00000000000000000000AA
in .env to use the Cloudflare always-pass test key.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Copy link
Copy Markdown

@capy-ai capy-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added 1 comment

Comment thread src/pages/LibraryPage.tsx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

capy Generated by capy.ai

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant