# baguspangestu/headhunt architecture

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

- Interactive diagram: https://gitdiagram.com/baguspangestu/headhunt
- Repository: https://github.com/baguspangestu/headhunt

## Overview

Headhunt.cc combines a gacha-record tracker with an operators, gear, and weapons catalog. The main tracker workflow imports records from the game service, processes them into profile data, and persists that data locally; backup and catalog browsing are separate capabilities. The graph uses documented product relationships and SOURCE INDEX references. Some UI-to-store and unsampled catalog implementation links are not established by the excerpts, so they are omitted rather than inferred.

Main entry points: [`src/store/useImportStore.ts`](https://github.com/baguspangestu/headhunt/blob/main/src/store/useImportStore.ts) (Import state), [`src/lib/tracker-migration.ts`](https://github.com/baguspangestu/headhunt/blob/main/src/lib/tracker-migration.ts) (Data migration), [`src/app/api/v3/tracker/import/route.ts`](https://github.com/baguspangestu/headhunt/blob/main/src/app/api/v3/tracker/import/route.ts) (Import endpoints), [`src/data`](https://github.com/baguspangestu/headhunt/tree/main/src/data) (Localized game data)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_tracker["Tracker experience"]
  node_tracker_ui["Tracker pages<br/>[page.tsx]"]
end

subgraph group_import["Record import"]
  node_import_store["Import state<br/>[useImportStore.ts]"]
  node_import_fetch["Import fetch"]
  node_import_processing["Import processing"]
  node_import_api["Import endpoints<br/>[route.ts]"]
  node_legacy_api["Legacy endpoints<br/>[route.ts]"]
  node_banner_api["Banner lookup<br/>[route.ts]"]
  node_type_config["Tracker types<br/>[headhunt-types.ts]"]
  node_import_types["Import record types<br/>[import.ts]"]
end

subgraph group_state["Profiles and backup"]
  node_storage_store["Profile storage<br/>[useStorageStore.ts]"]
  node_profile_types["Profile types<br/>[profile.ts]"]
  node_migration["Data migration"]
  node_stats["Tracker statistics<br/>[tracker-stats.ts]"]
  node_pity["Pity calculations<br/>[tracker-pity.ts]"]
  node_backup["Backup processing<br/>[tracker-backup.ts]"]
end

subgraph group_catalog["Game catalog"]
  node_data_collectors["Data collectors"]
  node_generated_data[("Localized game data")]
  node_operator_catalog["Operators catalog<br/>[page.tsx]"]
  node_gear_catalog["Gear catalog<br/>[page.tsx]"]
  node_weapon_catalog["Weapons catalog<br/>[page.tsx]"]
end

subgraph group_auth["Google integration"]
  node_drive_backup["Drive backup"]
  node_oauth_routes["OAuth endpoints<br/>[route.ts]"]
  node_oauth["OAuth utilities<br/>[google-oauth.ts]"]
end

node_player(("Player"))
node_game_service{{"Game record service"}}
node_google_drive{{"Google Drive"}}

node_player -->|"opens tracker"| node_tracker_ui
node_tracker_ui -.->|"uses import"| node_import_store
node_import_store -->|"fetches records"| node_import_fetch
node_import_store -->|"processes records"| node_import_processing
node_import_store -->|"reads and updates"| node_storage_store
node_import_fetch -.->|"requests import"| node_import_api
node_import_api -->|"fetches records"| node_game_service
node_legacy_api -->|"fetches records"| node_game_service
node_import_api -->|"selects pool"| node_type_config
node_import_api -->|"returns records"| node_import_types
node_import_store -->|"looks up banners"| node_banner_api
node_banner_api -->|"fetches banner data"| node_game_service
node_storage_store -->|"migrates profiles"| node_migration
node_migration -->|"transforms profiles"| node_profile_types
node_migration -->|"summarizes records"| node_stats
node_migration -->|"uses pity rules"| node_pity
node_backup -->|"migrates backup data"| node_migration
node_backup -->|"handles profiles"| node_profile_types
node_drive_backup -->|"uses backup data"| node_backup
node_oauth_routes -->|"uses OAuth config"| node_oauth
node_drive_backup -->|"stores app-data backups"| node_google_drive
node_data_collectors -->|"generates localized data"| node_generated_data
node_player -->|"browses operators"| node_operator_catalog
node_player -->|"browses gear"| node_gear_catalog
node_player -->|"browses weapons"| node_weapon_catalog
node_generated_data -->|"provides catalog data"| node_operator_catalog
node_generated_data -->|"provides catalog data"| node_gear_catalog
node_generated_data -->|"provides catalog data"| node_weapon_catalog

click node_tracker_ui "https://github.com/baguspangestu/headhunt/blob/main/src/app/%5Blocale%5D/tracker/page.tsx"
click node_import_store "https://github.com/baguspangestu/headhunt/blob/main/src/store/useImportStore.ts"
click node_import_fetch "https://github.com/baguspangestu/headhunt/blob/main/src/lib/tracker-import-fetch.ts"
click node_import_processing "https://github.com/baguspangestu/headhunt/blob/main/src/lib/tracker-import-processing.ts"
click node_import_api "https://github.com/baguspangestu/headhunt/blob/main/src/app/api/v3/tracker/import/route.ts"
click node_legacy_api "https://github.com/baguspangestu/headhunt/blob/main/src/app/api/v1/tracker/import/route.ts"
click node_banner_api "https://github.com/baguspangestu/headhunt/blob/main/src/app/api/v1/tracker/banner/route.ts"
click node_type_config "https://github.com/baguspangestu/headhunt/blob/main/src/data/tracker/headhunt-types.ts"
click node_import_types "https://github.com/baguspangestu/headhunt/blob/main/src/types/import.ts"
click node_storage_store "https://github.com/baguspangestu/headhunt/blob/main/src/store/useStorageStore.ts"
click node_profile_types "https://github.com/baguspangestu/headhunt/blob/main/src/types/profile.ts"
click node_migration "https://github.com/baguspangestu/headhunt/blob/main/src/lib/tracker-migration.ts"
click node_stats "https://github.com/baguspangestu/headhunt/blob/main/src/lib/tracker-stats.ts"
click node_pity "https://github.com/baguspangestu/headhunt/blob/main/src/lib/tracker-pity.ts"
click node_backup "https://github.com/baguspangestu/headhunt/blob/main/src/lib/tracker-backup.ts"
click node_drive_backup "https://github.com/baguspangestu/headhunt/blob/main/src/lib/google-drive-backup.ts"
click node_oauth_routes "https://github.com/baguspangestu/headhunt/blob/main/src/app/api/auth/google/start/route.ts"
click node_oauth "https://github.com/baguspangestu/headhunt/blob/main/src/lib/google-oauth.ts"
click node_data_collectors "https://github.com/baguspangestu/headhunt/tree/main/scripts"
click node_generated_data "https://github.com/baguspangestu/headhunt/tree/main/src/data"
click node_operator_catalog "https://github.com/baguspangestu/headhunt/blob/main/src/app/%5Blocale%5D/operators/page.tsx"
click node_gear_catalog "https://github.com/baguspangestu/headhunt/blob/main/src/app/%5Blocale%5D/gear/page.tsx"
click node_weapon_catalog "https://github.com/baguspangestu/headhunt/blob/main/src/app/%5Blocale%5D/weapons/page.tsx"

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_tracker_ui toneBlue
class node_import_store,node_import_fetch,node_import_processing,node_import_api,node_legacy_api,node_banner_api,node_type_config,node_import_types toneAmber
class node_storage_store,node_profile_types,node_migration,node_stats,node_pity,node_backup toneMint
class node_data_collectors,node_generated_data,node_operator_catalog,node_gear_catalog,node_weapon_catalog toneRose
class node_drive_backup,node_oauth_routes,node_oauth,node_player,node_game_service,node_google_drive toneIndigo
```

## Components

### Tracker experience

- [Tracker pages](https://github.com/baguspangestu/headhunt/blob/main/src/app/%5Blocale%5D/tracker/page.tsx): `src/app/[locale]/tracker/page.tsx`

### Record import

- [Import state](https://github.com/baguspangestu/headhunt/blob/main/src/store/useImportStore.ts): `src/store/useImportStore.ts`
- [Import fetch](https://github.com/baguspangestu/headhunt/blob/main/src/lib/tracker-import-fetch.ts): `src/lib/tracker-import-fetch.ts`
- [Import processing](https://github.com/baguspangestu/headhunt/blob/main/src/lib/tracker-import-processing.ts): `src/lib/tracker-import-processing.ts`
- [Import endpoints](https://github.com/baguspangestu/headhunt/blob/main/src/app/api/v3/tracker/import/route.ts): `src/app/api/v3/tracker/import/route.ts`
- [Legacy endpoints](https://github.com/baguspangestu/headhunt/blob/main/src/app/api/v1/tracker/import/route.ts): `src/app/api/v1/tracker/import/route.ts`
- [Banner lookup](https://github.com/baguspangestu/headhunt/blob/main/src/app/api/v1/tracker/banner/route.ts): `src/app/api/v1/tracker/banner/route.ts`
- [Tracker types](https://github.com/baguspangestu/headhunt/blob/main/src/data/tracker/headhunt-types.ts): `src/data/tracker/headhunt-types.ts`
- [Import record types](https://github.com/baguspangestu/headhunt/blob/main/src/types/import.ts): `src/types/import.ts`

### Profiles and backup

- [Profile storage](https://github.com/baguspangestu/headhunt/blob/main/src/store/useStorageStore.ts): `src/store/useStorageStore.ts`
- [Profile types](https://github.com/baguspangestu/headhunt/blob/main/src/types/profile.ts): `src/types/profile.ts`
- [Data migration](https://github.com/baguspangestu/headhunt/blob/main/src/lib/tracker-migration.ts): `src/lib/tracker-migration.ts`
- [Tracker statistics](https://github.com/baguspangestu/headhunt/blob/main/src/lib/tracker-stats.ts): `src/lib/tracker-stats.ts`
- [Pity calculations](https://github.com/baguspangestu/headhunt/blob/main/src/lib/tracker-pity.ts): `src/lib/tracker-pity.ts`
- [Backup processing](https://github.com/baguspangestu/headhunt/blob/main/src/lib/tracker-backup.ts): `src/lib/tracker-backup.ts`

### Game catalog

- [Data collectors](https://github.com/baguspangestu/headhunt/tree/main/scripts): `scripts`
- [Localized game data](https://github.com/baguspangestu/headhunt/tree/main/src/data): `src/data`
- [Operators catalog](https://github.com/baguspangestu/headhunt/blob/main/src/app/%5Blocale%5D/operators/page.tsx): `src/app/[locale]/operators/page.tsx`
- [Gear catalog](https://github.com/baguspangestu/headhunt/blob/main/src/app/%5Blocale%5D/gear/page.tsx): `src/app/[locale]/gear/page.tsx`
- [Weapons catalog](https://github.com/baguspangestu/headhunt/blob/main/src/app/%5Blocale%5D/weapons/page.tsx): `src/app/[locale]/weapons/page.tsx`

### Google integration

- [Drive backup](https://github.com/baguspangestu/headhunt/blob/main/src/lib/google-drive-backup.ts): `src/lib/google-drive-backup.ts`
- [OAuth endpoints](https://github.com/baguspangestu/headhunt/blob/main/src/app/api/auth/google/start/route.ts): `src/app/api/auth/google/start/route.ts`
- [OAuth utilities](https://github.com/baguspangestu/headhunt/blob/main/src/lib/google-oauth.ts): `src/lib/google-oauth.ts`

### Other components

- **Player**
- **Game record service**
- **Google Drive**

## Connections

- Player → Tracker pages: opens tracker (evidence: `README.md`)
- Tracker pages → Import state: uses import
- Import state → Import fetch: fetches records (evidence: `src/store/useImportStore.ts`)
- Import state → Import processing: processes records (evidence: `src/store/useImportStore.ts`)
- Import state → Profile storage: reads and updates (evidence: `src/store/useImportStore.ts`)
- Import fetch → Import endpoints: requests import
- Import endpoints → Game record service: fetches records (evidence: `src/app/api/v3/tracker/import/route.ts`)
- Legacy endpoints → Game record service: fetches records (evidence: `src/app/api/v1/tracker/import/route.ts`)
- Import endpoints → Tracker types: selects pool (evidence: `src/app/api/v3/tracker/import/route.ts`)
- Import endpoints → Import record types: returns records (evidence: `src/app/api/v3/tracker/import/route.ts`)
- Import state → Banner lookup: looks up banners (evidence: `src/store/useImportStore.ts`)
- Banner lookup → Game record service: fetches banner data (evidence: `src/app/api/v1/tracker/banner/route.ts`)
- Profile storage → Data migration: migrates profiles (evidence: `src/store/useStorageStore.ts`)
- Data migration → Profile types: transforms profiles (evidence: `src/lib/tracker-migration.ts`)
- Data migration → Tracker statistics: summarizes records (evidence: `src/lib/tracker-migration.ts`)
- Data migration → Pity calculations: uses pity rules (evidence: `src/lib/tracker-migration.ts`)
- Backup processing → Data migration: migrates backup data (evidence: `src/lib/tracker-backup.ts`)
- Backup processing → Profile types: handles profiles (evidence: `src/lib/tracker-backup.ts`)
- Drive backup → Backup processing: uses backup data (evidence: `src/lib/google-drive-backup.ts`)
- OAuth endpoints → OAuth utilities: uses OAuth config (evidence: `src/app/api/auth/google/start/route.ts`)
- Drive backup → Google Drive: stores app-data backups (evidence: `README.md`)
- Data collectors → Localized game data: generates localized data (evidence: `README.md`)
- Player → Operators catalog: browses operators (evidence: `README.md`)
- Player → Gear catalog: browses gear (evidence: `README.md`)
- Player → Weapons catalog: browses weapons (evidence: `README.md`)
- Localized game data → Operators catalog: provides catalog data (evidence: `README.md`)
- Localized game data → Gear catalog: provides catalog data (evidence: `README.md`)
- Localized game data → Weapons catalog: provides catalog data (evidence: `README.md`)
