2025-10-10 23:04:50 -07:00
|
|
|
{
|
|
|
|
|
"name": "brackt.com",
|
|
|
|
|
"private": true,
|
|
|
|
|
"type": "module",
|
|
|
|
|
"scripts": {
|
2025-10-18 22:16:04 -07:00
|
|
|
"build": "npm run build:remix && npm run build:server",
|
|
|
|
|
"build:remix": "react-router build",
|
|
|
|
|
"build:server": "node scripts/build-server.mjs",
|
2025-10-10 23:04:50 -07:00
|
|
|
"db:generate": "dotenv -- drizzle-kit generate",
|
|
|
|
|
"db:migrate": "dotenv -- drizzle-kit migrate",
|
2026-04-03 15:17:58 -07:00
|
|
|
"db:sync-prod": "bash scripts/sync-prod-db.sh",
|
Canonical tournament layer: schema + backfill (1/2) (#365)
* refactor(schema): rename per-window tables to season_* prefix
Renames participants, participant_expected_values, participant_qualifying_totals,
participant_results, participant_surface_elos to season_* prefixed names.
Renames event_results.participant_id to season_participant_id.
Phase 1a of canonical tournament layer migration.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
* refactor: rename participant.ts model file to season-participant.ts
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
* refactor(models): update model layer to use renamed schema exports
Updated all model files to use the renamed schema exports from Task 1:
- participants → seasonParticipants
- participantExpectedValues → seasonParticipantExpectedValues
- participantQualifyingTotals → seasonParticipantQualifyingTotals
- participantResults → seasonParticipantResults
- participantSurfaceElos → seasonParticipantSurfaceElos
- eventResults.participantId → eventResults.seasonParticipantId
- db.query relation accessors updated
- Relation field .participant → .seasonParticipant where applicable
- Import paths updated: ./participant → ./season-participant
Files updated (14 model files + 3 test files):
- draft-pick.ts
- draft-utils.ts
- event-result.ts
- group-stage-match.ts
- participant-result.ts
- qualifying-points.ts
- scoring-calculator.ts
- scoring-event.ts
- sports-season.ts
- surface-elo.ts
- team-score-events.ts
- cs2-major-stage.ts
- golf-skills.ts
- participant-expected-value.ts
- __tests__/sports-season.clone.test.ts
- __tests__/auto-pick.test.ts
- __tests__/executeAutoPick.timer.test.ts
Typecheck errors decreased: 779 → 499 (280 fewer)
All model file errors related to renamed schemas resolved.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
* refactor(routes): update route layer to use renamed schema exports
- Update model import from ~/models/participant to ~/models/season-participant
- Rename schema.participants to schema.seasonParticipants
- Rename schema.participantResults to schema.seasonParticipantResults
- Rename db.query.participants to db.query.seasonParticipants
- Update 9 route files and 1 test file
Affected files:
- admin.sports-seasons.$id.events.$eventId.bracket.server.ts
- admin.sports-seasons.$id.participants.tsx
- api/draft.force-manual-pick.ts
- api/draft.make-pick.ts
- api/draft.replace-pick.ts
- api/seasons.$seasonId.draft.ts
- leagues/$leagueId.draft-board.$seasonId.tsx
- leagues/$leagueId.sports-seasons.$sportsSeasonId.server.ts
- admin/__tests__/sports-seasons-participants.test.ts
Error count reduced from 499 to 453 (46 errors fixed).
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
* refactor(routes): update route files for schema rename
Update route imports from ~/models/participant to ~/models/season-participant
and fix references to .participant/.participantId on event results to use
.seasonParticipant/.seasonParticipantId after schema rename.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
* refactor(services): update simulators and services for renamed schema
Update all simulators, services, and server files to use renamed schema tables:
- participants → seasonParticipants
- participantExpectedValues → seasonParticipantExpectedValues
- participantResults → seasonParticipantResults
- eventResults.participantId → eventResults.seasonParticipantId
Files updated:
- 20 sport simulators (NBA, NHL, NFL, MLB, etc.)
- probability-updater.ts
- standings-sync/index.ts
- sports-data-sync.server.ts
- server/socket.ts
Typecheck errors reduced from 365 to 0.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
* migration: rename per-window tables to season_* prefix
* fix(tests): update mock query keys after participants table rename
Change mock db.query.participants to db.query.seasonParticipants in test
files to match the schema rename from commit 66145a9. This fixes
"Cannot read properties of undefined (reading 'findFirst'/'findMany')"
errors that occurred when production code queries db.query.seasonParticipants
but test mocks only defined the old participants key.
Files updated:
- app/services/simulations/__tests__/world-cup-simulator.test.ts
- app/routes/api/__tests__/draft.force-manual-pick.test.ts
- app/routes/api/__tests__/draft.force-manual-pick.timer-mode.test.ts
- app/routes/api/__tests__/draft.make-pick.timer-mode.test.ts
- server/__tests__/timer-autodraft.test.ts
- app/models/__tests__/team-score-events.test.ts
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
* fix(tests): update remaining mock paths and keys after schema rename
* fix(tests): final two mock stragglers after schema rename
- draft-pick.test.ts: assertion on db.query.participantQualifyingTotals
- process-match-result.test.ts: mock key participants → seasonParticipants
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
* chore: add post-phase1a baseline capture (temp, for diff verification)
* chore: capture pre-migration baselines
* chore: remove post-phase1a capture helper after verification
* schema: add canonical tournament & participant tables
Adds tournaments, participants (canonical), tournament_results, and
participant_surface_elos (canonical). Adds nullable tournament_id to
scoring_events and nullable participant_id to season_participants.
Phase 1b of canonical tournament layer migration.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
* feat(models): add canonical tournament, participant, result, surface-elo models
Adds CRUD modules for the canonical tables created in commit 775b905.
Each module mirrors existing app/models conventions (database() from
~/database/context, schema from ~/database/schema, mock-based tests).
Key implementation notes:
- participant.ts exports use "Canonical" prefix (CanonicalParticipant,
createCanonicalParticipant, etc.) to avoid collision with existing
season-participant.ts exports
- All four models include comprehensive unit tests following the
audit-log.test.ts pattern
- Tests use mocked db responses (no real database access)
- Upsert functions use onConflictDoUpdate for appropriate unique constraints
Part of Phase 1b of canonical tournament layer migration.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
* migration: create canonical tables, add nullable FKs
* scripts: add extractTournamentIdentity helper for backfill
Pure function that derives canonical (name, year) identity from a
scoring_events row, stripping trailing 4-digit years from the name or
falling back to eventDate. Used by the Phase 2 backfill to group
per-window events into canonical tournaments.
* scripts: add backfill orchestrator for canonical layer
Populates canonical tournaments, participants, tournament_results, and
participant_surface_elos from per-window data for qualifying-points
sports. Skips already-linked rows, is idempotent, and supports dry-run
mode.
Critical invariants enforced by the implementation:
- qualifying_points_awarded is never copied to tournament_results
- season_participant_qualifying_totals is never touched
- conflicting surface-Elo values between windows raise a loud error
(recorded in report.errors) rather than overwriting
* scripts: add backfill CLI with dry-run default
Wires backfill-canonical-layer.ts to a CLI entry point exposed as
`npm run backfill:canonical`. Defaults to --dry-run; requires --apply
to actually write. Supports --sport=<uuid> to limit to a single sport.
Exits 2 if the backfill reports errors (e.g., surface-Elo conflicts).
* fix(backfill-cli): wrap runBackfill in DatabaseContext.run
The orchestrator uses database() from ~/database/context, which requires
AsyncLocalStorage to be populated. Wrap the CLI invocation with
DatabaseContext.run(db, ...) using server/db's cached connection pool.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
* fix(backfill-cli): exit 0 on success so pg pool doesn't block
The cached postgres connection pool keeps the Node event loop open after
main() returns. Explicit process.exit(0) on success mirrors the pattern
in scripts/capture-baseline.ts.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
---------
Co-authored-by: Chris Parsons <chrisp@extrahop.com>
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-01 20:13:18 -07:00
|
|
|
"backfill:canonical": "dotenv -- tsx scripts/backfill-cli.ts",
|
2026-03-10 23:35:33 -07:00
|
|
|
"dev": "NODE_OPTIONS='--import ./instrument.server.mjs' dotenv -- tsx watch server.ts",
|
2026-03-11 09:06:11 -07:00
|
|
|
"start": "NODE_ENV=production NODE_OPTIONS='--import ./instrument.server.mjs' node dist/server.js",
|
|
|
|
|
"start:production": "NODE_ENV=production NODE_OPTIONS='--import ./instrument.server.mjs' node dist/server.js",
|
2025-10-21 12:47:11 -07:00
|
|
|
"test": "vitest",
|
|
|
|
|
"test:ui": "vitest --ui",
|
|
|
|
|
"test:coverage": "vitest --coverage",
|
2026-03-30 14:42:23 -07:00
|
|
|
"test:run": "vitest run --project=unit",
|
|
|
|
|
"test:storybook": "vitest run --project=storybook",
|
2025-10-21 12:47:11 -07:00
|
|
|
"test:e2e": "cypress open",
|
|
|
|
|
"test:e2e:headless": "cypress run",
|
|
|
|
|
"test:all": "npm run test:run && npm run test:e2e:headless",
|
2026-03-21 09:44:05 -07:00
|
|
|
"typecheck": "react-router typegen && tsc -b && tsc -p tsconfig.server.json --noEmit",
|
|
|
|
|
"lint": "oxlint app/ server/ database/",
|
2026-03-23 08:24:28 -07:00
|
|
|
"lint:path": "oxlint",
|
2026-03-29 15:20:48 -07:00
|
|
|
"lint:fix": "oxlint app/ server/ database/ --fix",
|
|
|
|
|
"storybook": "storybook dev -p 6006",
|
|
|
|
|
"build-storybook": "storybook build"
|
2025-10-10 23:04:50 -07:00
|
|
|
},
|
|
|
|
|
"dependencies": {
|
2025-10-25 21:02:16 -07:00
|
|
|
"@dnd-kit/core": "^6.3.1",
|
|
|
|
|
"@dnd-kit/sortable": "^10.0.0",
|
|
|
|
|
"@dnd-kit/utilities": "^3.2.2",
|
2026-03-26 17:17:49 -07:00
|
|
|
"@marsidev/react-turnstile": "^1.4.2",
|
2025-10-25 10:04:21 -07:00
|
|
|
"@radix-ui/react-accordion": "^1.2.12",
|
2025-10-11 00:29:04 -07:00
|
|
|
"@radix-ui/react-alert-dialog": "^1.1.15",
|
2025-10-12 21:54:49 -07:00
|
|
|
"@radix-ui/react-checkbox": "^1.3.3",
|
2025-10-25 03:23:41 -07:00
|
|
|
"@radix-ui/react-collapsible": "^1.1.12",
|
2025-10-18 14:55:26 -07:00
|
|
|
"@radix-ui/react-context-menu": "^2.2.16",
|
2025-10-10 23:30:26 -07:00
|
|
|
"@radix-ui/react-dialog": "^1.1.15",
|
2025-10-11 00:07:39 -07:00
|
|
|
"@radix-ui/react-label": "^2.1.7",
|
2025-10-10 23:30:26 -07:00
|
|
|
"@radix-ui/react-navigation-menu": "^1.2.14",
|
2025-10-15 22:02:21 -07:00
|
|
|
"@radix-ui/react-popover": "^1.1.15",
|
2025-10-13 19:59:34 -07:00
|
|
|
"@radix-ui/react-radio-group": "^1.3.8",
|
2025-10-11 00:07:39 -07:00
|
|
|
"@radix-ui/react-select": "^2.2.6",
|
|
|
|
|
"@radix-ui/react-slot": "^1.2.3",
|
2025-10-21 23:22:17 -07:00
|
|
|
"@radix-ui/react-switch": "^1.2.6",
|
2025-10-25 03:23:41 -07:00
|
|
|
"@radix-ui/react-tabs": "^1.1.13",
|
2025-10-10 23:04:50 -07:00
|
|
|
"@react-router/express": "^7.7.1",
|
|
|
|
|
"@react-router/node": "^7.7.1",
|
2026-03-10 23:35:33 -07:00
|
|
|
"@sentry/react-router": "^10.43.0",
|
New design (#309)
* Redesign home page with new layout and component system
- Two-column layout (My Leagues 2/3, Upcoming Events 1/3) with mobile stack
- LeagueRow: square avatar, gradient draft highlight, rank/points display, progress bar
- MyLeaguesCard, CreateLeagueCard with shared SectionCardHeader
- UpcomingEventsCard: vertical timeline with grouped multi-league events
- Shared gradient system: BracktGradients SVG defs, GradientIcon wrapper, brand.ts constants
- Button default variant updated to green→cyan gradient
- Navbar: plain nav links with gradient hover, support/admin icon buttons
- Accessibility fixes: semantic h2 headings, aria-label on LeagueAvatar and nav elements
- Storybook stories for all new components
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Responsive league row layout and mobile polish
- League rows stack avatar+name on top, stats full-width below on mobile
- Stats spread to right side on sm+ screens with border separator on mobile
- Tighter padding on mobile (px-3/py-3), full padding on sm+
- Card headers and content use px-3 sm:px-6 to reduce mobile gutters
- Two-column home layout deferred to lg breakpoint (tablet gets stacked)
- Active leagues sorted by completion percentage descending
- Default rank 1 / 0 points for active leagues with no scoring events yet
- Fix ordinal bug for 11th/12th/13th; add aria-labels to rank change indicators
- Remove dead StatDivider className prop
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Improve claude file.
* Add StandingsPreview card component with podium row styling
- New StandingsPreview component with gold/silver/bronze row tints for
top 3, team avatar, and LeagueRow-style stat columns (Ranking + Points)
with rank and 7-day point change indicators
- Fix GradientIcon in Storybook by adding BracktGradients decorator to
preview.tsx (renamed from .ts to support JSX)
- Fix degenerate SVG gradient on horizontal strokes by switching
BracktGradients to gradientUnits="userSpaceOnUse" with Lucide-space
coordinates (0→24)
- Revert erroneous fill: url(#gradient) from GradientIcon; stroke-only
fix was sufficient once gradientUnits was corrected
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Update components on league homepage.
* Finish up league page styling.
* Work on standings page.
* Add story for RecentScoresCard
* Update Point Progression Chart.
* Sort point progression legend by ranking and add team links to standings rows
* Fix standings discrepancy on change.
* Create draft cell component.
* Update draft board page
* Draft room improvements.
* Update some draft room styling.
* Fix context menu missing.
* Move tab navigation and autodraft to header row, narrow sidebar
* Virtualize available participants list, memoize draft room props
Adds @tanstack/react-virtual to replace separate mobile/desktop lists
with a single unified virtual scroll loop. Also memoizes miniDraftGrid
and availableParticipantsSectionProps, and switches pick lookup from
Array.find to a Map for O(1) access.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Update draft room UI.
* More draft room fixes.
* Draft room tweaks.
* Fix Rosters page.
* Queue Section fixes.
* Mobile Draft fixes.
* Fix draft board page.
* Create bracket look.
* Bracket work.
* Finish bracket page.
* Homepage initial styling
* homepage copy
* Add privacy policy. Fixes #88.
* how to play copy
* rules copy
* Fix brackets on homepage.
* Add footer to website.
* Glow on dots.
* Landing page copy.
* Fix sidebar.
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-23 13:14:55 -07:00
|
|
|
"@tanstack/react-virtual": "^3.13.24",
|
2026-03-11 22:02:48 -07:00
|
|
|
"@types/nprogress": "^0.2.3",
|
Migrate authentication from Clerk to BetterAuth (#324)
* Migrate authentication from Clerk to BetterAuth (#322)
Replaces @clerk/react-router with self-hosted better-auth to eliminate
the external Clerk dependency and keep all user/session data in our own
PostgreSQL database.
**What changed**
- New: auth.server.ts (BetterAuth config w/ Drizzle adapter, bcrypt, Resend), auth-client.ts, api.auth.$.ts handler
- New: /login and /register pages with email+password and Google/Discord OAuth; open-redirect guard on redirectTo param
- New: UserMenu component replacing Clerk's UserButton
- Schema: sessions, accounts, verifications tables; emailVerified column; clerkId made nullable
- Migrations 0081 (BetterAuth tables) and 0082 (accounts extra columns for v1.6.9)
- All ~30 route files: getAuth → auth.api.getSession, isUserAdminByClerkId → isUserAdmin
- root.tsx: isAdmin read directly from session.user.isAdmin (no extra DB query)
- useDraftAuthRecovery: removed Clerk JWT refresh logic; replaced with cookie-session check
- models/user.ts: removed findUserByClerkId, findOrCreateUser, updateUserByClerkId (webhook pattern)
- Deleted: app/routes/api/webhooks/clerk.ts; uninstalled @clerk/react-router, @clerk/themes, svix
- scripts/migrate.mjs: extended with idempotent Clerk → BetterAuth data migration (FK conversion, email_verified, OAuth accounts)
- scripts/migrate-clerk-passwords.mjs: one-time script to import bcrypt hashes from Clerk CSV export
- BETTERAUTH_MIGRATION.md: dev and production runbooks
- All test mocks updated: vi.mock('~/lib/auth.server') instead of @clerk/react-router/server
- Test fixtures: added emailVerified field
**Follow-up (post-stable)**
- Rename actor_clerk_id column → actor_user_id in commissioner_audit_log
- Drop clerk_id column from users once migration confirmed
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Add .npmrc with legacy-peer-deps for better-auth/drizzle peer dep conflict
better-auth@1.6.9 declares peerOptional deps on drizzle-orm ^0.45.2 and
drizzle-kit >=0.31.4, but we run drizzle-orm ~0.36.3 / drizzle-kit ~0.28.1.
The adapter works correctly at runtime with our versions — the peer dep is
only for stricter type checking. This unblocks npm ci in CI without a risky
drizzle major-version upgrade.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-24 22:00:49 -07:00
|
|
|
"bcrypt": "^6.0.0",
|
|
|
|
|
"better-auth": "^1.6.9",
|
2025-10-10 23:30:26 -07:00
|
|
|
"class-variance-authority": "^0.7.1",
|
|
|
|
|
"clsx": "^2.1.1",
|
2025-10-10 23:04:50 -07:00
|
|
|
"compression": "^1.8.0",
|
2025-10-15 22:02:21 -07:00
|
|
|
"date-fns": "^4.1.0",
|
2025-10-10 23:04:50 -07:00
|
|
|
"drizzle-orm": "~0.36.3",
|
|
|
|
|
"express": "^5.1.0",
|
|
|
|
|
"isbot": "^5.1.27",
|
New design (#309)
* Redesign home page with new layout and component system
- Two-column layout (My Leagues 2/3, Upcoming Events 1/3) with mobile stack
- LeagueRow: square avatar, gradient draft highlight, rank/points display, progress bar
- MyLeaguesCard, CreateLeagueCard with shared SectionCardHeader
- UpcomingEventsCard: vertical timeline with grouped multi-league events
- Shared gradient system: BracktGradients SVG defs, GradientIcon wrapper, brand.ts constants
- Button default variant updated to green→cyan gradient
- Navbar: plain nav links with gradient hover, support/admin icon buttons
- Accessibility fixes: semantic h2 headings, aria-label on LeagueAvatar and nav elements
- Storybook stories for all new components
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Responsive league row layout and mobile polish
- League rows stack avatar+name on top, stats full-width below on mobile
- Stats spread to right side on sm+ screens with border separator on mobile
- Tighter padding on mobile (px-3/py-3), full padding on sm+
- Card headers and content use px-3 sm:px-6 to reduce mobile gutters
- Two-column home layout deferred to lg breakpoint (tablet gets stacked)
- Active leagues sorted by completion percentage descending
- Default rank 1 / 0 points for active leagues with no scoring events yet
- Fix ordinal bug for 11th/12th/13th; add aria-labels to rank change indicators
- Remove dead StatDivider className prop
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Improve claude file.
* Add StandingsPreview card component with podium row styling
- New StandingsPreview component with gold/silver/bronze row tints for
top 3, team avatar, and LeagueRow-style stat columns (Ranking + Points)
with rank and 7-day point change indicators
- Fix GradientIcon in Storybook by adding BracktGradients decorator to
preview.tsx (renamed from .ts to support JSX)
- Fix degenerate SVG gradient on horizontal strokes by switching
BracktGradients to gradientUnits="userSpaceOnUse" with Lucide-space
coordinates (0→24)
- Revert erroneous fill: url(#gradient) from GradientIcon; stroke-only
fix was sufficient once gradientUnits was corrected
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Update components on league homepage.
* Finish up league page styling.
* Work on standings page.
* Add story for RecentScoresCard
* Update Point Progression Chart.
* Sort point progression legend by ranking and add team links to standings rows
* Fix standings discrepancy on change.
* Create draft cell component.
* Update draft board page
* Draft room improvements.
* Update some draft room styling.
* Fix context menu missing.
* Move tab navigation and autodraft to header row, narrow sidebar
* Virtualize available participants list, memoize draft room props
Adds @tanstack/react-virtual to replace separate mobile/desktop lists
with a single unified virtual scroll loop. Also memoizes miniDraftGrid
and availableParticipantsSectionProps, and switches pick lookup from
Array.find to a Map for O(1) access.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Update draft room UI.
* More draft room fixes.
* Draft room tweaks.
* Fix Rosters page.
* Queue Section fixes.
* Mobile Draft fixes.
* Fix draft board page.
* Create bracket look.
* Bracket work.
* Finish bracket page.
* Homepage initial styling
* homepage copy
* Add privacy policy. Fixes #88.
* how to play copy
* rules copy
* Fix brackets on homepage.
* Add footer to website.
* Glow on dots.
* Landing page copy.
* Fix sidebar.
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-23 13:14:55 -07:00
|
|
|
"lucide-react": "^1.8.0",
|
2025-10-10 23:04:50 -07:00
|
|
|
"morgan": "^1.10.0",
|
2025-10-11 00:29:04 -07:00
|
|
|
"next-themes": "^0.4.6",
|
2026-03-11 22:02:48 -07:00
|
|
|
"nprogress": "^0.2.0",
|
2025-10-10 23:04:50 -07:00
|
|
|
"postgres": "^3.4.5",
|
|
|
|
|
"react": "^19.1.0",
|
2025-10-15 22:02:21 -07:00
|
|
|
"react-day-picker": "^9.11.1",
|
2025-10-10 23:04:50 -07:00
|
|
|
"react-dom": "^19.1.0",
|
2026-04-24 22:29:13 -07:00
|
|
|
"react-is": "^19.2.5",
|
2025-10-10 23:30:26 -07:00
|
|
|
"react-router": "^7.7.1",
|
2025-11-14 21:18:34 -08:00
|
|
|
"recharts": "^3.4.1",
|
2026-03-26 17:17:49 -07:00
|
|
|
"resend": "^6.9.4",
|
2025-10-17 11:13:37 -07:00
|
|
|
"socket.io": "^4.8.1",
|
|
|
|
|
"socket.io-client": "^4.8.1",
|
2025-10-11 00:29:04 -07:00
|
|
|
"sonner": "^2.0.7",
|
Add Zod validation and expand export/import for EV and results data (#14)
* Include participant EV/futures data in data sync export/import
The export now includes the full participantExpectedValues records
(placement probabilities, source, sourceOdds) alongside participants.
On import, EV records are upserted in merge mode and created fresh in
replace mode (cascade handles cleanup). Backward-compatible with older
exports that lack the participantExpectedValues field.
https://claude.ai/code/session_01TVzuuDR7jPtmihaXTrsX7B
* Address all data-sync code review findings
- Wrap importSportsDataFromJSON in a db.transaction() so any mid-import
failure rolls back cleanly instead of leaving partial data
- Add zod validation of imported JSON before any DB writes, giving a
clear error on malformed/incompatible files
- Fix N+1 queries: build participantIdMap during participant import so
the EV and results sections resolve IDs from memory, not extra queries
- Fix merge mode silently skipping existing participants — now updates
shortName, externalId, and expectedValue
- Add participantResults to export/import (was deleted in replace mode
but never exported, so results were permanently lost)
- Restore calculatedAt timestamp on EV import instead of defaulting to
now(); stored as ISO string in the export for portability
- Document that onDelete:cascade covers participantExpectedValues and
participantResults when participants is deleted; remove the now-
redundant explicit participantResults delete from replace mode
- Bump export version to 1.1; old v1.0 files still import cleanly since
participantExpectedValues, participantResults, and calculatedAt are
all optional in the zod schema
- Collapse all six DB fetches in exportSportsDataToJSON into one
Promise.all for parallel execution
- Add countAllParticipants() and countAllParticipantEVs() model funcs
- Show Participants and EV Records counts on the dashboard stat cards
- Replace raw DOM form creation/submit in handleImport with useFetcher,
giving proper loading state, no full-page reload, and type-safe data
- Remove dead export intent handler from the action function
https://claude.ai/code/session_01TVzuuDR7jPtmihaXTrsX7B
---------
Co-authored-by: Claude <noreply@anthropic.com>
2026-02-20 20:25:25 -08:00
|
|
|
"tailwind-merge": "^3.3.1",
|
|
|
|
|
"zod": "^4.3.6"
|
2025-10-10 23:04:50 -07:00
|
|
|
},
|
|
|
|
|
"devDependencies": {
|
|
|
|
|
"@react-router/dev": "^7.7.1",
|
2026-03-29 15:20:48 -07:00
|
|
|
"@storybook/addon-a11y": "^10.3.3",
|
|
|
|
|
"@storybook/addon-docs": "^10.3.3",
|
|
|
|
|
"@storybook/addon-vitest": "^10.3.3",
|
|
|
|
|
"@storybook/react-vite": "^10.3.3",
|
2025-10-10 23:04:50 -07:00
|
|
|
"@tailwindcss/vite": "^4.1.4",
|
2025-10-21 12:47:11 -07:00
|
|
|
"@testing-library/cypress": "^10.1.0",
|
|
|
|
|
"@testing-library/jest-dom": "^6.9.1",
|
|
|
|
|
"@testing-library/react": "^16.3.0",
|
|
|
|
|
"@testing-library/user-event": "^14.6.1",
|
Migrate authentication from Clerk to BetterAuth (#324)
* Migrate authentication from Clerk to BetterAuth (#322)
Replaces @clerk/react-router with self-hosted better-auth to eliminate
the external Clerk dependency and keep all user/session data in our own
PostgreSQL database.
**What changed**
- New: auth.server.ts (BetterAuth config w/ Drizzle adapter, bcrypt, Resend), auth-client.ts, api.auth.$.ts handler
- New: /login and /register pages with email+password and Google/Discord OAuth; open-redirect guard on redirectTo param
- New: UserMenu component replacing Clerk's UserButton
- Schema: sessions, accounts, verifications tables; emailVerified column; clerkId made nullable
- Migrations 0081 (BetterAuth tables) and 0082 (accounts extra columns for v1.6.9)
- All ~30 route files: getAuth → auth.api.getSession, isUserAdminByClerkId → isUserAdmin
- root.tsx: isAdmin read directly from session.user.isAdmin (no extra DB query)
- useDraftAuthRecovery: removed Clerk JWT refresh logic; replaced with cookie-session check
- models/user.ts: removed findUserByClerkId, findOrCreateUser, updateUserByClerkId (webhook pattern)
- Deleted: app/routes/api/webhooks/clerk.ts; uninstalled @clerk/react-router, @clerk/themes, svix
- scripts/migrate.mjs: extended with idempotent Clerk → BetterAuth data migration (FK conversion, email_verified, OAuth accounts)
- scripts/migrate-clerk-passwords.mjs: one-time script to import bcrypt hashes from Clerk CSV export
- BETTERAUTH_MIGRATION.md: dev and production runbooks
- All test mocks updated: vi.mock('~/lib/auth.server') instead of @clerk/react-router/server
- Test fixtures: added emailVerified field
**Follow-up (post-stable)**
- Rename actor_clerk_id column → actor_user_id in commissioner_audit_log
- Drop clerk_id column from users once migration confirmed
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Add .npmrc with legacy-peer-deps for better-auth/drizzle peer dep conflict
better-auth@1.6.9 declares peerOptional deps on drizzle-orm ^0.45.2 and
drizzle-kit >=0.31.4, but we run drizzle-orm ~0.36.3 / drizzle-kit ~0.28.1.
The adapter works correctly at runtime with our versions — the peer dep is
only for stricter type checking. This unblocks npm ci in CI without a risky
drizzle major-version upgrade.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-24 22:00:49 -07:00
|
|
|
"@types/bcrypt": "^6.0.0",
|
2025-10-18 22:16:04 -07:00
|
|
|
"@types/compression": "^1.8.1",
|
|
|
|
|
"@types/express": "^5.0.3",
|
2025-10-10 23:04:50 -07:00
|
|
|
"@types/express-serve-static-core": "^5.0.6",
|
2025-10-18 22:16:04 -07:00
|
|
|
"@types/morgan": "^1.9.10",
|
2025-10-10 23:04:50 -07:00
|
|
|
"@types/node": "^20",
|
|
|
|
|
"@types/pg": "^8.11.14",
|
|
|
|
|
"@types/react": "^19.1.2",
|
|
|
|
|
"@types/react-dom": "^19.1.2",
|
2025-10-21 12:47:11 -07:00
|
|
|
"@vitejs/plugin-react": "^5.0.4",
|
2026-03-29 15:20:48 -07:00
|
|
|
"@vitest/browser": "^3.2.4",
|
2025-10-21 12:47:11 -07:00
|
|
|
"@vitest/coverage-v8": "^3.2.4",
|
|
|
|
|
"@vitest/ui": "^3.2.4",
|
|
|
|
|
"cypress": "^14.5.4",
|
2025-10-10 23:04:50 -07:00
|
|
|
"dotenv-cli": "^8.0.0",
|
2026-04-06 00:07:36 -04:00
|
|
|
"drizzle-kit": "~0.28.1",
|
2025-10-18 22:16:04 -07:00
|
|
|
"esbuild": "^0.25.11",
|
2025-10-21 12:47:11 -07:00
|
|
|
"jsdom": "^27.0.1",
|
2026-03-21 09:44:05 -07:00
|
|
|
"oxlint": "^1.56.0",
|
2026-03-29 15:20:48 -07:00
|
|
|
"playwright": "^1.58.2",
|
2026-03-15 21:52:47 -07:00
|
|
|
"shadcn": "^4.0.8",
|
2026-03-29 15:20:48 -07:00
|
|
|
"storybook": "^10.3.3",
|
|
|
|
|
"storybook-addon-remix-react-router": "^6.1.0",
|
2025-10-10 23:04:50 -07:00
|
|
|
"tailwindcss": "^4.1.4",
|
2025-10-18 22:16:04 -07:00
|
|
|
"tsx": "^4.20.6",
|
2025-10-10 23:30:26 -07:00
|
|
|
"tw-animate-css": "^1.4.0",
|
2025-10-10 23:04:50 -07:00
|
|
|
"typescript": "^5.8.3",
|
|
|
|
|
"vite": "^6.3.3",
|
2025-10-21 12:47:11 -07:00
|
|
|
"vite-tsconfig-paths": "^5.1.4",
|
|
|
|
|
"vitest": "^3.2.4"
|
2025-10-10 23:04:50 -07:00
|
|
|
}
|
2026-03-11 21:45:19 -07:00
|
|
|
}
|