# 14vosx/hsc-cs2-portal architecture

> Architecture diagram of the GitHub repository 14vosx/hsc-cs2-portal, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/14vosx/hsc-cs2-portal
- Repository: https://github.com/14vosx/hsc-cs2-portal

## Overview

#### Purpose and runtime

HSC CS2 Portal is a public and player-facing Counter-Strike 2 portal. Its primary implementation is an Angular 22 single-page application using TypeScript, RxJS, ngx-translate, and ApexCharts for analytics. The legacy static HTML/CSS/JS site remains at the repository root, but the active application is `frontend/angular/`.

Entry points: `frontend/angular/src/main.ts`, `frontend/angular/src/app/app.ts`, and route definitions in `frontend/angular/src/app/app.routes.ts`.

#### Application shell and navigation

The root application composes global providers, routing, styles, and the reusable portal chrome. The shell owns header/sidebar/footer placement while routed feature pages supply content.

Key paths:
- `frontend/angular/src/app/app.config.ts`
- `frontend/angular/src/app/layout/app-shell/app-shell.ts`
- `frontend/angular/src/app/layout/app-header/app-header.ts`

Global locale and visual preference state is managed centrally rather than independently per feature:
- `frontend/angular/src/app/core/i18n/locale.service.ts`
- `frontend/angular/src/app/core/theme/portal-theme.service.ts`

#### API boundary and data shaping

The browser is a presentation client, not the authority for identity, competitive rules, match-room transitions, drafting, vetoes, server assignment, or ETL. Feature API services call backend endpoints through the shared API layer, receive DTOs, and normalize them into feature-domain models before pages render them.

Key paths:
- `frontend/angular/src/app/core/api/cs2-api.service.ts`
- `frontend/angular/src/app/core/api/dto/`
- `frontend/angular/src/app/core/config/api-paths.ts`

Representative feature boundary:
- `frontend/angular/src/app/features/matches/data-access/matches-api.service.ts`
- `frontend/angular/src/app/features/matches/domain/match.normalizer.ts`

#### Public competition content

Home, ranking, matches, maps, seasons, and news follow a consistent feature structure: page/container → data-access service → normalizer/domain model → focused presentational components. This separates backend contract drift from UI behavior.

Key paths:
- `frontend/angular/src/app/features/home/home-page.ts`
- `frontend/angular/src/app/features/ranking/ranking-page.ts`
- `frontend/angular/src/app/features/seasons/season-context.ts`

Season pages coordinate season-specific ranking, matches, and maps:
- `frontend/angular/src/app/features/seasons/data-access/season-ranking-api.service.ts`
- `frontend/angular/src/app/features/seasons/season-detail-page/season-detail-page.ts`

#### Player identity and account area

Player-facing capabilities are partitioned between core session/presentation concerns and player feature APIs. The UI consumes backend-authoritative identity, membership, entitlement, account, profile, cosmetics, email authentication, and server-access data.

Key paths:
- `frontend/angular/src/app/core/session/player-session.service.ts`
- `frontend/angular/src/app/core/player-presentation/player-presentation-reference.service.ts`
- `frontend/angular/src/app/features/player/data-access/player-self-api.service.ts`

The Player Presentation Reference is deliberately limited to Steam ID, persona name, avatar, and optional profile slug; Match Room must not infer unguaranteed competitive/player attributes.

#### HSC Mix and Match Room

Mix is the most stateful feature: lobby listing and room views call the backend for formation and setup snapshots. The client supports formation lifecycle display/actions, polling, and stale snapshot/version protection. It must enable controls only from backend `viewer.actions`; backend confirmation precedes terminal-state visuals or motion.

Key paths:
- `frontend/angular/src/app/features/mix/data-access/match-room-api.service.ts`
- `frontend/angular/src/app/features/mix/match-room/match-room-page.ts`
- `frontend/angular/src/app/features/mix/domain/match-room.normalizer.ts`

Setup presentation is decomposed for competitive status, captain draft, and map veto:
- `frontend/angular/src/app/features/mix/match-room/competitive/match-room-competitive-panel.ts`
- `frontend/angular/src/app/features/mix/match-room/draft/match-room-draft-panel.ts`
- `frontend/angular/src/app/features/mix/match-room/veto/match-room-map-veto-panel.ts`

#### Bunker analytics and UI motion

Bunker presents player analytics using backend data normalized into a feature model and visualized through specialized panels/charts. Motion is a bounded presentation layer: it may reflect confirmed server state, honors reduced-motion settings, and must not predict transitions.

