How mohamedghanem2002/coach works
Player Management Dashboard is a multi-tenant Next.js application for account holders to manage players, branches, attendance, and events, with a separate platform-admin area for academy and captain oversight. The main workflow is sign-in, load the dashboard, then manage player and branch records through tenant-scoped APIs backed by MongoDB (with a local database fallback). The graph preserves documented backup, subscription, and admin capabilities. Some UI-to-API wiring and unsampled feature implementations are inferred only as unverified links.
Main entry points: Home.jsx Player dashboard · tenant.js Tenant authorization · AdminDashboard.jsx Admin dashboard · admin-auth.js Admin authorization
Components 30
User experience
- Sign-in
frontend/pages/SignInPage.jsx - Player dashboard
frontend/pages/Home.jsx - Player management
frontend/components/dashboard/Profile.jsx - Branch management
frontend/components/dashboard/BranchManager.jsx - Events and attendance
frontend/components/dashboard/EventsView.jsx - Dashboard utilities
frontend/lib/dashboard-utils.js
Tenant operations
- Account API
app/api/account/route.js - Player API
app/api/players/route.js - Branch API
app/api/branches/route.js - Event API
app/api/events/route.js - Dashboard bootstrap
app/api/dashboard/bootstrap/route.js - Backup APIs
app/api/backup/route.js - Email backup API
app/api/backup/email/route.js - Snapshot API
app/api/backup/snapshots/route.js
Platform administration
- Admin dashboard
frontend/pages/AdminDashboard.jsx - Captain management
frontend/components/admin/AdminCaptainsTab.jsx - Promotions
frontend/components/admin/AdminPromoTab.jsx - Admin overview API
app/api/admin/overview/route.js - Admin captain APIs
app/api/admin/captains/[id]/route.js - Academy APIs
app/api/admin/academies/[id]/route.js - Audit log API
app/api/admin/audit-logs/route.js
Identity and storage
- Authentication
backend/auth.js - Admin authorization
backend/admin-auth.js - Tenant authorization
backend/tenant.js - Subscription rules
backend/subscription-utils.js - Audit recording
backend/audit.js - Database client
backend/mongodb.js - Local database fallback
backend/localdb.js
Other components
- Account holder
- MongoDB
Connections 41
- Account holder → Sign-in: signs in
README.md - Account holder → Player dashboard: manages records
README.md - Sign-in → Authentication: authenticates through
- Player dashboard → Player management: presents
frontend/pages/Home.jsx - Player dashboard → Branch management: presents
frontend/pages/Home.jsx - Player dashboard → Events and attendance: presents
frontend/pages/Home.jsx - Player management → Dashboard utilities: uses
frontend/pages/Home.jsx - Player management → Player API: manages players
- Branch management → Branch API: manages branches
- Events and attendance → Event API: manages events
- Player dashboard → Dashboard bootstrap: loads data
- Player dashboard → Account API: reads account
- Player dashboard → Backup APIs: restores data
- Player dashboard → Email backup API: requests email backup
- Player dashboard → Snapshot API: manages snapshots
- Admin dashboard → Captain management: renders
frontend/pages/AdminDashboard.jsx - Admin dashboard → Promotions: renders
frontend/pages/AdminDashboard.jsx - Admin dashboard → Admin overview API: loads overview
- Captain management → Admin captain APIs: manages captains
- Admin dashboard → Academy APIs: manages academies
- Admin dashboard → Audit log API: views audit logs
- Authentication → Database client: reads users
backend/auth.js - Admin authorization → Authentication: checks session
backend/admin-auth.js - Admin authorization → Database client: checks admin
backend/admin-auth.js - Tenant authorization → Authentication: checks session
backend/tenant.js - Tenant authorization → Database client: resolves tenant
backend/tenant.js - Player API → Tenant authorization: requires tenant
app/api/players/route.js - Event API → Tenant authorization: requires tenant
app/api/events/route.js - Branch API → Tenant authorization: requires tenant
app/api/branches/route.js - Dashboard bootstrap → Tenant authorization: requires tenant
app/api/dashboard/bootstrap/route.js - Backup APIs → Tenant authorization: resolves tenant
app/api/backup/route.js - Account API → Authentication: checks session
app/api/account/route.js - Account API → Subscription rules: calculates status
app/api/account/route.js - Admin captain APIs → Admin authorization: requires admin
app/api/admin/captains/[id]/route.js - Admin captain APIs → Subscription rules: updates subscriptions
app/api/admin/captains/[id]/route.js - Admin captain APIs → Audit recording: records actions
app/api/admin/captains/[id]/route.js - Academy APIs → Admin authorization: requires admin
app/api/admin/academies/[id]/route.js - Academy APIs → Audit recording: records actions
app/api/admin/academies/[id]/route.js - Admin overview API → Admin authorization: requires admin
app/api/admin/overview/route.js - Database client → MongoDB: connects to
backend/mongodb.js - Database client → Local database fallback: falls back to
backend/mongodb.js