# athilingam3336-dotcom/cricket1 architecture

> Architecture diagram of the GitHub repository athilingam3336-dotcom/cricket1, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/athilingam3336-dotcom/cricket1
- Repository: https://github.com/athilingam3336-dotcom/cricket1

## Overview

CFVD CricNative combines a public district-cricket portal, mobile access to that portal, and authenticated team, administrator, and scorer workflows backed by an Express API. The public workflow presents federation information, fixtures, scorecards, standings, player statistics, registrations, and media. Scorers authenticate, configure a match, record deliveries, and view scorecards; teams register and manage profiles, while administrators oversee approvals and federation data. Backend excerpts establish key routes, service calls, scoring persistence, and authentication; README capabilities supplement unsampled portal features.

Main entry points: [`App.js`](https://github.com/athilingam3336-dotcom/cricket1/blob/main/App.js) (Portal shell), [`backend/config/db.js`](https://github.com/athilingam3336-dotcom/cricket1/blob/main/backend/config/db.js) (Database store), [`backend/services/authService.js`](https://github.com/athilingam3336-dotcom/cricket1/blob/main/backend/services/authService.js) (Authentication service), [`backend/routes/scorerRoutes.js`](https://github.com/athilingam3336-dotcom/cricket1/blob/main/backend/routes/scorerRoutes.js) (Scorer routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_public["Public cricket portal"]
  node_portal["Portal shell<br/>[App.js]"]
  node_cricketdata["Cricket content data<br/>[cricketData.js]"]
  node_registration["Registration portal"]
  node_scorecard["Match scorecards<br/>[ScorecardModal.js]"]
  node_league["Standings and stats"]
  node_publicfeatures["Federation features"]
end

subgraph group_mobile["Mobile experiences"]
  node_mobileapp["Mobile app host<br/>[App.tsx]"]
  node_adminui["Admin workspace"]
  node_teamui["Team access screens"]
  node_scorerui["Scorer workflow screens"]
  node_adminapi["Admin API client<br/>[adminApi.ts]"]
  node_mobileapi["App API client<br/>[api.ts]"]
end

subgraph group_identity["Identity and administration"]
  node_server["Express API server<br/>[server.js]"]
  node_adminroutes["Admin routes<br/>[adminRoutes.js]"]
  node_admincontroller["Admin management"]
  node_adminservice["Admin approvals<br/>[adminService.js]"]
  node_authroutes["Authentication routes<br/>[authRoutes.js]"]
  node_authcontroller["Authentication controller<br/>[authController.js]"]
  node_authservice["Authentication service<br/>[authService.js]"]
  node_authmiddleware["Token authorization<br/>[authMiddleware.js]"]
end

subgraph group_competition["Competition operations"]
  node_teamroutes["Team routes<br/>[teamRoutes.js]"]
  node_teamservice["Team registration<br/>[teamService.js]"]
  node_scorerroutes["Scorer routes<br/>[scorerRoutes.js]"]
  node_scorerservice["Scorer match views<br/>[scorerService.js]"]
  node_matchservice["Match setup<br/>[matchService.js]"]
  node_scoringengine["Ball scoring engine<br/>[scoringEngine.js]"]
  node_playerservice["Player services<br/>[playerService.js]"]
end

subgraph group_data["Data and messaging"]
  node_database[("Database store<br/>[db.js]")]
  node_usermodel["User records<br/>[userModel.js]"]
  node_scorermodel["Scorer records<br/>[scorerModel.js]"]
  node_teammodel["Team records<br/>[teamModel.js]"]
  node_otp["OTP service<br/>[otpService.js]"]
  node_mailer["Email delivery<br/>[mailer.js]"]
end

node_visitor(("Federation visitor"))

node_visitor -->|"browses"| node_portal
node_portal -->|"uses content"| node_cricketdata
node_portal -->|"opens enrollment"| node_registration
node_portal -->|"opens scorecard"| node_scorecard
node_portal -->|"shows standings"| node_league
node_portal -->|"presents"| node_publicfeatures
node_mobileapp -->|"embeds portal"| node_portal
node_mobileapp -->|"opens scorer mode"| node_scorerui
node_mobileapp -->|"opens team mode"| node_teamui
node_adminui -.->|"requests data"| node_adminapi
node_teamui -.->|"requests data"| node_mobileapi
node_scorerui -.->|"requests data"| node_mobileapi
node_server -->|"mounts routes"| node_adminroutes
node_server -->|"mounts routes"| node_teamroutes
node_server -.->|"mounts player API"| node_playerservice
node_adminroutes -->|"dispatches requests"| node_admincontroller
node_adminroutes -->|"calls approvals"| node_adminservice
node_adminroutes -->|"guards routes"| node_authmiddleware
node_admincontroller -->|"reads and writes"| node_database
node_authroutes -->|"dispatches requests"| node_authcontroller
node_authcontroller -->|"calls authentication"| node_authservice
node_authcontroller -->|"checks mail"| node_mailer
node_authservice -->|"uses user records"| node_usermodel
node_authservice -->|"uses scorer records"| node_scorermodel
node_authservice -->|"generates OTP"| node_otp
node_teamroutes -->|"calls team operations"| node_teamservice
node_teamservice -->|"uses team records"| node_teammodel
node_scorerroutes -->|"handles registration"| node_authservice
node_scorerroutes -->|"loads match views"| node_scorerservice
node_scorerroutes -->|"configures matches"| node_matchservice
node_scorerroutes -->|"records deliveries"| node_scoringengine
node_scoringengine -->|"updates score state"| node_database
node_scoringengine -.->|"publishes live updates"| node_scorerservice
node_adminservice -->|"uses persistence"| node_database
node_adminservice -->|"uses verification codes"| node_otp
node_adminservice -->|"sends email"| node_mailer
node_usermodel -->|"reads and writes"| node_database
node_scorermodel -->|"reads and writes"| node_database
node_teammodel -->|"reads and writes"| node_database

click node_portal "https://github.com/athilingam3336-dotcom/cricket1/blob/main/App.js"
click node_cricketdata "https://github.com/athilingam3336-dotcom/cricket1/blob/main/src/data/cricketData.js"
click node_registration "https://github.com/athilingam3336-dotcom/cricket1/blob/main/src/components/RegistrationModal.js"
click node_scorecard "https://github.com/athilingam3336-dotcom/cricket1/blob/main/src/components/ScorecardModal.js"
click node_league "https://github.com/athilingam3336-dotcom/cricket1/blob/main/src/components/PointsTableSection.js"
click node_publicfeatures "https://github.com/athilingam3336-dotcom/cricket1/tree/main/src/components"
click node_mobileapp "https://github.com/athilingam3336-dotcom/cricket1/blob/main/mobile_frontend/App.tsx"
click node_adminui "https://github.com/athilingam3336-dotcom/cricket1/tree/main/mobile_frontend/src/admin"
click node_teamui "https://github.com/athilingam3336-dotcom/cricket1/blob/main/mobile_frontend/src/screens/team/TeamLoginScreen.tsx"
click node_scorerui "https://github.com/athilingam3336-dotcom/cricket1/blob/main/mobile_frontend/src/screens/scorer/LiveScoringScreen.tsx"
click node_adminapi "https://github.com/athilingam3336-dotcom/cricket1/blob/main/mobile_frontend/src/admin/services/adminApi.ts"
click node_mobileapi "https://github.com/athilingam3336-dotcom/cricket1/blob/main/mobile_frontend/src/services/api.ts"
click node_server "https://github.com/athilingam3336-dotcom/cricket1/blob/main/backend/server.js"
click node_adminroutes "https://github.com/athilingam3336-dotcom/cricket1/blob/main/backend/routes/adminRoutes.js"
click node_admincontroller "https://github.com/athilingam3336-dotcom/cricket1/blob/main/backend/controllers/adminDashboardController.js"
click node_adminservice "https://github.com/athilingam3336-dotcom/cricket1/blob/main/backend/services/adminService.js"
click node_authroutes "https://github.com/athilingam3336-dotcom/cricket1/blob/main/backend/routes/authRoutes.js"
click node_authcontroller "https://github.com/athilingam3336-dotcom/cricket1/blob/main/backend/controllers/authController.js"
click node_authservice "https://github.com/athilingam3336-dotcom/cricket1/blob/main/backend/services/authService.js"
click node_authmiddleware "https://github.com/athilingam3336-dotcom/cricket1/blob/main/backend/middleware/authMiddleware.js"
click node_teamroutes "https://github.com/athilingam3336-dotcom/cricket1/blob/main/backend/routes/teamRoutes.js"
click node_teamservice "https://github.com/athilingam3336-dotcom/cricket1/blob/main/backend/services/teamService.js"
click node_scorerroutes "https://github.com/athilingam3336-dotcom/cricket1/blob/main/backend/routes/scorerRoutes.js"
click node_scorerservice "https://github.com/athilingam3336-dotcom/cricket1/blob/main/backend/services/scorerService.js"
click node_matchservice "https://github.com/athilingam3336-dotcom/cricket1/blob/main/backend/services/matchService.js"
click node_scoringengine "https://github.com/athilingam3336-dotcom/cricket1/blob/main/backend/services/scoringEngine.js"
click node_playerservice "https://github.com/athilingam3336-dotcom/cricket1/blob/main/backend/services/playerService.js"
click node_database "https://github.com/athilingam3336-dotcom/cricket1/blob/main/backend/config/db.js"
click node_usermodel "https://github.com/athilingam3336-dotcom/cricket1/blob/main/backend/models/userModel.js"
click node_scorermodel "https://github.com/athilingam3336-dotcom/cricket1/blob/main/backend/models/scorerModel.js"
click node_teammodel "https://github.com/athilingam3336-dotcom/cricket1/blob/main/backend/models/teamModel.js"
click node_otp "https://github.com/athilingam3336-dotcom/cricket1/blob/main/backend/services/otpService.js"
click node_mailer "https://github.com/athilingam3336-dotcom/cricket1/blob/main/backend/config/mailer.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_portal,node_cricketdata,node_registration,node_scorecard,node_league,node_publicfeatures toneBlue
class node_mobileapp,node_adminui,node_teamui,node_scorerui,node_adminapi,node_mobileapi toneAmber
class node_server,node_adminroutes,node_admincontroller,node_adminservice,node_authroutes,node_authcontroller,node_authservice,node_authmiddleware toneMint
class node_teamroutes,node_teamservice,node_scorerroutes,node_scorerservice,node_matchservice,node_scoringengine,node_playerservice toneRose
class node_database,node_usermodel,node_scorermodel,node_teammodel,node_otp,node_mailer,node_visitor toneIndigo
```

## Components

### Public cricket portal

- [Portal shell](https://github.com/athilingam3336-dotcom/cricket1/blob/main/App.js): `App.js`
- [Cricket content data](https://github.com/athilingam3336-dotcom/cricket1/blob/main/src/data/cricketData.js): `src/data/cricketData.js`
- [Registration portal](https://github.com/athilingam3336-dotcom/cricket1/blob/main/src/components/RegistrationModal.js): `src/components/RegistrationModal.js`
- [Match scorecards](https://github.com/athilingam3336-dotcom/cricket1/blob/main/src/components/ScorecardModal.js): `src/components/ScorecardModal.js`
- [Standings and stats](https://github.com/athilingam3336-dotcom/cricket1/blob/main/src/components/PointsTableSection.js): `src/components/PointsTableSection.js`
- [Federation features](https://github.com/athilingam3336-dotcom/cricket1/tree/main/src/components): `src/components`

### Mobile experiences

- [Mobile app host](https://github.com/athilingam3336-dotcom/cricket1/blob/main/mobile_frontend/App.tsx): `mobile_frontend/App.tsx`
- [Admin workspace](https://github.com/athilingam3336-dotcom/cricket1/tree/main/mobile_frontend/src/admin): `mobile_frontend/src/admin`
- [Team access screens](https://github.com/athilingam3336-dotcom/cricket1/blob/main/mobile_frontend/src/screens/team/TeamLoginScreen.tsx): `mobile_frontend/src/screens/team/TeamLoginScreen.tsx`
- [Scorer workflow screens](https://github.com/athilingam3336-dotcom/cricket1/blob/main/mobile_frontend/src/screens/scorer/LiveScoringScreen.tsx): `mobile_frontend/src/screens/scorer/LiveScoringScreen.tsx`
- [Admin API client](https://github.com/athilingam3336-dotcom/cricket1/blob/main/mobile_frontend/src/admin/services/adminApi.ts): `mobile_frontend/src/admin/services/adminApi.ts`
- [App API client](https://github.com/athilingam3336-dotcom/cricket1/blob/main/mobile_frontend/src/services/api.ts): `mobile_frontend/src/services/api.ts`

### Identity and administration

- [Express API server](https://github.com/athilingam3336-dotcom/cricket1/blob/main/backend/server.js): `backend/server.js`
- [Admin routes](https://github.com/athilingam3336-dotcom/cricket1/blob/main/backend/routes/adminRoutes.js): `backend/routes/adminRoutes.js`
- [Admin management](https://github.com/athilingam3336-dotcom/cricket1/blob/main/backend/controllers/adminDashboardController.js): `backend/controllers/adminDashboardController.js`
- [Admin approvals](https://github.com/athilingam3336-dotcom/cricket1/blob/main/backend/services/adminService.js): `backend/services/adminService.js`
- [Authentication routes](https://github.com/athilingam3336-dotcom/cricket1/blob/main/backend/routes/authRoutes.js): `backend/routes/authRoutes.js`
- [Authentication controller](https://github.com/athilingam3336-dotcom/cricket1/blob/main/backend/controllers/authController.js): `backend/controllers/authController.js`
- [Authentication service](https://github.com/athilingam3336-dotcom/cricket1/blob/main/backend/services/authService.js): `backend/services/authService.js`
- [Token authorization](https://github.com/athilingam3336-dotcom/cricket1/blob/main/backend/middleware/authMiddleware.js): `backend/middleware/authMiddleware.js`

### Competition operations

- [Team routes](https://github.com/athilingam3336-dotcom/cricket1/blob/main/backend/routes/teamRoutes.js): `backend/routes/teamRoutes.js`
- [Team registration](https://github.com/athilingam3336-dotcom/cricket1/blob/main/backend/services/teamService.js): `backend/services/teamService.js`
- [Scorer routes](https://github.com/athilingam3336-dotcom/cricket1/blob/main/backend/routes/scorerRoutes.js): `backend/routes/scorerRoutes.js`
- [Scorer match views](https://github.com/athilingam3336-dotcom/cricket1/blob/main/backend/services/scorerService.js): `backend/services/scorerService.js`
- [Match setup](https://github.com/athilingam3336-dotcom/cricket1/blob/main/backend/services/matchService.js): `backend/services/matchService.js`
- [Ball scoring engine](https://github.com/athilingam3336-dotcom/cricket1/blob/main/backend/services/scoringEngine.js): `backend/services/scoringEngine.js`
- [Player services](https://github.com/athilingam3336-dotcom/cricket1/blob/main/backend/services/playerService.js): `backend/services/playerService.js`

### Data and messaging

- [Database store](https://github.com/athilingam3336-dotcom/cricket1/blob/main/backend/config/db.js): `backend/config/db.js`
- [User records](https://github.com/athilingam3336-dotcom/cricket1/blob/main/backend/models/userModel.js): `backend/models/userModel.js`
- [Scorer records](https://github.com/athilingam3336-dotcom/cricket1/blob/main/backend/models/scorerModel.js): `backend/models/scorerModel.js`
- [Team records](https://github.com/athilingam3336-dotcom/cricket1/blob/main/backend/models/teamModel.js): `backend/models/teamModel.js`
- [OTP service](https://github.com/athilingam3336-dotcom/cricket1/blob/main/backend/services/otpService.js): `backend/services/otpService.js`
- [Email delivery](https://github.com/athilingam3336-dotcom/cricket1/blob/main/backend/config/mailer.js): `backend/config/mailer.js`

### Other components

- **Federation visitor**

## Connections

- Federation visitor → Portal shell: browses
- Portal shell → Cricket content data: uses content (evidence: `App.js`)
- Portal shell → Registration portal: opens enrollment (evidence: `App.js`)
- Portal shell → Match scorecards: opens scorecard
- Portal shell → Standings and stats: shows standings
- Portal shell → Federation features: presents (evidence: `App.js`)
- Mobile app host → Portal shell: embeds portal (evidence: `mobile_frontend/App.tsx`)
- Mobile app host → Scorer workflow screens: opens scorer mode (evidence: `mobile_frontend/App.tsx`)
- Mobile app host → Team access screens: opens team mode (evidence: `mobile_frontend/App.tsx`)
- Admin workspace → Admin API client: requests data (evidence: `mobile_frontend/src/admin/context/AdminAuthContext.tsx`)
- Team access screens → App API client: requests data
- Scorer workflow screens → App API client: requests data
- Express API server → Admin routes: mounts routes (evidence: `backend/server.js`)
- Express API server → Team routes: mounts routes (evidence: `backend/server.js`)
- Express API server → Player services: mounts player API
- Admin routes → Admin management: dispatches requests (evidence: `backend/routes/adminRoutes.js`)
- Admin routes → Admin approvals: calls approvals (evidence: `backend/routes/adminRoutes.js`)
- Admin routes → Token authorization: guards routes (evidence: `backend/routes/adminRoutes.js`)
- Admin management → Database store: reads and writes (evidence: `backend/controllers/adminDashboardController.js`)
- Authentication routes → Authentication controller: dispatches requests (evidence: `backend/routes/authRoutes.js`)
- Authentication controller → Authentication service: calls authentication (evidence: `backend/controllers/authController.js`)
- Authentication controller → Email delivery: checks mail (evidence: `backend/controllers/authController.js`)
- Authentication service → User records: uses user records (evidence: `backend/services/authService.js`)
- Authentication service → Scorer records: uses scorer records (evidence: `backend/services/authService.js`)
- Authentication service → OTP service: generates OTP (evidence: `backend/services/authService.js`)
- Team routes → Team registration: calls team operations (evidence: `backend/routes/teamRoutes.js`)
- Team registration → Team records: uses team records
- Scorer routes → Authentication service: handles registration (evidence: `backend/routes/scorerRoutes.js`)
- Scorer routes → Scorer match views: loads match views (evidence: `backend/routes/scorerRoutes.js`)
- Scorer routes → Match setup: configures matches (evidence: `backend/routes/scorerRoutes.js`)
- Scorer routes → Ball scoring engine: records deliveries (evidence: `backend/routes/scorerRoutes.js`)
- Ball scoring engine → Database store: updates score state (evidence: `backend/services/scoringEngine.js`)
- Ball scoring engine → Scorer match views: publishes live updates
- Admin approvals → Database store: uses persistence (evidence: `backend/services/adminService.js`)
- Admin approvals → OTP service: uses verification codes (evidence: `backend/services/adminService.js`)
- Admin approvals → Email delivery: sends email (evidence: `backend/services/adminService.js`)
- User records → Database store: reads and writes (evidence: `backend/models/userModel.js`)
- Scorer records → Database store: reads and writes (evidence: `backend/models/scorerModel.js`)
- Team records → Database store: reads and writes (evidence: `backend/models/teamModel.js`)
