How suvash23/football-chaos works
1. Overall shape
- This is a single Next.js 15 App Router application for a football-themed entertainment product.
- The repo is mostly a frontend shell + Supabase-backed data/auth layer, with one explicit server API route and a set of static/domain pages.
2. Application shell
- src/app/layout.tsx and src/app/globals.css define the shared app frame and global styling.
- The shared chrome is split into reusable UI pieces like src/components/navbar.tsx and src/components/footer.tsx, which likely wrap most pages consistently.
3. User-facing routes
- The main feature surfaces are separate routes under src/app/*:
- / landing page
- /auth authentication entry
- /profile user profile
- /leaderboard fan ranking view
- /predictions match predictions
- /bingo chaos bingo
- /var-simulator image-based VAR simulator
- /excuses excuse generator
- /groups and /bracket tournament/group views
- /admin administrative surface
- Architecturally, these are independent route segments rather than a single SPA view, which makes the app easy to diagram as a set of feature modules around a shared shell.
4. Server-side API boundary
- The only explicit API endpoint in the tree is src/app/api/calculate-points/route.ts.
- This is the main server boundary for scoring/prediction logic: it likely receives match or prediction data, computes points, and returns results to the frontend.
- This is important architecturally because it separates interactive UI flows from trusted scoring logic.
5. Data and persistence layer
- The backend persistence layer is Supabase, wired through src/lib/supabase.ts.
- The README says Supabase provides both database and auth, so the data flow is:
- browser UI → Supabase auth/session
- browser or server route → Supabase database tables
- database-schema.sql defines the required tables, including profiles, matches, predictions, bingo cards, and leaderboard entries.
6. Static domain data
- The app also relies on local JSON/TS assets in src/lib/:
- worldcup.json
- teams_meta.json
- data.ts
- These likely provide fixture/team metadata and seeded domain content, reducing dependence on live external sports APIs.
- supabase_matches_import.json suggests a bulk import dataset for match records.
7. Auth and user state
- src/hooks/use-auth.ts is the dedicated client-side auth hook.
- This is the main boundary between anonymous vs authenticated behavior in the UI, and probably feeds profile/leaderboard/prediction screens with the current user/session.
8. UI system
- The src/components/ui/* directory is a shadcn/ui-style component library wrapper.
- These primitives (button, card, dialog, tabs, sheet, select, etc.) are the app’s presentation layer and are reused across the route pages rather than each page building its own controls.
- components.json, Tailwind/PostCSS config, and src/app/globals.css indicate a design-system-oriented frontend.
9. Feature composition
- The repo appears organized by feature screens, not by backend service.
- Each page likely composes:
- shared UI primitives
- the auth hook/session state
- local domain data from src/lib
- Supabase reads/writes for persisted user data
- That makes the architecture straightforward: most complexity stays in the client feature pages, while persistence stays centralized.
10. Operational scripts and bootstrapping
- scripts/seed.mjs is the local data seeding path, likely used to populate Supabase or prepared datasets for the app.
- database-schema.sql is the source of truth for database setup, which means repo onboarding includes a manual schema step rather than migrations in-app.
11. Deployment/runtime
- Dockerfile and vercel.json show the app is designed to run in both containerized and Vercel hosting contexts.
- The README explicitly targets Vercel deployment with environment variables for Supabase URL and anon key.
- That means the runtime architecture is a standard Next.js frontend deployed serverlessly, with Supabase as the external managed backend.
12. External dependencies that materially affect architecture
- Supabase: persistence and authentication backbone.
- Next.js App Router: determines route structure, server/client split, and API route placement.
- Tailwind CSS v4 + shadcn/ui: shapes the component architecture and styling strategy.
13. What to draw in an architecture diagram
- A central Next.js app box containing route modules and UI components.
- A separate Supabase box for auth + database.
- One small server API boundary for /api/calculate-points.
- A local static data box for JSON fixtures and seed data feeding match/team content.
- Shared UI primitives as an internal library reused by all feature pages.
Main entry points: layout.tsx App Layout · supabase.ts Supabase · data.ts Domain Data · page.tsx Predictions
Components 20
App Shell
Shared frame and styling for the Next.js app
- App Layout · Root application frame and shared providers
src/app/layout.tsx - Global CSS · App-wide styling foundation
src/app/globals.css - Navbar · Top-level navigation used across pages
src/components/navbar.tsx - Footer · Shared footer for the app
src/components/footer.tsx
Feature Routes
Independent App Router pages
- Home · Landing page
src/app/page.tsx - Auth · Authentication entry page
src/app/auth/page.tsx - Profile · User profile view
src/app/profile/page.tsx - Leaderboard · Fan ranking and scoring view
src/app/leaderboard/page.tsx - Predictions · Match prediction workflow
src/app/predictions/page.tsx - Bingo · Chaos bingo game page
src/app/bingo/page.tsx - VAR Simulator · Image-based VAR simulator
src/app/var-simulator/page.tsx - Excuses · Excuse generator page
src/app/excuses/page.tsx - Groups · Tournament group view
src/app/groups/page.tsx - Bracket · Tournament bracket view
src/app/bracket/page.tsx - Admin · Administrative surface
src/app/admin/page.tsx
Data & Services
API, persistence, and local domain datasets
- Points API · Trusted scoring endpoint for prediction results
src/app/api/calculate-points/route.ts - Supabase · Shared Supabase integration for auth and persistence
src/lib/supabase.ts - Domain Data · Local tournament and team metadata used by features
src/lib/data.ts - Schema & Seed · Database schema and seed/import inputs
database-schema.sql
UI Kit
Reusable presentation components
- UI Kit · Reusable shadcn-style UI primitives
src/components/ui
Connections 33
- App Layout → Global CSS: loads · Global styling is applied through the root layout
- App Layout → Navbar: includes · Shared navigation is mounted in the app shell
- App Layout → Footer: includes · Shared footer is mounted in the app shell
- App Layout → UI Kit: wraps · Pages are composed from shared UI primitives
- Home → App Layout: uses · Landing page is rendered within the shared shell
- Auth → App Layout: uses · Auth page is rendered within the shared shell
- Profile → App Layout: uses · Profile page is rendered within the shared shell
- Leaderboard → App Layout: uses · Leaderboard page is rendered within the shared shell
- Predictions → App Layout: uses · Predictions page is rendered within the shared shell
- Bingo → App Layout: uses · Bingo page is rendered within the shared shell
- VAR Simulator → App Layout: uses · VAR simulator page is rendered within the shared shell
- Excuses → App Layout: uses · Excuses page is rendered within the shared shell
- Groups → App Layout: uses · Groups page is rendered within the shared shell
- Bracket → App Layout: uses · Bracket page is rendered within the shared shell
- Admin → App Layout: uses · Admin page is rendered within the shared shell
- Auth → Supabase: auth · Authentication flows through Supabase
- Profile → Supabase: reads/writes · Profile state is backed by Supabase data
- Leaderboard → Supabase: reads · Leaderboard data is sourced from Supabase
- Predictions → Supabase: reads/writes · Prediction state is persisted in Supabase
- Bingo → Supabase: reads/writes · Game progress can be stored in Supabase
- Groups → Supabase: reads · Tournament group data is backed by Supabase
- Bracket → Supabase: reads · Bracket state is backed by Supabase
- Admin → Supabase: admin data · Administrative actions operate on Supabase data
- Predictions → Points API: scores · Client prediction flow calls trusted scoring logic
- Points API → Supabase: persists · Scoring endpoint can read or update persisted match data
- Points API → Domain Data: uses · Scoring logic depends on local tournament data
- Home → Domain Data: uses · Landing content can be driven by local domain datasets
- Predictions → Domain Data: uses · Prediction UI uses team and fixture metadata
- Bingo → Domain Data: uses · Game content can be generated from local football data
- VAR Simulator → Domain Data: uses · Simulator content uses local tournament metadata
- Groups → Domain Data: uses · Group standings and fixtures rely on local tournament data
- Bracket → Domain Data: uses · Bracket rendering relies on local tournament data
- Schema & Seed → Supabase: bootstraps · Schema and seed assets define the persistent backend model