Key paths:
- `frontend/angular/src/app/features/bunker/data-access/bunker-api.service.ts`
- `frontend/angular/src/app/features/bunker/bunker-page.ts`
- `frontend/angular/src/app/features/bunker/motion/bunker-motion-registry.ts`

Static images, branding, hero assets, and translations are browser-served assets:
- `frontend/angular/public/assets/`
- `frontend/angular/public/i18n/en-US.json`
- `frontend/angular/public/i18n/pt-BR.json`

Main entry points: [`frontend/angular/src/app/core/api/cs2-api.service.ts`](https://github.com/14vosx/hsc-cs2-portal/blob/main/frontend/angular/src/app/core/api/cs2-api.service.ts) (Shared API layer), [`frontend/angular/src/app/app.routes.ts`](https://github.com/14vosx/hsc-cs2-portal/blob/main/frontend/angular/src/app/app.routes.ts) (Feature routes), [`frontend/angular/src/app/app.ts`](https://github.com/14vosx/hsc-cs2-portal/blob/main/frontend/angular/src/app/app.ts) (Root application), [`frontend/angular/src/app/app.config.ts`](https://github.com/14vosx/hsc-cs2-portal/blob/main/frontend/angular/src/app/app.config.ts) (Global providers)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_shell["App shell"]
  node_bootstrap(("Angular bootstrap<br/>entry point<br/>[main.ts]"))
  node_app["Root application<br/>application root<br/>[app.ts]"]
  node_routes["Feature routes<br/>route definitions<br/>[app.routes.ts]"]
  node_app_config["Global providers<br/>app configuration<br/>[app.config.ts]"]
  node_shell_ui["Portal shell<br/>layout<br/>[app-shell.ts]"]
  node_header["App header<br/>layout component<br/>[app-header.ts]"]
end

subgraph group_core["Core platform"]
  node_locale["Locale state<br/>i18n service<br/>[locale.service.ts]"]
  node_theme["Theme state<br/>theme service"]
  node_api{{"Shared API layer<br/>API client<br/>[cs2-api.service.ts]"}}
  node_api_paths["API paths<br/>endpoint configuration<br/>[api-paths.ts]"]
  node_assets["Browser assets &amp; translations<br/>static assets"]
end

subgraph group_content["Competition content"]
  node_public_pages["Public feature pages<br/>routed pages<br/>[home-page.ts]"]
  node_matches_api["Matches data access<br/>feature API service"]
  node_match_normalizer["Match model normalizer<br/>domain normalizer"]
  node_season_context["Season context<br/>season state<br/>[season-context.ts]"]
  node_season_detail["Season detail<br/>routed page"]
  node_season_ranking_api["Season ranking access<br/>feature API service"]
end

subgraph group_player["Player &amp; Mix"]
  node_session["Player session<br/>session service"]
  node_player_reference["Player presentation<br/>identity projection"]
  node_player_self_api["Player account access<br/>feature API service"]
  node_match_room_page["Match Room<br/>stateful routed page<br/>[match-room-page.ts]"]
  node_match_room_api["Match Room access<br/>feature API service"]
  node_match_room_normalizer["Room model normalizer<br/>domain normalizer"]
  node_room_panels["Draft, veto &amp; status panels<br/>presentational components"]
end

subgraph group_analytics["Analytics"]
  node_bunker_page["Bunker analytics<br/>routed page<br/>[bunker-page.ts]"]
  node_bunker_api["Bunker data access<br/>feature API service"]
  node_motion["Bounded UI motion<br/>motion registry"]
end

node_backend{{"Authoritative backend<br/>external service"}}

node_bootstrap -->|"boots"| node_app
node_app -->|"uses"| node_app_config
node_app -->|"loads"| node_routes
node_app -->|"composes"| node_shell_ui
node_shell_ui -->|"renders"| node_header
node_app_config -->|"provides"| node_locale
node_app_config -->|"provides"| node_theme
node_locale -->|"loads translations"| node_assets
node_routes -->|"routes to"| node_public_pages
node_routes -->|"routes to"| node_season_detail
node_routes -->|"routes to"| node_match_room_page
node_routes -->|"routes to"| node_bunker_page
node_public_pages -->|"requests data"| node_matches_api
node_matches_api -->|"calls through"| node_api
node_matches_api -->|"normalizes"| node_match_normalizer
node_season_detail -->|"coordinates"| node_season_context
node_season_detail -->|"requests data"| node_season_ranking_api
node_season_ranking_api -->|"calls through"| node_api
node_session -->|"supplies identity"| node_player_reference
node_player_self_api -->|"calls through"| node_api
node_match_room_page -->|"polls and acts"| node_match_room_api
node_match_room_api -->|"calls through"| node_api
node_match_room_api -->|"normalizes snapshots"| node_match_room_normalizer
node_match_room_page -->|"renders confirmed state"| node_room_panels
node_bunker_page -->|"requests analytics"| node_bunker_api
node_bunker_api -->|"calls through"| node_api
node_bunker_page -->|"uses"| node_motion
node_api -->|"uses endpoints"| node_api_paths
node_api -->|"HTTP requests"| node_backend

click node_bootstrap "https://github.com/14vosx/hsc-cs2-portal/blob/main/frontend/angular/src/main.ts"
click node_app "https://github.com/14vosx/hsc-cs2-portal/blob/main/frontend/angular/src/app/app.ts"
click node_routes "https://github.com/14vosx/hsc-cs2-portal/blob/main/frontend/angular/src/app/app.routes.ts"
click node_app_config "https://github.com/14vosx/hsc-cs2-portal/blob/main/frontend/angular/src/app/app.config.ts"
click node_shell_ui "https://github.com/14vosx/hsc-cs2-portal/blob/main/frontend/angular/src/app/layout/app-shell/app-shell.ts"
click node_header "https://github.com/14vosx/hsc-cs2-portal/blob/main/frontend/angular/src/app/layout/app-header/app-header.ts"
click node_locale "https://github.com/14vosx/hsc-cs2-portal/blob/main/frontend/angular/src/app/core/i18n/locale.service.ts"
click node_theme "https://github.com/14vosx/hsc-cs2-portal/blob/main/frontend/angular/src/app/core/theme/portal-theme.service.ts"
click node_api "https://github.com/14vosx/hsc-cs2-portal/blob/main/frontend/angular/src/app/core/api/cs2-api.service.ts"
click node_api_paths "https://github.com/14vosx/hsc-cs2-portal/blob/main/frontend/angular/src/app/core/config/api-paths.ts"
click node_session "https://github.com/14vosx/hsc-cs2-portal/blob/main/frontend/angular/src/app/core/session/player-session.service.ts"
click node_player_reference "https://github.com/14vosx/hsc-cs2-portal/blob/main/frontend/angular/src/app/core/player-presentation/player-presentation-reference.service.ts"
click node_public_pages "https://github.com/14vosx/hsc-cs2-portal/blob/main/frontend/angular/src/app/features/home/home-page.ts"
click node_matches_api "https://github.com/14vosx/hsc-cs2-portal/blob/main/frontend/angular/src/app/features/matches/data-access/matches-api.service.ts"
click node_match_normalizer "https://github.com/14vosx/hsc-cs2-portal/blob/main/frontend/angular/src/app/features/matches/domain/match.normalizer.ts"
click node_season_context "https://github.com/14vosx/hsc-cs2-portal/blob/main/frontend/angular/src/app/features/seasons/season-context.ts"
click node_season_detail "https://github.com/14vosx/hsc-cs2-portal/blob/main/frontend/angular/src/app/features/seasons/season-detail-page/season-detail-page.ts"
click node_season_ranking_api "https://github.com/14vosx/hsc-cs2-portal/blob/main/frontend/angular/src/app/features/seasons/data-access/season-ranking-api.service.ts"
click node_player_self_api "https://github.com/14vosx/hsc-cs2-portal/blob/main/frontend/angular/src/app/features/player/data-access/player-self-api.service.ts"
click node_match_room_page "https://github.com/14vosx/hsc-cs2-portal/blob/main/frontend/angular/src/app/features/mix/match-room/match-room-page.ts"
click node_match_room_api "https://github.com/14vosx/hsc-cs2-portal/blob/main/frontend/angular/src/app/features/mix/data-access/match-room-api.service.ts"
click node_match_room_normalizer "https://github.com/14vosx/hsc-cs2-portal/blob/main/frontend/angular/src/app/features/mix/domain/match-room.normalizer.ts"
click node_room_panels "https://github.com/14vosx/hsc-cs2-portal/blob/main/frontend/angular/src/app/features/mix/match-room/competitive/match-room-competitive-panel.ts"
click node_bunker_page "https://github.com/14vosx/hsc-cs2-portal/blob/main/frontend/angular/src/app/features/bunker/bunker-page.ts"
click node_bunker_api "https://github.com/14vosx/hsc-cs2-portal/blob/main/frontend/angular/src/app/features/bunker/data-access/bunker-api.service.ts"
click node_motion "https://github.com/14vosx/hsc-cs2-portal/blob/main/frontend/angular/src/app/features/bunker/motion/bunker-motion-registry.ts"

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_bootstrap,node_app,node_routes,node_app_config,node_shell_ui,node_header toneBlue
class node_locale,node_theme,node_api,node_api_paths,node_assets toneAmber
class node_public_pages,node_matches_api,node_match_normalizer,node_season_context,node_season_detail,node_season_ranking_api toneMint
class node_session,node_player_reference,node_player_self_api,node_match_room_page,node_match_room_api,node_match_room_normalizer,node_room_panels toneRose
class node_bunker_page,node_bunker_api,node_motion toneIndigo
class node_backend toneNeutral
```

## Components

### App shell

- [Angular bootstrap](https://github.com/14vosx/hsc-cs2-portal/blob/main/frontend/angular/src/main.ts): entry point · `frontend/angular/src/main.ts`
- [Root application](https://github.com/14vosx/hsc-cs2-portal/blob/main/frontend/angular/src/app/app.ts): application root · `frontend/angular/src/app/app.ts`
- [Feature routes](https://github.com/14vosx/hsc-cs2-portal/blob/main/frontend/angular/src/app/app.routes.ts): route definitions · `frontend/angular/src/app/app.routes.ts`
- [Global providers](https://github.com/14vosx/hsc-cs2-portal/blob/main/frontend/angular/src/app/app.config.ts): app configuration · `frontend/angular/src/app/app.config.ts`
- [Portal shell](https://github.com/14vosx/hsc-cs2-portal/blob/main/frontend/angular/src/app/layout/app-shell/app-shell.ts): layout · Places reusable header, sidebar, footer, and routed content. · `frontend/angular/src/app/layout/app-shell/app-shell.ts`
- [App header](https://github.com/14vosx/hsc-cs2-portal/blob/main/frontend/angular/src/app/layout/app-header/app-header.ts): layout component · `frontend/angular/src/app/layout/app-header/app-header.ts`

### Core platform

- [Locale state](https://github.com/14vosx/hsc-cs2-portal/blob/main/frontend/angular/src/app/core/i18n/locale.service.ts): i18n service · `frontend/angular/src/app/core/i18n/locale.service.ts`
- [Theme state](https://github.com/14vosx/hsc-cs2-portal/blob/main/frontend/angular/src/app/core/theme/portal-theme.service.ts): theme service · `frontend/angular/src/app/core/theme/portal-theme.service.ts`
- [Shared API layer](https://github.com/14vosx/hsc-cs2-portal/blob/main/frontend/angular/src/app/core/api/cs2-api.service.ts): API client · Shared browser boundary for backend endpoint calls and DTOs. · `frontend/angular/src/app/core/api/cs2-api.service.ts`
- [API paths](https://github.com/14vosx/hsc-cs2-portal/blob/main/frontend/angular/src/app/core/config/api-paths.ts): endpoint configuration · `frontend/angular/src/app/core/config/api-paths.ts`
- **Browser assets & translations**: static assets

### Competition content

- [Public feature pages](https://github.com/14vosx/hsc-cs2-portal/blob/main/frontend/angular/src/app/features/home/home-page.ts): routed pages · Home, ranking, matches, maps, and news use feature data-access and domain models. · `frontend/angular/src/app/features/home/home-page.ts`
- [Matches data access](https://github.com/14vosx/hsc-cs2-portal/blob/main/frontend/angular/src/app/features/matches/data-access/matches-api.service.ts): feature API service · `frontend/angular/src/app/features/matches/data-access/matches-api.service.ts`
- [Match model normalizer](https://github.com/14vosx/hsc-cs2-portal/blob/main/frontend/angular/src/app/features/matches/domain/match.normalizer.ts): domain normalizer · `frontend/angular/src/app/features/matches/domain/match.normalizer.ts`
- [Season context](https://github.com/14vosx/hsc-cs2-portal/blob/main/frontend/angular/src/app/features/seasons/season-context.ts): season state · `frontend/angular/src/app/features/seasons/season-context.ts`
- [Season detail](https://github.com/14vosx/hsc-cs2-portal/blob/main/frontend/angular/src/app/features/seasons/season-detail-page/season-detail-page.ts): routed page · Coordinates season ranking, matches, and maps. · `frontend/angular/src/app/features/seasons/season-detail-page/season-detail-page.ts`
- [Season ranking access](https://github.com/14vosx/hsc-cs2-portal/blob/main/frontend/angular/src/app/features/seasons/data-access/season-ranking-api.service.ts): feature API service · `frontend/angular/src/app/features/seasons/data-access/season-ranking-api.service.ts`

### Player & Mix

- [Player session](https://github.com/14vosx/hsc-cs2-portal/blob/main/frontend/angular/src/app/core/session/player-session.service.ts): session service · `frontend/angular/src/app/core/session/player-session.service.ts`
- [Player presentation](https://github.com/14vosx/hsc-cs2-portal/blob/main/frontend/angular/src/app/core/player-presentation/player-presentation-reference.service.ts): identity projection · Steam ID, persona name, avatar, and optional profile slug only. · `frontend/angular/src/app/core/player-presentation/player-presentation-reference.service.ts`
- [Player account access](https://github.com/14vosx/hsc-cs2-portal/blob/main/frontend/angular/src/app/features/player/data-access/player-self-api.service.ts): feature API service · Fetches backend-authoritative account, profile, entitlement, and access data. · `frontend/angular/src/app/features/player/data-access/player-self-api.service.ts`
- [Match Room](https://github.com/14vosx/hsc-cs2-portal/blob/main/frontend/angular/src/app/features/mix/match-room/match-room-page.ts): stateful routed page · Uses backend snapshots, polling, versions, and viewer-authorized actions. · `frontend/angular/src/app/features/mix/match-room/match-room-page.ts`
- [Match Room access](https://github.com/14vosx/hsc-cs2-portal/blob/main/frontend/angular/src/app/features/mix/data-access/match-room-api.service.ts): feature API service · `frontend/angular/src/app/features/mix/data-access/match-room-api.service.ts`
- [Room model normalizer](https://github.com/14vosx/hsc-cs2-portal/blob/main/frontend/angular/src/app/features/mix/domain/match-room.normalizer.ts): domain normalizer · `frontend/angular/src/app/features/mix/domain/match-room.normalizer.ts`
- [Draft, veto & status panels](https://github.com/14vosx/hsc-cs2-portal/blob/main/frontend/angular/src/app/features/mix/match-room/competitive/match-room-competitive-panel.ts): presentational components · Reflect confirmed competitive, captain draft, and map-veto state. · `frontend/angular/src/app/features/mix/match-room/competitive/match-room-competitive-panel.ts`

### Analytics

- [Bunker analytics](https://github.com/14vosx/hsc-cs2-portal/blob/main/frontend/angular/src/app/features/bunker/bunker-page.ts): routed page · `frontend/angular/src/app/features/bunker/bunker-page.ts`
- [Bunker data access](https://github.com/14vosx/hsc-cs2-portal/blob/main/frontend/angular/src/app/features/bunker/data-access/bunker-api.service.ts): feature API service · `frontend/angular/src/app/features/bunker/data-access/bunker-api.service.ts`
- [Bounded UI motion](https://github.com/14vosx/hsc-cs2-portal/blob/main/frontend/angular/src/app/features/bunker/motion/bunker-motion-registry.ts): motion registry · Honors reduced motion and reflects confirmed server state only. · `frontend/angular/src/app/features/bunker/motion/bunker-motion-registry.ts`

### Other components

- **Authoritative backend**: external service · Owns identity, competition rules, room transitions, and analytics data.

## Connections

- Angular bootstrap → Root application: boots
- Root application → Global providers: uses
- Root application → Feature routes: loads
- Root application → Portal shell: composes
- Portal shell → App header: renders
- Global providers → Locale state: provides
- Global providers → Theme state: provides
- Locale state → Browser assets & translations: loads translations
- Feature routes → Public feature pages: routes to
- Feature routes → Season detail: routes to
- Feature routes → Match Room: routes to
- Feature routes → Bunker analytics: routes to
- Public feature pages → Matches data access: requests data
- Matches data access → Shared API layer: calls through
- Matches data access → Match model normalizer: normalizes
- Season detail → Season context: coordinates
- Season detail → Season ranking access: requests data
- Season ranking access → Shared API layer: calls through
- Player session → Player presentation: supplies identity
- Player account access → Shared API layer: calls through
- Match Room → Match Room access: polls and acts
- Match Room access → Shared API layer: calls through
- Match Room access → Room model normalizer: normalizes snapshots
- Match Room → Draft, veto & status panels: renders confirmed state
- Bunker analytics → Bunker data access: requests analytics
- Bunker data access → Shared API layer: calls through
- Bunker analytics → Bounded UI motion: uses
- Shared API layer → API paths: uses endpoints
- Shared API layer → Authoritative backend: HTTP requests
