Back

CFB Fantasy Architecture

Full-Stack System Overview & Modules

CFB Fantasy ArchitectureFull-Stack System OverviewNext.js 15React 19TypeScriptCLIENT LAYERDraft RoomReal-time PicksSnake & AuctionLeague DashboardStandings & StatsMatchups & ScoresTeam ManagerRoster & LineupWaivers & TradesAPI LAYERNext.js API Routes37 Endpoints/api/draft/*/api/leagues/*/api/scoring/*/api/cron/*/api/auth/*SUPABASE LAYERAuthJWT TokensSession ManagementRealtimeWebSocket Pub/Sub<100ms LatencyRLS PoliciesRow Level SecurityPer-User Data AccessDATABASE LAYERPostgreSQL18 Tables | 28 Migrationsleaguesteamsplayersrostersdraft_picksdraft_sessionsmatchupsplayer_statsgamesprofilestransactions3D / ASSETS LAYERReact Three Fiber3D Helmet CustomizerVercel CDNGLB Models & Static AssetsCFBD API | ESPN | Resend Email
View

System Overview

Full-Stack Architecture

Real-Time Draft SystemWebSocket State SynchronizationUSER ACTIONMake PickPlace BidDRAFT ROOM UIPlayer ListSearchablePosition FiltersPick Timer30s - 300sServer-syncedMy RosterDraft PicksPosition SlotsVALIDATION LAYERServer-Side ValidationIs it your turn?Player available?Valid roster slot?Snake order checkNot drafted yetPosition capSUPABASE REALTIMEBroadcast Pick to All Clients< 100msWebSocket Pub/Sub | Postgres ChangesSTATE UPDATENext TurnSnake LogicRound flip calcDraft BoardPick HistoryAll teams viewAuto-PickQueue / Best AvailTimer expire triggerDATABASE PERSISTdraft_sessionsdraft_picksrostersteamsSnake Draft | Auction Draft
View

Real-Time Draft

WebSocket & State Machine

Authentication & SecuritySupabase Auth + Row Level SecurityUSEREmail/PasswordSign up / Sign inOAuthGoogle / DiscordSUPABASE AUTHJWT Token1 hour expiryAuto-refreshSession Cookie7 day expiryHTTP-only secureEmail VerifyConfirmation linkhCaptcha protectedMIDDLEWAREmiddleware.tsAuto-refresh expired tokensProtected:/dashboard, /leagues/*, /profilePublic:/auth/*, /about, /blog, /ROW LEVEL SECURITYLeague AccessMembers only viewCommissioner editTeam OwnerOwn teams onlyRoster changesDraft TurnCurrent picker onlyPick validationPROTECTED DATAOnly YOUR Data VisibleLeagues | Teams | Rosters | Draft PicksOthers hidden at database level - zero trust architecture
View

Authentication

Supabase Auth & RLS

Projections PipelineETL Data Ingestion & Fantasy ScoringDATA SOURCESCFBD APIPlayer statsGame resultsESPN JSONScoreboard dataGame statusLive ScoresReal-time updatesIn-game statsVERCEL CRON JOBS/api/cron/update-game-statusesEvery minute during games/api/cron/calculate-scoresFantasy point calculation/api/cron/check-week-completionFinalize matchupsTRANSFORM & CALCULATEFantasy Scoring AlgorithmPassing0.04 pts/yard4 pts/TD-2 pts/INTRushing0.1 pts/yard6 pts/TD-1 pts/fumbleReceiving0.1 pts/yard6 pts/TDPPR: +1/catchDATABASE STORAGEgamesGame statusFinal scoresplayer_statsWeekly statsFantasy pointsmatchupsTeam scoresWin/loss recordLIVE UPDATESupabase Realtime → Scoreboard UIEvery 60 seconds
View

Projections

ETL & Scoring Pipeline

Helmet Editor ArchitectureReact Three Fiber + Zone-Based CustomizationUSER INPUTColor PickerZone selectionMaterial SelectFinish typeStripe PatternBezier curvesZUSTAND STOREHelmet ConfigurationshellColorfacemaskColorchinstrapColorpaddingColorstripeColormaterialFinish4 finish types5 color zones5-ZONE SYSTEMShellMain bodyFacemaskGrillChinstrapStrapPaddingInnerStripeDecalPer-Zone ColorsIndependent controlTeam branding readyMATERIAL FINISHESGlossyclearcoat: 1Matteroughness: 0.9Chromemetalness: 1Brushedanisotropy: 1REACT THREE FIBERMeshPhysicalMaterialclearcoatmetalnessroughnesssheen60fps previewReal-timeOUTPUTGLB Export → Vercel CDNBlender-generated base model | Web-optimized
View

Helmet Editor

R3F Scene Graph