POL-124: Migrate frontend from React Native to Next.js web app

- Replace mobile/ (Expo) with web/ (Next.js 16 + Tailwind + shadcn/ui)
- Pages: login, register, pending, championships, championship detail, registrations, profile, admin
- Logic/view separated: hooks/ for data, components/ for UI, pages compose both
- Types in src/types/ (one interface per file)
- Auth: Zustand store + localStorage tokens + cookie presence flag for proxy
- API layer: axios client with JWT auto-refresh

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Dianaka123
2026-02-26 20:35:22 +03:00
parent 390c338b32
commit 9fcd7c1d63
94 changed files with 13713 additions and 10785 deletions

View File

@@ -10,8 +10,8 @@ Current implementation is a simplified MVP working toward that goal.
# Backend
cd backend && .venv/Scripts/python -m uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload
# Mobile (set BASE_URL in src/api/client.ts to LAN IP first)
cd mobile && npx expo start --lan --clear
# Web frontend
cd web && npm run dev # runs on http://localhost:3000
# Seed test data
cd backend && .venv/Scripts/python seed.py
@@ -20,7 +20,7 @@ cd backend && .venv/Scripts/python seed.py
## Current Architecture
- **Backend**: FastAPI + SQLAlchemy 2 (async) + aiosqlite (SQLite dev) + Alembic + bcrypt
- **Mobile**: Expo (blank-typescript) + React Navigation v6 + Zustand + Axios + Ionicons
- **Web**: Next.js 15 (App Router) + Tailwind CSS + shadcn/ui + TanStack Query + Zustand
- **Auth**: JWT access (15min) + refresh token rotation (7 days, SHA-256 hashed in DB)
## Project Layout
@@ -29,10 +29,11 @@ cd backend && .venv/Scripts/python seed.py
backend/app/ FastAPI app (models, schemas, routers, crud, services)
backend/alembic/ Async migrations
backend/.venv/ Virtual env (use .venv/Scripts/python)
mobile/src/api/ Axios client + API modules (auth, championships, users)
mobile/src/store/ Zustand auth store
mobile/src/screens/ auth/, championships/, admin/, profile/
mobile/src/navigation/ RootNavigator -> AuthStack | AppStack (Tabs + Detail)
web/src/app/ Next.js App Router pages
web/src/lib/api/ Axios client + API modules (auth, championships, users)
web/src/store/ Zustand auth store
web/src/components/ Shared UI components
web/src/middleware.ts Route protection
dancechamp-claude-code/ Target spec: SPEC.md, PLAN.md, DATABASE.md, DESIGN-SYSTEM.md, SCREENS.md
```
@@ -41,9 +42,8 @@ dancechamp-claude-code/ Target spec: SPEC.md, PLAN.md, DATABASE.md, DESIGN-SYSTE
- **passlib + bcrypt 5.x incompatible** — use `bcrypt` directly (NOT passlib)
- **Circular import**: auth_service.py must NOT import crud_user
- **SQLAlchemy UUID**: Use `sqlalchemy.Uuid(as_uuid=True)` not `postgresql.UUID`
- **Expo newArchEnabled: true** crashes Expo Go — keep `false` in app.json
- **Stale uvicorn**: Kill with `powershell.exe -NoProfile -Command "Get-Process python | Stop-Process -Force"`
- **BASE_URL**: mobile/src/api/client.ts must use LAN IP (not localhost) for physical devices
- **Web API URL**: set `NEXT_PUBLIC_API_URL` in `web/.env.local` (default: http://localhost:8000/api/v1)
## Test Credentials (run seed.py)
@@ -64,12 +64,25 @@ member@pole.dev / Member1234 (member, approved)
## Code Conventions
- Backend: Pydantic v2 schemas, async SQLAlchemy, `from_attributes = True`
- Mobile: Functional components, Zustand stores, Ionicons for icons
- Web: Functional components, TanStack Query for server state, Zustand for auth, shadcn/ui components
- Registration: members auto-approved, organizers require admin approval
- Tab navigator uses `headerShown: true` for safe area; no manual headings in tab screens
## Environment
- Windows 10, Python 3.12, Node.js
- Docker NOT installed, PostgreSQL NOT installed (use SQLite for dev)
- venv always in backend/.venv
## Linear Workflow (MANDATORY)
**Every action** (coding, migrations, docs, planning, bug fixes) MUST have a Linear issue.
Before starting ANY task:
1. Check if a matching Linear issue exists in the "Pole dance app" workspace
2. If not — create one (title, description, priority)
3. Set status to **In Progress** before writing any code
After completing:
- Set status to **Done**
- Make a git commit with message: `POL-N: <task title>`
- Report the issue number to the user (e.g. "Done — POL-42")