How therageon/goalytics works
Goalytics lets users register, browse World Cup fixtures, submit score predictions, earn points when matches finish, and compete on a leaderboard; admins manage fixtures, users, and withdrawals. The frontend is a Next.js app and the backend exposes Express APIs backed by MongoDB models. The graph follows documented routes and sampled service calls. Frontend-to-API wiring and several unsampled page interactions are not shown, so those links are omitted.
Main entry points: server.js Express server · authMiddleware.js JWT guard · User.js User records · statsController.js Dashboard stats
Components 27
Web experience
- Player pages
frontend/app/user - Admin pages
frontend/app/admin - Sign-in pages
frontend/app/login/page.jsx - API client
frontend/lib/api.js
API and access
- Express server
backend/server.js - Auth routes
backend/routes/authRoutes.js - Match routes
backend/routes/matchRoutes.js - Prediction routes
backend/routes/predictionRoutes.js - Stats routes
backend/routes/statsRoutes.js - User routes
backend/routes/userRoutes.js - Withdrawal routes
backend/routes/withdrawRoutes.js - JWT guard
backend/middleware/authMiddleware.js - Admin guard
backend/middleware/adminMiddleware.js
Prediction domain
- Fixture management
backend/controllers/matchController.js - Prediction scoring
backend/services/predictionService.js - Match service
backend/services/matchService.js - Dashboard stats
backend/controllers/statsController.js
Accounts and payouts
- Authentication
backend/services/authService.js - Withdrawals
backend/services/withdrawService.js - User management
backend/services/userService.js
Persistent data
- User records
backend/model/User.js - Match records
backend/model/Match.js - Prediction records
backend/model/Prediction.js - Withdrawal records
backend/model/Withdraw.js
Other components
- Players
- Administrators
- MongoDB
Connections 40
- Players → Player pages: uses
- Administrators → Admin pages: manages
- Players → Sign-in pages: registers
- Express server → Auth routes: mounts
backend/server.js - Express server → Match routes: mounts
backend/server.js - Express server → Prediction routes: mounts
backend/server.js - Express server → Stats routes: mounts
backend/server.js - Express server → User routes: mounts
backend/server.js - Express server → Withdrawal routes: mounts
backend/server.js - Auth routes → JWT guard: protects password change
backend/routes/authRoutes.js - Auth routes → Authentication: routes to
backend/routes/authRoutes.js - Match routes → Fixture management: routes to
backend/routes/matchRoutes.js - Match routes → JWT guard: protects admin actions
backend/routes/matchRoutes.js - Match routes → Admin guard: guards admin actions
backend/routes/matchRoutes.js - Prediction routes → JWT guard: protects routes
backend/routes/predictionRoutes.js - Prediction routes → Prediction scoring: routes to
backend/routes/predictionRoutes.js - Stats routes → Dashboard stats: routes to
backend/routes/statsRoutes.js - Stats routes → JWT guard: protects routes
backend/routes/statsRoutes.js - Stats routes → Admin guard: guards admin stats
backend/routes/statsRoutes.js - Withdrawal routes → Withdrawals: routes to
backend/routes/withdrawRoutes.js - Withdrawal routes → JWT guard: protects user routes
backend/routes/withdrawRoutes.js - Withdrawal routes → Admin guard: guards admin routes
backend/routes/withdrawRoutes.js - User routes → User management: routes to
backend/routes/userRoutes.js - JWT guard → User records: loads user
backend/middleware/authMiddleware.js - Fixture management → Match service: manages fixtures through
backend/controllers/matchController.js - Fixture management → Prediction scoring: evaluates finished matches
backend/controllers/matchController.js - Match service → Match records: queries
backend/services/matchService.js - Match service → Prediction records: deletes related predictions
backend/services/matchService.js - Prediction scoring → Match records: checks match state
backend/services/predictionService.js - Prediction scoring → Prediction records: creates and scores
backend/services/predictionService.js - Prediction scoring → User records: updates points
backend/services/predictionService.js - Dashboard stats → User records: queries
backend/controllers/statsController.js - Dashboard stats → Match records: queries
backend/controllers/statsController.js - Dashboard stats → Prediction records: queries
backend/controllers/statsController.js - Dashboard stats → Withdrawal records: counts pending requests
backend/controllers/statsController.js - Authentication → User records: authenticates and stores
backend/services/authService.js - Withdrawals → User records: reads and updates
backend/services/withdrawService.js - Withdrawals → Withdrawal records: manages requests
backend/services/withdrawService.js - User management → User records: queries
backend/services/userService.js - User management → Prediction records: queries predictions
backend/services/userService.js