# shankeerthans/cricapp architecture

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

- Interactive diagram: https://gitdiagram.com/shankeerthans/cricapp
- Repository: https://github.com/shankeerthans/cricapp

## Overview

Cricapp is an iOS app for browsing international cricket teams and their players. The main flow opens a searchable team list, loads team data when the local list is empty, and navigates to a searchable player list that loads players for the selected team. API responses are decoded and saved with associated images in Core Data; SwiftUI rows present the stored records. The README documents these browsing capabilities and RapidAPI configuration. Some persistence and fetch-helper implementations were read but not excerpted, so their internal call relationships are omitted.

Main entry points: [`Cricapp/Managers/URLSessionManager.swift`](https://github.com/shankeerthans/cricapp/blob/main/Cricapp/Managers/URLSessionManager.swift) (Session manager), [`Cricapp/Views/TeamsListView.swift`](https://github.com/shankeerthans/cricapp/blob/main/Cricapp/Views/TeamsListView.swift) (Team browser), [`Cricapp/Views/PlayersListView.swift`](https://github.com/shankeerthans/cricapp/blob/main/Cricapp/Views/PlayersListView.swift) (Player browser), [`Cricapp/CricappApp.swift`](https://github.com/shankeerthans/cricapp/blob/main/Cricapp/CricappApp.swift) (App entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App and interface"]
  node_app_entry["App entry<br/>[CricappApp.swift]"]
  node_content["Root view<br/>[ContentView.swift]"]
  node_viewmodel["View model<br/>[ViewModel.swift]"]
  node_teams_list["Team browser"]
  node_team_row["Team row<br/>[TeamView.swift]"]
  node_players_list["Player browser"]
  node_player_row["Player row<br/>[PlayerView.swift]"]
end

subgraph group_network["API access"]
  node_session["Session manager"]
  node_api_model["API requests<br/>[APIModel.swift]"]
  node_coder["JSON decoder<br/>[Coder.swift]"]
end

subgraph group_domain["Cricket data"]
  node_team_data["Team response data<br/>[DataModel.swift]"]
  node_team_entity["Team records"]
  node_player_entity["Player records"]
end

subgraph group_storage["Local persistence"]
  node_fetch_objects["Fetched objects<br/>[FetchObjects.swift]"]
  node_persistence["Persistence setup<br/>[Persistence.swift]"]
  node_store[("Core Data store<br/>[contents]")]
end

node_user(("App user"))
node_rapidapi{{"RapidAPI"}}

node_user -->|"opens"| node_app_entry
node_app_entry -->|"launches"| node_content
node_app_entry -->|"uses context"| node_persistence
node_content -->|"shows"| node_teams_list
node_content -->|"creates"| node_viewmodel
node_teams_list -->|"queries"| node_fetch_objects
node_teams_list -->|"renders"| node_team_row
node_teams_list -->|"navigates"| node_players_list
node_teams_list -->|"fetches teams"| node_session
node_players_list -->|"queries"| node_fetch_objects
node_players_list -->|"renders"| node_player_row
node_players_list -->|"fetches players"| node_session
node_session -->|"builds request"| node_api_model
node_session -->|"sends HTTP"| node_rapidapi
node_session -->|"decodes JSON"| node_coder
node_session -->|"creates teams"| node_team_entity
node_session -->|"creates players"| node_player_entity
node_team_entity -->|"fetches images"| node_session
node_player_entity -->|"fetches images"| node_session
node_persistence -.->|"configures"| node_store
node_team_entity -.->|"persists"| node_store
node_player_entity -.->|"persists"| node_store

click node_app_entry "https://github.com/shankeerthans/cricapp/blob/main/Cricapp/CricappApp.swift"
click node_content "https://github.com/shankeerthans/cricapp/blob/main/Cricapp/ContentView.swift"
click node_viewmodel "https://github.com/shankeerthans/cricapp/blob/main/Cricapp/ViewModel/ViewModel.swift"
click node_teams_list "https://github.com/shankeerthans/cricapp/blob/main/Cricapp/Views/TeamsListView.swift"
click node_team_row "https://github.com/shankeerthans/cricapp/blob/main/Cricapp/Views/TeamView.swift"
click node_players_list "https://github.com/shankeerthans/cricapp/blob/main/Cricapp/Views/PlayersListView.swift"
click node_player_row "https://github.com/shankeerthans/cricapp/blob/main/Cricapp/Views/PlayerView.swift"
click node_fetch_objects "https://github.com/shankeerthans/cricapp/blob/main/Cricapp/CoreData/FetchObjects.swift"
click node_session "https://github.com/shankeerthans/cricapp/blob/main/Cricapp/Managers/URLSessionManager.swift"
click node_api_model "https://github.com/shankeerthans/cricapp/blob/main/Cricapp/Models/APIModel.swift"
click node_coder "https://github.com/shankeerthans/cricapp/blob/main/Cricapp/Models/Coder.swift"
click node_team_data "https://github.com/shankeerthans/cricapp/blob/main/Cricapp/Models/DataModel.swift"
click node_team_entity "https://github.com/shankeerthans/cricapp/blob/main/Cricapp/CoreData/Team%2BCoreDataProperties.swift"
click node_player_entity "https://github.com/shankeerthans/cricapp/blob/main/Cricapp/CoreData/Player%2BCoreDataProperties.swift"
click node_persistence "https://github.com/shankeerthans/cricapp/blob/main/Cricapp/CoreData/Persistence.swift"
click node_store "https://github.com/shankeerthans/cricapp/blob/main/Cricapp/Cricapp.xcdatamodeld/Cricapp.xcdatamodel/contents"

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_app_entry,node_content,node_viewmodel,node_teams_list,node_team_row,node_players_list,node_player_row,node_user toneBlue
class node_session,node_api_model,node_coder toneAmber
class node_team_data,node_team_entity,node_player_entity,node_rapidapi toneMint
class node_fetch_objects,node_persistence,node_store toneRose
```

## Components

### App and interface

- [App entry](https://github.com/shankeerthans/cricapp/blob/main/Cricapp/CricappApp.swift): `Cricapp/CricappApp.swift`
- [Root view](https://github.com/shankeerthans/cricapp/blob/main/Cricapp/ContentView.swift): `Cricapp/ContentView.swift`
- [View model](https://github.com/shankeerthans/cricapp/blob/main/Cricapp/ViewModel/ViewModel.swift): `Cricapp/ViewModel/ViewModel.swift`
- [Team browser](https://github.com/shankeerthans/cricapp/blob/main/Cricapp/Views/TeamsListView.swift): `Cricapp/Views/TeamsListView.swift`
- [Team row](https://github.com/shankeerthans/cricapp/blob/main/Cricapp/Views/TeamView.swift): `Cricapp/Views/TeamView.swift`
- [Player browser](https://github.com/shankeerthans/cricapp/blob/main/Cricapp/Views/PlayersListView.swift): `Cricapp/Views/PlayersListView.swift`
- [Player row](https://github.com/shankeerthans/cricapp/blob/main/Cricapp/Views/PlayerView.swift): `Cricapp/Views/PlayerView.swift`

### API access

- [Session manager](https://github.com/shankeerthans/cricapp/blob/main/Cricapp/Managers/URLSessionManager.swift): `Cricapp/Managers/URLSessionManager.swift`
- [API requests](https://github.com/shankeerthans/cricapp/blob/main/Cricapp/Models/APIModel.swift): `Cricapp/Models/APIModel.swift`
- [JSON decoder](https://github.com/shankeerthans/cricapp/blob/main/Cricapp/Models/Coder.swift): `Cricapp/Models/Coder.swift`

### Cricket data

- [Team response data](https://github.com/shankeerthans/cricapp/blob/main/Cricapp/Models/DataModel.swift): `Cricapp/Models/DataModel.swift`
- [Team records](https://github.com/shankeerthans/cricapp/blob/main/Cricapp/CoreData/Team%2BCoreDataProperties.swift): `Cricapp/CoreData/Team+CoreDataProperties.swift`
- [Player records](https://github.com/shankeerthans/cricapp/blob/main/Cricapp/CoreData/Player%2BCoreDataProperties.swift): `Cricapp/CoreData/Player+CoreDataProperties.swift`

### Local persistence

- [Fetched objects](https://github.com/shankeerthans/cricapp/blob/main/Cricapp/CoreData/FetchObjects.swift): `Cricapp/CoreData/FetchObjects.swift`
- [Persistence setup](https://github.com/shankeerthans/cricapp/blob/main/Cricapp/CoreData/Persistence.swift): `Cricapp/CoreData/Persistence.swift`
- [Core Data store](https://github.com/shankeerthans/cricapp/blob/main/Cricapp/Cricapp.xcdatamodeld/Cricapp.xcdatamodel/contents): `Cricapp/Cricapp.xcdatamodeld/Cricapp.xcdatamodel/contents`

### Other components

- **App user**
- **RapidAPI**

## Connections

- App user → App entry: opens
- App entry → Root view: launches (evidence: `Cricapp/CricappApp.swift`)
- App entry → Persistence setup: uses context (evidence: `Cricapp/CricappApp.swift`)
- Root view → Team browser: shows (evidence: `Cricapp/ContentView.swift`)
- Root view → View model: creates (evidence: `Cricapp/ContentView.swift`)
- Team browser → Fetched objects: queries (evidence: `Cricapp/Views/TeamsListView.swift`)
- Team browser → Team row: renders (evidence: `Cricapp/Views/TeamsListView.swift`)
- Team browser → Player browser: navigates (evidence: `Cricapp/Views/TeamsListView.swift`)
- Team browser → Session manager: fetches teams (evidence: `Cricapp/Views/TeamsListView.swift`)
- Player browser → Fetched objects: queries (evidence: `Cricapp/Views/PlayersListView.swift`)
- Player browser → Player row: renders (evidence: `Cricapp/Views/PlayersListView.swift`)
- Player browser → Session manager: fetches players (evidence: `Cricapp/Views/PlayersListView.swift`)
- Session manager → API requests: builds request (evidence: `Cricapp/Managers/URLSessionManager.swift`)
- Session manager → RapidAPI: sends HTTP (evidence: `Cricapp/Managers/URLSessionManager.swift`)
- Session manager → JSON decoder: decodes JSON (evidence: `Cricapp/Managers/URLSessionManager.swift`)
- Session manager → Team records: creates teams (evidence: `Cricapp/Managers/URLSessionManager.swift`)
- Session manager → Player records: creates players (evidence: `Cricapp/Managers/URLSessionManager.swift`)
- Team records → Session manager: fetches images (evidence: `Cricapp/CoreData/Team+CoreDataProperties.swift`)
- Player records → Session manager: fetches images (evidence: `Cricapp/CoreData/Player+CoreDataProperties.swift`)
- Persistence setup → Core Data store: configures
- Team records → Core Data store: persists
- Player records → Core Data store: persists
