How jose26398/unitgol works
Project Type and Purpose
• UnitGol is a client-side Progressive Web App (PWA) built with React, TypeScript, Vite, and Tailwind.
• It has no traditional server backend; data is stored locally in the browser (IndexedDB).
• Core features: match management, player statistics, and a smart team generator algorithm.
File Structure
• Top-level config/build: vite.config.ts, tsconfig*.json, postcss.config.js, tailwind.config.js
• public/: static assets and service worker/manifest for PWA
• src/: application code
• components/: UI broken into feature subfolders (Matches, Players, NewMatch, Seasons, TeamGenerator)
• db/: database schema and initialization (IndexedDB wrapper)
• hooks/: custom React hooks for data access (useDatabase.ts, useNewMatchForm.ts)
• utils/: algorithmic logic (playerStats.ts)
• types/: shared TypeScript definitions
• App.tsx & main.tsx: entry points
README for Additional Insights
• Progressive Web App with local data persistence
• Built with React + Vite + Tailwind
• No external API calls; everything runs in the browser
• Key modules: match tracking UIs, player profile UIs, team generation logic
Main Components & Their Relationships
a. Static Hosting Layer
• Vite build outputs static assets (HTML, JS, CSS).
• Served by any static file host (e.g., Render).
b. Frontend Application (Browser)
1. Service Worker & Manifest
• Enables offline support, installability, and caching.
2. UI Layer (React Components)
• Organized into feature modules:
– Matches (list view, detail view, modals)
– Players (list, new-player form)
– Seasons (selectors, stats, manager)
– NewMatch (forms for date, teams, goals)
– TeamGenerator (algorithm interface)
– Settings & ShareButton
3. State & Data Access
• Custom hooks (useDatabase) abstract database operations.
• useNewMatchForm orchestrates form state.
4. Local Database (IndexedDB)
• Defined in src/db/index.ts — likely using Dexie or idb.
• Stores matches, players, seasons.
5. Business Logic / Utilities
• playerStats.ts computes metrics (goals, assists, win rates).
• TeamGenerator.tsx uses these metrics to balance teams.
Architectural Patterns & Principles
• Modular feature grouping: UI components co-located by feature folder.
• Separation of concerns:
• UI (components)
• Data layer (hooks + db)
• Business logic (utils)
• PWA pattern: service worker, manifest, offline caching.
• Type safety: all shared types in src/types.