# amaljith-ak/sportsync architecture

> Architecture diagram of the GitHub repository amaljith-ak/sportsync, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/amaljith-ak/sportsync
- Repository: https://github.com/amaljith-ak/sportsync

## Overview

SportSync is a football scores and league-information application with an Angular client, an Express/Prisma backend, scheduled data refreshes, live updates, predictions, and admin operations. The main user journey is browsing leagues, then viewing fixtures, results, and standings; live scores and win probabilities are additional capabilities. Sampled source confirms the football API’s database reads, sync writes, admin dispatch, and live-popup behavior. Several service and ML connections are represented by their named roles in the tree; their internal wiring was not sampled.

Main entry points: [`BackEnd/src/index.ts`](https://github.com/amaljith-ak/sportsync/blob/master/BackEnd/src/index.ts) (Express server), [`BackEnd/src/routes/admin.routes.ts`](https://github.com/amaljith-ak/sportsync/blob/master/BackEnd/src/routes/admin.routes.ts) (Admin endpoints), [`FrontEnd/Sports-Sync/src/app/core/services/sports-data.service.ts`](https://github.com/amaljith-ak/sportsync/blob/master/FrontEnd/Sports-Sync/src/app/core/services/sports-data.service.ts) (Sports data client), [`BackEnd/src/services/sync.service.ts`](https://github.com/amaljith-ak/sportsync/blob/master/BackEnd/src/services/sync.service.ts) (Competition sync)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Sports dashboard"]
  node_dashboard["Angular application<br/>[app.ts]"]
  node_home["League browser<br/>[home.ts]"]
  node_league["League details<br/>[league-detail.ts]"]
  node_probability["Win probability<br/>[win-probability.ts]"]
  node_livepopup["Live score popup"]
  node_sportsdata["Sports data client"]
  node_liveclient["Live update client"]
  node_adminclient["Admin console<br/>[admin-page.ts]"]
  node_adminservice["Admin client<br/>[admin.service.ts]"]
end

subgraph group_api["Backend API"]
  node_backend["Express server<br/>[index.ts]"]
  node_footballroutes["Football endpoints<br/>[football.routes.ts]"]
  node_adminroutes["Admin endpoints<br/>[admin.routes.ts]"]
  node_auth["Admin authorization<br/>[adminAuth.ts]"]
  node_database[("Sports database<br/>[prisma.ts]")]
  node_gateway["Live socket gateway<br/>[liveGateway.ts]"]
end

subgraph group_jobs["Data operations"]
  node_scheduler["Job scheduler<br/>[scheduler.ts]"]
  node_sync["Competition sync<br/>[sync.service.ts]"]
  node_footballdata["Football data provider"]
  node_livecheck["Live check job<br/>[liveCheck.job.ts]"]
  node_livepoll["Live polling"]
  node_predictjob["Fixture prediction job"]
  node_prediction["Prediction service"]
end

subgraph group_ml["Prediction service"]
  node_mlapi["ML prediction API<br/>[views.py]"]
  node_mlpredict["Model inference<br/>[predict.py]"]
end

node_fan(("Sports fan"))
node_externalfootball{{"Football data API"}}
node_externalml{{"ML HTTP caller"}}

node_fan -->|"browses"| node_dashboard
node_dashboard -->|"shows leagues"| node_home
node_fan -->|"selects league"| node_league
node_league -->|"requests details"| node_sportsdata
node_home -->|"requests leagues"| node_sportsdata
node_sportsdata -->|"HTTP requests"| node_backend
node_backend -->|"routes football"| node_footballroutes
node_footballroutes -->|"reads matches, standings"| node_database
node_database -->|"returns records"| node_footballroutes
node_fan -->|"opens live score"| node_livepopup
node_livepopup -->|"uses updates"| node_liveclient
node_liveclient -->|"receives live updates"| node_gateway
node_backend -->|"initializes"| node_gateway
node_backend -->|"starts"| node_scheduler
node_backend -->|"starts"| node_livecheck
node_scheduler -->|"dispatches sync"| node_sync
node_sync -->|"fetches competition data"| node_footballdata
node_footballdata -->|"requests data"| node_externalfootball
node_sync -->|"upserts teams, matches, standings"| node_database
node_livecheck -->|"runs polling"| node_livepoll
node_livepoll -.->|"checks live matches"| node_externalfootball
node_livepoll -->|"publishes updates"| node_gateway
node_predictjob -->|"requests predictions"| node_prediction
node_prediction -.->|"calls inference API"| node_externalml
node_externalml -.->|"sends prediction request"| node_mlapi
node_mlapi -->|"runs inference"| node_mlpredict
node_adminclient -->|"sends admin actions"| node_adminservice
node_adminservice -->|"HTTP requests"| node_backend
node_backend -->|"routes admin"| node_adminroutes
node_adminroutes -->|"checks key"| node_auth
node_adminroutes -->|"dispatches manual sync"| node_scheduler
node_adminroutes -->|"starts prediction sweep"| node_predictjob
node_probability -.->|"requests prediction data"| node_sportsdata

click node_dashboard "https://github.com/amaljith-ak/sportsync/blob/master/FrontEnd/Sports-Sync/src/app/app.ts"
click node_home "https://github.com/amaljith-ak/sportsync/blob/master/FrontEnd/Sports-Sync/src/app/features/home/home.ts"
click node_league "https://github.com/amaljith-ak/sportsync/blob/master/FrontEnd/Sports-Sync/src/app/features/league-detail/league-detail.ts"
click node_probability "https://github.com/amaljith-ak/sportsync/blob/master/FrontEnd/Sports-Sync/src/app/features/win-probability/win-probability.ts"
click node_livepopup "https://github.com/amaljith-ak/sportsync/blob/master/FrontEnd/Sports-Sync/src/app/features/live-popup/live-popup.service.ts"
click node_sportsdata "https://github.com/amaljith-ak/sportsync/blob/master/FrontEnd/Sports-Sync/src/app/core/services/sports-data.service.ts"
click node_liveclient "https://github.com/amaljith-ak/sportsync/blob/master/FrontEnd/Sports-Sync/src/app/core/services/live-update.service.ts"
click node_adminclient "https://github.com/amaljith-ak/sportsync/blob/master/FrontEnd/Sports-Sync/src/app/features/admin/admin-page.ts"
click node_adminservice "https://github.com/amaljith-ak/sportsync/blob/master/FrontEnd/Sports-Sync/src/app/core/services/admin.service.ts"
click node_backend "https://github.com/amaljith-ak/sportsync/blob/master/BackEnd/src/index.ts"
click node_footballroutes "https://github.com/amaljith-ak/sportsync/blob/master/BackEnd/src/routes/football.routes.ts"
click node_adminroutes "https://github.com/amaljith-ak/sportsync/blob/master/BackEnd/src/routes/admin.routes.ts"
click node_auth "https://github.com/amaljith-ak/sportsync/blob/master/BackEnd/src/middleware/adminAuth.ts"
click node_database "https://github.com/amaljith-ak/sportsync/blob/master/BackEnd/src/lib/prisma.ts"
click node_scheduler "https://github.com/amaljith-ak/sportsync/blob/master/BackEnd/src/jobs/scheduler.ts"
click node_sync "https://github.com/amaljith-ak/sportsync/blob/master/BackEnd/src/services/sync.service.ts"
click node_footballdata "https://github.com/amaljith-ak/sportsync/blob/master/BackEnd/src/services/footballData.service.ts"
click node_livecheck "https://github.com/amaljith-ak/sportsync/blob/master/BackEnd/src/jobs/liveCheck.job.ts"
click node_livepoll "https://github.com/amaljith-ak/sportsync/blob/master/BackEnd/src/services/livePoll.service.ts"
click node_gateway "https://github.com/amaljith-ak/sportsync/blob/master/BackEnd/src/sockets/liveGateway.ts"
click node_predictjob "https://github.com/amaljith-ak/sportsync/blob/master/BackEnd/src/jobs/predictUpcoming.job.ts"
click node_prediction "https://github.com/amaljith-ak/sportsync/blob/master/BackEnd/src/services/mlPrediction.service.ts"
click node_mlapi "https://github.com/amaljith-ak/sportsync/blob/master/MLService/predictions/views.py"
click node_mlpredict "https://github.com/amaljith-ak/sportsync/blob/master/MLService/predictions/predict.py"

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_dashboard,node_home,node_league,node_probability,node_livepopup,node_sportsdata,node_liveclient,node_adminclient,node_adminservice toneBlue
class node_backend,node_footballroutes,node_adminroutes,node_auth,node_database,node_gateway toneAmber
class node_scheduler,node_sync,node_footballdata,node_livecheck,node_livepoll,node_predictjob,node_prediction,node_externalfootball toneMint
class node_mlapi,node_mlpredict toneRose
class node_fan,node_externalml toneIndigo
```

## Components

### Sports dashboard

- [Angular application](https://github.com/amaljith-ak/sportsync/blob/master/FrontEnd/Sports-Sync/src/app/app.ts): `FrontEnd/Sports-Sync/src/app/app.ts`
- [League browser](https://github.com/amaljith-ak/sportsync/blob/master/FrontEnd/Sports-Sync/src/app/features/home/home.ts): `FrontEnd/Sports-Sync/src/app/features/home/home.ts`
- [League details](https://github.com/amaljith-ak/sportsync/blob/master/FrontEnd/Sports-Sync/src/app/features/league-detail/league-detail.ts): `FrontEnd/Sports-Sync/src/app/features/league-detail/league-detail.ts`
- [Win probability](https://github.com/amaljith-ak/sportsync/blob/master/FrontEnd/Sports-Sync/src/app/features/win-probability/win-probability.ts): `FrontEnd/Sports-Sync/src/app/features/win-probability/win-probability.ts`
- [Live score popup](https://github.com/amaljith-ak/sportsync/blob/master/FrontEnd/Sports-Sync/src/app/features/live-popup/live-popup.service.ts): `FrontEnd/Sports-Sync/src/app/features/live-popup/live-popup.service.ts`
- [Sports data client](https://github.com/amaljith-ak/sportsync/blob/master/FrontEnd/Sports-Sync/src/app/core/services/sports-data.service.ts): `FrontEnd/Sports-Sync/src/app/core/services/sports-data.service.ts`
- [Live update client](https://github.com/amaljith-ak/sportsync/blob/master/FrontEnd/Sports-Sync/src/app/core/services/live-update.service.ts): `FrontEnd/Sports-Sync/src/app/core/services/live-update.service.ts`
- [Admin console](https://github.com/amaljith-ak/sportsync/blob/master/FrontEnd/Sports-Sync/src/app/features/admin/admin-page.ts): `FrontEnd/Sports-Sync/src/app/features/admin/admin-page.ts`
- [Admin client](https://github.com/amaljith-ak/sportsync/blob/master/FrontEnd/Sports-Sync/src/app/core/services/admin.service.ts): `FrontEnd/Sports-Sync/src/app/core/services/admin.service.ts`

### Backend API

- [Express server](https://github.com/amaljith-ak/sportsync/blob/master/BackEnd/src/index.ts): `BackEnd/src/index.ts`
- [Football endpoints](https://github.com/amaljith-ak/sportsync/blob/master/BackEnd/src/routes/football.routes.ts): `BackEnd/src/routes/football.routes.ts`
- [Admin endpoints](https://github.com/amaljith-ak/sportsync/blob/master/BackEnd/src/routes/admin.routes.ts): `BackEnd/src/routes/admin.routes.ts`
- [Admin authorization](https://github.com/amaljith-ak/sportsync/blob/master/BackEnd/src/middleware/adminAuth.ts): `BackEnd/src/middleware/adminAuth.ts`
- [Sports database](https://github.com/amaljith-ak/sportsync/blob/master/BackEnd/src/lib/prisma.ts): `BackEnd/src/lib/prisma.ts`
- [Live socket gateway](https://github.com/amaljith-ak/sportsync/blob/master/BackEnd/src/sockets/liveGateway.ts): `BackEnd/src/sockets/liveGateway.ts`

### Data operations

- [Job scheduler](https://github.com/amaljith-ak/sportsync/blob/master/BackEnd/src/jobs/scheduler.ts): `BackEnd/src/jobs/scheduler.ts`
- [Competition sync](https://github.com/amaljith-ak/sportsync/blob/master/BackEnd/src/services/sync.service.ts): `BackEnd/src/services/sync.service.ts`
- [Football data provider](https://github.com/amaljith-ak/sportsync/blob/master/BackEnd/src/services/footballData.service.ts): `BackEnd/src/services/footballData.service.ts`
- [Live check job](https://github.com/amaljith-ak/sportsync/blob/master/BackEnd/src/jobs/liveCheck.job.ts): `BackEnd/src/jobs/liveCheck.job.ts`
- [Live polling](https://github.com/amaljith-ak/sportsync/blob/master/BackEnd/src/services/livePoll.service.ts): `BackEnd/src/services/livePoll.service.ts`
- [Fixture prediction job](https://github.com/amaljith-ak/sportsync/blob/master/BackEnd/src/jobs/predictUpcoming.job.ts): `BackEnd/src/jobs/predictUpcoming.job.ts`
- [Prediction service](https://github.com/amaljith-ak/sportsync/blob/master/BackEnd/src/services/mlPrediction.service.ts): `BackEnd/src/services/mlPrediction.service.ts`

### Prediction service

- [ML prediction API](https://github.com/amaljith-ak/sportsync/blob/master/MLService/predictions/views.py): `MLService/predictions/views.py`
- [Model inference](https://github.com/amaljith-ak/sportsync/blob/master/MLService/predictions/predict.py): `MLService/predictions/predict.py`

### Other components

- **Sports fan**
- **Football data API**
- **ML HTTP caller**

## Connections

- Sports fan → Angular application: browses
- Angular application → League browser: shows leagues
- Sports fan → League details: selects league
- League details → Sports data client: requests details
- League browser → Sports data client: requests leagues
- Sports data client → Express server: HTTP requests
- Express server → Football endpoints: routes football
- Football endpoints → Sports database: reads matches, standings
- Sports database → Football endpoints: returns records
- Sports fan → Live score popup: opens live score
- Live score popup → Live update client: uses updates
- Live update client → Live socket gateway: receives live updates
- Express server → Live socket gateway: initializes
- Express server → Job scheduler: starts
- Express server → Live check job: starts
- Job scheduler → Competition sync: dispatches sync
- Competition sync → Football data provider: fetches competition data
- Football data provider → Football data API: requests data
- Competition sync → Sports database: upserts teams, matches, standings
- Live check job → Live polling: runs polling
- Live polling → Football data API: checks live matches
- Live polling → Live socket gateway: publishes updates
- Fixture prediction job → Prediction service: requests predictions
- Prediction service → ML HTTP caller: calls inference API
- ML HTTP caller → ML prediction API: sends prediction request
- ML prediction API → Model inference: runs inference
- Admin console → Admin client: sends admin actions
- Admin client → Express server: HTTP requests
- Express server → Admin endpoints: routes admin
- Admin endpoints → Admin authorization: checks key
- Admin endpoints → Job scheduler: dispatches manual sync
- Admin endpoints → Fixture prediction job: starts prediction sweep
- Win probability → Sports data client: requests prediction data
