How ataekren/secrethitlertracker works
Project Type and Purpose
• This is a full-stack web application built with Next.js for the frontend and Firebase for the backend (authentication, Firestore, hosting). Its purpose is to track game matches, maintain player statistics, and provide an admin panel for managing data.
Key Components
a. Frontend Components:
• Next.js Pages (located in the app/ directory):
• Public Landing Page (app/page.tsx) that integrates components for Leaderboard, RoleStats, and MatchList.
• Admin Page (app/admin/page.tsx) for managing players and match results.
• Login Page (app/login/page.tsx) for authentication.
• Global layout and not-found handling (app/layout.tsx, app/not-found.tsx).
• UI Components (from the components/ directory):
• Forms for adding players and matches (AddPlayerForm.tsx, AddMatchForm.tsx).
• Components like Leaderboard, RoleStats, MatchList, etc.
• Reusable UI elements under components/ui such as buttons, dialogs, tables, and toast notifications.
b. Backend/Infrastructure:
• Firebase Integration:
• lib/firebase.ts handles Firebase initialization and configuration.
• Firestore is used as the primary database for storing Players and Matches (as detailed in the Data Model).
• Authentication is via Firebase as described in the setup instructions.
• Utilities and Hooks:
• hooks/use-toast.ts and components/use-toast.ts manage in-app notifications.
• lib/utils.ts for shared helper functions.
c. External/Config Components:
• Next.js Configuration (next.config.mjs, tsconfig.json) and environment setup.
• Styling through Tailwind CSS (global CSS, tailwind.config.js/ts).
• ESLint and other development configurations to maintain code quality.
Architectural Relationships and Data Flow
• User Interaction Layer:
• Users (or administrators) navigate to different Next.js pages.
• The Navigator (Navbar component) provides links to login, admin, and main pages.
• UI Component Integration:
• Each page composes several smaller components (e.g., Leaderboard, RoleStats, MatchList) that fetch and display data.
• The forms (AddPlayerForm, AddMatchForm) interact with Firebase through library calls.
• Business Logic / Data Layer:
• The Firebase module manages connections to Firestore and handles real-time data updates.
• Data flows from Firebase directly into the UI components using React Firebase Hooks.
• Authentication:
• The login page secures the Admin Panel, with Firebase handling user authentication.