# johnwickjj/analisisc architecture

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

- Interactive diagram: https://gitdiagram.com/johnwickjj/analisisc
- Repository: https://github.com/johnwickjj/analisisc

## Overview

This is an Angular 18 frontend application organized as a feature-based SPA with a clear split between application shell, shared UI, and domain-specific areas. The likely runtime is the browser, with routing used to switch between screens and services used to talk to a backend API.

1. Application shell and bootstrapping  
`src/main.ts`, `app.config.ts`, and `app.routes.ts` define the app startup and global providers. `app.component.*` is the root shell, while `layout/main-layout.component.*` appears to host the primary authenticated/user-facing frame.

2. Route-level feature boundaries  
The app is divided into major route groups under `src/app/features`: `admin`, `game`, `leaderboard`, and `profile`. This is the main architectural boundary: each feature owns its pages, local UI, and in some cases feature-specific helpers or modals.

3. Core layer for cross-cutting concerns  
`src/app/core` contains app-wide infrastructure rather than screen logic. This includes guards, HTTP interceptors, constants, and reusable services. This layer is the main boundary between UI components and external API communication.

4. Authentication and request pipeline  
`auth.service.ts` and `login-request.interface.ts` / `auth-response.interface.ts` support login/session handling. `auth.interceptor.ts` likely attaches auth tokens to outgoing API calls, while `error.interceptor.ts` centralizes HTTP failure handling. `admin.guard.ts` protects admin routes from unauthorized access.

5. Backend-facing domain services  
Services such as `admin.service.ts`, `game.service.ts`, `player.service.ts`, `room.service.ts`, `question.service.ts`, `notification.service.ts`, `language.service.ts`, `logger.service.ts`, `password-reset.service.ts`, and `error-handler.service.ts` form the API and app-state integration layer. Components should depend on these services rather than calling HTTP directly.

6. Domain model organization  
`src/app/core/models` is split by domain: `admin`, `auth`, `game`, `logger`, `notification`, `player`, and `room`. These interfaces/models define the contracts exchanged with the backend and between UI layers. The large number of admin response types suggests a backend with many CRUD and workflow endpoints.

7. Admin subsystem  
`src/app/features/admin` is the most complex area. It includes pages for dashboard, login, users/players, questions, rooms, settings, and password reset flows, plus modal components for forms and edits. This area likely represents a management console with privileged access, charting, CSV/import workflows, and category/question moderation.

8. Game/play subsystem  
`src/app/features/game` contains `start` and `board` views, suggesting a staged gameplay flow: initialize a session, then play on the board. `abandon-confirmation-modal.component.ts` indicates in-game interruption handling. Related game models such as `game-session`, `question`, `answer`, `leaderboard`, and `session-stats` imply live session state and score tracking.

9. Public/player-facing features  
`leaderboard` and `profile` are separate non-admin views for browsing rankings and player data. These likely consume shared player/game data from the backend and sit under the main authenticated or semi-authenticated shell, depending on app rules.

10. Shared UI and reusable widgets  
`src/app/shared` contains reusable presentation components such as the language selector, notifications, and tabs. These are app-wide UI building blocks that can be reused across both admin and player/game pages.

11. Internationalization and localization  
`src/assets/i18n/en.json` and `es.json` plus `language.service.ts` and `shared/components/language-selector` indicate built-in multilingual support. Language selection is a cross-cutting concern that affects the entire UI rather than a single feature.

12. Observability and user feedback  
`notification.service.ts`, `shared/notification`, `core/models/logger/error-log.interface.ts`, and `logger.service.ts` suggest a structured approach to user-facing messages and error reporting. This is likely important for surfacing API failures and operational issues consistently across the app.

13. External dependencies and tooling that affect architecture  
The repo is an Angular CLI project with standard build/test tooling (`ng serve`, `ng build`, `ng test`). The presence of `chart-register.helper.ts` implies a charting library in the admin dashboard, and environment files indicate separate configuration for development and production API endpoints.

Overall, the architecture is a classic Angular layered SPA: route-driven feature modules/components at the top, a core infrastructure layer for auth/API/cross-cutting concerns, and a shared component layer for reusable UI. The key diagram boundaries are admin vs player/game features, and UI components vs services/models/interceptors that mediate backend access.

Main entry points: [`src/app/app.routes.ts`](https://github.com/johnwickjj/analisisc/blob/main/src/app/app.routes.ts) (app.routes.ts), [`src/app/features/admin/admin-management/admin-management.component.ts`](https://github.com/johnwickjj/analisisc/blob/main/src/app/features/admin/admin-management/admin-management.component.ts) (Admin management), [`src/app/core/services/auth.service.ts`](https://github.com/johnwickjj/analisisc/blob/main/src/app/core/services/auth.service.ts) (Auth service), [`src/app/layout/main-layout.component.ts`](https://github.com/johnwickjj/analisisc/blob/main/src/app/layout/main-layout.component.ts) (Main layout)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_shell["Application shell"]
  node_main["main.ts<br/>bootstrap<br/>[main.ts]"]
  node_appconfig["app.config.ts<br/>providers<br/>[app.config.ts]"]
  node_routes["app.routes.ts<br/>routing<br/>[app.routes.ts]"]
  node_root["App shell<br/>root component<br/>[app.component.ts]"]
  node_layout["Main layout<br/>layout component"]
end

subgraph group_core["Core layer"]
  node_authsvc["Auth service<br/>[auth.service.ts]"]
  node_adminguard["Admin guard<br/>route guard<br/>[admin.guard.ts]"]
  node_authint["Auth interceptor<br/>http interceptor"]
  node_errint["Error interceptor<br/>http interceptor"]
  node_adminsvc["Admin service<br/>api service<br/>[admin.service.ts]"]
  node_gamesvc["Game service<br/>api service<br/>[game.service.ts]"]
  node_playersvc["Player service<br/>api service<br/>[player.service.ts]"]
  node_roomsvc["Room service<br/>api service<br/>[room.service.ts]"]
  node_notifsvc["Notification service<br/>ui feedback service"]
  node_langsvc["Language service<br/>i18n service"]
end

subgraph group_features["Feature areas"]
  node_admindash["Admin dashboard<br/>admin screen"]
  node_adminmgmt["Admin management<br/>admin screen"]
  node_adminlogin["Admin login<br/>auth screen"]
  node_adminreset["Password reset<br/>auth flow"]
  node_gamestart["Game start<br/>game screen"]
  node_gameboard["Game board<br/>game screen"]
  node_leaderboard["Leaderboard<br/>ranking view"]
  node_profile["Player profile<br/>profile view"]
end

subgraph group_shared["Shared UI"]
  node_langui["Language selector<br/>shared component"]
  node_notifyui["Notifications<br/>shared component"]
  node_tabsui["Tabs<br/>shared component<br/>[tabs.component.ts]"]
end

subgraph group_models["Domain contracts"]
  node_authreq["Login request<br/>auth model"]
  node_authresp["Auth response<br/>auth model"]
  node_gamesess["Game session<br/>game model"]
  node_leadermodel["Leaderboard data<br/>game model"]
  node_playermodel["Player data<br/>player model"]
  node_roommodel["Room data<br/>room model<br/>[room.interface.ts]"]
end

node_main -->|"bootstraps"| node_appconfig
node_appconfig -->|"registers"| node_routes
node_routes -->|"renders"| node_root
node_root -->|"hosts"| node_layout
node_routes -->|"routes"| node_adminlogin
node_routes -->|"routes"| node_admindash
node_routes -->|"routes"| node_adminmgmt
node_routes -->|"routes"| node_adminreset
node_routes -->|"routes"| node_gamestart
node_routes -->|"routes"| node_gameboard
node_routes -->|"routes"| node_leaderboard
node_routes -->|"routes"| node_profile
node_routes -->|"protects"| node_adminguard
node_routes -->|"applies"| node_authint
node_routes -->|"applies"| node_errint
node_adminlogin -->|"uses"| node_authsvc
node_adminreset -->|"uses"| node_authsvc
node_admindash -->|"fetches"| node_adminsvc
node_adminmgmt -->|"manages"| node_adminsvc
node_gamestart -->|"starts"| node_gamesvc
node_gameboard -->|"plays"| node_gamesvc
node_gameboard -->|"alerts"| node_notifsvc
node_leaderboard -->|"reads"| node_playersvc
node_profile -->|"reads"| node_playersvc
node_adminmgmt -->|"manages"| node_roomsvc
node_layout -->|"includes"| node_langui
node_layout -->|"includes"| node_notifyui
node_adminmgmt -->|"uses"| node_tabsui
node_langui -->|"drives"| node_langsvc
node_notifyui -->|"binds"| node_notifsvc
node_authsvc -->|"serializes"| node_authreq
node_authsvc -->|"consumes"| node_authresp
node_gamesvc -->|"tracks"| node_gamesess
node_leaderboard -->|"consumes"| node_leadermodel
node_profile -->|"consumes"| node_playermodel
node_adminmgmt -->|"consumes"| node_roommodel

click node_main "https://github.com/johnwickjj/analisisc/blob/main/src/main.ts"
click node_appconfig "https://github.com/johnwickjj/analisisc/blob/main/src/app/app.config.ts"
click node_routes "https://github.com/johnwickjj/analisisc/blob/main/src/app/app.routes.ts"
click node_root "https://github.com/johnwickjj/analisisc/blob/main/src/app/app.component.ts"
click node_layout "https://github.com/johnwickjj/analisisc/blob/main/src/app/layout/main-layout.component.ts"
click node_authsvc "https://github.com/johnwickjj/analisisc/blob/main/src/app/core/services/auth.service.ts"
click node_adminguard "https://github.com/johnwickjj/analisisc/blob/main/src/app/core/guards/admin.guard.ts"
click node_authint "https://github.com/johnwickjj/analisisc/blob/main/src/app/core/interceptors/auth.interceptor.ts"
click node_errint "https://github.com/johnwickjj/analisisc/blob/main/src/app/core/interceptors/error.interceptor.ts"
click node_adminsvc "https://github.com/johnwickjj/analisisc/blob/main/src/app/core/services/admin.service.ts"
click node_gamesvc "https://github.com/johnwickjj/analisisc/blob/main/src/app/core/services/game.service.ts"
click node_playersvc "https://github.com/johnwickjj/analisisc/blob/main/src/app/core/services/player.service.ts"
click node_roomsvc "https://github.com/johnwickjj/analisisc/blob/main/src/app/core/services/room.service.ts"
click node_notifsvc "https://github.com/johnwickjj/analisisc/blob/main/src/app/core/services/notification.service.ts"
click node_langsvc "https://github.com/johnwickjj/analisisc/blob/main/src/app/core/services/language.service.ts"
click node_admindash "https://github.com/johnwickjj/analisisc/blob/main/src/app/features/admin/dashboard/admin-dashboard.component.ts"
click node_adminmgmt "https://github.com/johnwickjj/analisisc/blob/main/src/app/features/admin/admin-management/admin-management.component.ts"
click node_adminlogin "https://github.com/johnwickjj/analisisc/blob/main/src/app/features/admin/login/admin-login.component.ts"
click node_adminreset "https://github.com/johnwickjj/analisisc/blob/main/src/app/features/admin/password-reset/request/password-reset-request.component.ts"
click node_gamestart "https://github.com/johnwickjj/analisisc/blob/main/src/app/features/game/start/game-start.component.ts"
click node_gameboard "https://github.com/johnwickjj/analisisc/blob/main/src/app/features/game/board/game-board.component.ts"
click node_leaderboard "https://github.com/johnwickjj/analisisc/blob/main/src/app/features/leaderboard/leaderboard.component.ts"
click node_profile "https://github.com/johnwickjj/analisisc/blob/main/src/app/features/profile/player-profile.component.ts"
click node_langui "https://github.com/johnwickjj/analisisc/blob/main/src/app/shared/components/language-selector/language-selector.component.ts"
click node_notifyui "https://github.com/johnwickjj/analisisc/blob/main/src/app/shared/notification/notification.component.ts"
click node_tabsui "https://github.com/johnwickjj/analisisc/blob/main/src/app/shared/tabs/tabs.component.ts"
click node_authreq "https://github.com/johnwickjj/analisisc/blob/main/src/app/core/models/auth/login-request.interface.ts"
click node_authresp "https://github.com/johnwickjj/analisisc/blob/main/src/app/core/models/auth/auth-response.interface.ts"
click node_gamesess "https://github.com/johnwickjj/analisisc/blob/main/src/app/core/models/game/game-session.interface.ts"
click node_leadermodel "https://github.com/johnwickjj/analisisc/blob/main/src/app/core/models/game/leaderboard.interface.ts"
click node_playermodel "https://github.com/johnwickjj/analisisc/blob/main/src/app/core/models/player/player.interface.ts"
click node_roommodel "https://github.com/johnwickjj/analisisc/blob/main/src/app/core/models/room/room.interface.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_main,node_appconfig,node_routes,node_root,node_layout toneBlue
class node_authsvc,node_adminguard,node_authint,node_errint,node_adminsvc,node_gamesvc,node_playersvc,node_roomsvc,node_notifsvc,node_langsvc toneAmber
class node_admindash,node_adminmgmt,node_adminlogin,node_adminreset,node_gamestart,node_gameboard,node_leaderboard,node_profile toneMint
class node_langui,node_notifyui,node_tabsui toneRose
class node_authreq,node_authresp,node_gamesess,node_leadermodel,node_playermodel,node_roommodel toneIndigo
```

## Components

### Application shell

Bootstrap, global providers, routing, and top-level layout.

- [main.ts](https://github.com/johnwickjj/analisisc/blob/main/src/main.ts): bootstrap · Angular entrypoint that starts the SPA. · `src/main.ts`
- [app.config.ts](https://github.com/johnwickjj/analisisc/blob/main/src/app/app.config.ts): providers · Global app providers and runtime configuration. · `src/app/app.config.ts`
- [app.routes.ts](https://github.com/johnwickjj/analisisc/blob/main/src/app/app.routes.ts): routing · Top-level route map for the application. · `src/app/app.routes.ts`
- [App shell](https://github.com/johnwickjj/analisisc/blob/main/src/app/app.component.ts): root component · Root application component hosting the overall shell. · `src/app/app.component.ts`
- [Main layout](https://github.com/johnwickjj/analisisc/blob/main/src/app/layout/main-layout.component.ts): layout component · Primary authenticated/user-facing frame. · `src/app/layout/main-layout.component.ts`

### Core layer

Cross-cutting infrastructure, guards, interceptors, and backend-facing services.

- [Auth service](https://github.com/johnwickjj/analisisc/blob/main/src/app/core/services/auth.service.ts): auth service · Login/session handling and auth state. · `src/app/core/services/auth.service.ts`
- [Admin guard](https://github.com/johnwickjj/analisisc/blob/main/src/app/core/guards/admin.guard.ts): route guard · Protects privileged admin routes. · `src/app/core/guards/admin.guard.ts`
- [Auth interceptor](https://github.com/johnwickjj/analisisc/blob/main/src/app/core/interceptors/auth.interceptor.ts): http interceptor · Attaches auth context to outgoing requests. · `src/app/core/interceptors/auth.interceptor.ts`
- [Error interceptor](https://github.com/johnwickjj/analisisc/blob/main/src/app/core/interceptors/error.interceptor.ts): http interceptor · Centralized HTTP error handling. · `src/app/core/interceptors/error.interceptor.ts`
- [Admin service](https://github.com/johnwickjj/analisisc/blob/main/src/app/core/services/admin.service.ts): api service · Admin-facing API and workflow integration. · `src/app/core/services/admin.service.ts`
- [Game service](https://github.com/johnwickjj/analisisc/blob/main/src/app/core/services/game.service.ts): api service · Gameplay and session API integration. · `src/app/core/services/game.service.ts`
- [Player service](https://github.com/johnwickjj/analisisc/blob/main/src/app/core/services/player.service.ts): api service · Player and profile API integration. · `src/app/core/services/player.service.ts`
- [Room service](https://github.com/johnwickjj/analisisc/blob/main/src/app/core/services/room.service.ts): api service · Room and lobby backend integration. · `src/app/core/services/room.service.ts`
- [Notification service](https://github.com/johnwickjj/analisisc/blob/main/src/app/core/services/notification.service.ts): ui feedback service · App-wide user messaging and notifications. · `src/app/core/services/notification.service.ts`
- [Language service](https://github.com/johnwickjj/analisisc/blob/main/src/app/core/services/language.service.ts): i18n service · Manages locale selection and translation state. · `src/app/core/services/language.service.ts`

### Feature areas

Route-level user-facing and admin screens.

- [Admin dashboard](https://github.com/johnwickjj/analisisc/blob/main/src/app/features/admin/dashboard/admin-dashboard.component.ts): admin screen · Primary admin overview and metrics page. · `src/app/features/admin/dashboard/admin-dashboard.component.ts`
- [Admin management](https://github.com/johnwickjj/analisisc/blob/main/src/app/features/admin/admin-management/admin-management.component.ts): admin screen · Management console for users, questions, rooms, and settings. · `src/app/features/admin/admin-management/admin-management.component.ts`
- [Admin login](https://github.com/johnwickjj/analisisc/blob/main/src/app/features/admin/login/admin-login.component.ts): auth screen · Admin authentication entry screen. · `src/app/features/admin/login/admin-login.component.ts`
- [Password reset](https://github.com/johnwickjj/analisisc/blob/main/src/app/features/admin/password-reset/request/password-reset-request.component.ts): auth flow · Request, verify, and complete password reset for admins. · `src/app/features/admin/password-reset/request/password-reset-request.component.ts`
- [Game start](https://github.com/johnwickjj/analisisc/blob/main/src/app/features/game/start/game-start.component.ts): game screen · Initial gameplay and session setup screen. · `src/app/features/game/start/game-start.component.ts`
- [Game board](https://github.com/johnwickjj/analisisc/blob/main/src/app/features/game/board/game-board.component.ts): game screen · Active gameplay board and in-session interactions. · `src/app/features/game/board/game-board.component.ts`
- [Leaderboard](https://github.com/johnwickjj/analisisc/blob/main/src/app/features/leaderboard/leaderboard.component.ts): ranking view · Player-facing ranking screen. · `src/app/features/leaderboard/leaderboard.component.ts`
- [Player profile](https://github.com/johnwickjj/analisisc/blob/main/src/app/features/profile/player-profile.component.ts): profile view · Player-facing profile and stats screen. · `src/app/features/profile/player-profile.component.ts`

### Shared UI

Reusable presentation components used across features.

- [Language selector](https://github.com/johnwickjj/analisisc/blob/main/src/app/shared/components/language-selector/language-selector.component.ts): shared component · Reusable locale picker used across the app. · `src/app/shared/components/language-selector/language-selector.component.ts`
- [Notifications](https://github.com/johnwickjj/analisisc/blob/main/src/app/shared/notification/notification.component.ts): shared component · Reusable notification display widget. · `src/app/shared/notification/notification.component.ts`
- [Tabs](https://github.com/johnwickjj/analisisc/blob/main/src/app/shared/tabs/tabs.component.ts): shared component · Reusable tab navigation component. · `src/app/shared/tabs/tabs.component.ts`

### Domain contracts

Representative typed contracts exchanged with the backend and between layers.

- [Login request](https://github.com/johnwickjj/analisisc/blob/main/src/app/core/models/auth/login-request.interface.ts): auth model · Credential payload sent during login. · `src/app/core/models/auth/login-request.interface.ts`
- [Auth response](https://github.com/johnwickjj/analisisc/blob/main/src/app/core/models/auth/auth-response.interface.ts): auth model · Authentication and session response contract. · `src/app/core/models/auth/auth-response.interface.ts`
- [Game session](https://github.com/johnwickjj/analisisc/blob/main/src/app/core/models/game/game-session.interface.ts): game model · Session state for gameplay flows. · `src/app/core/models/game/game-session.interface.ts`
- [Leaderboard data](https://github.com/johnwickjj/analisisc/blob/main/src/app/core/models/game/leaderboard.interface.ts): game model · Ranking and score contract. · `src/app/core/models/game/leaderboard.interface.ts`
- [Player data](https://github.com/johnwickjj/analisisc/blob/main/src/app/core/models/player/player.interface.ts): player model · Player and profile contract. · `src/app/core/models/player/player.interface.ts`
- [Room data](https://github.com/johnwickjj/analisisc/blob/main/src/app/core/models/room/room.interface.ts): room model · Room and lobby contract. · `src/app/core/models/room/room.interface.ts`

## Connections

- main.ts → app.config.ts: bootstraps · Application startup wires global providers.
- app.config.ts → app.routes.ts: registers · Providers enable route-driven navigation.
- app.routes.ts → App shell: renders · Top-level route tree mounts the app shell.
- App shell → Main layout: hosts · Main shell composes the authenticated layout.
- app.routes.ts → Admin login: routes · Admin entry point is route-backed.
- app.routes.ts → Admin dashboard: routes · Admin dashboard is a routed screen.
- app.routes.ts → Admin management: routes · Admin management areas are route-level features.
- app.routes.ts → Password reset: routes · Password reset flow is routed.
- app.routes.ts → Game start: routes · Game setup screen is route-level.
- app.routes.ts → Game board: routes · Gameplay board is route-level.
- app.routes.ts → Leaderboard: routes · Leaderboard view is route-level.
- app.routes.ts → Player profile: routes · Player profile is route-level.
- app.routes.ts → Admin guard: protects · Privileged routes are guarded.
- app.routes.ts → Auth interceptor: applies · Global route-backed HTTP calls use auth interception.
- app.routes.ts → Error interceptor: applies · Global HTTP failures are centrally handled.
- Admin login → Auth service: uses · Login screen authenticates through the auth service.
- Password reset → Auth service: uses · Reset flow is part of auth/session management.
- Admin dashboard → Admin service: fetches · Dashboard data comes from admin APIs.
- Admin management → Admin service: manages · CRUD and workflow actions go through admin services.
- Game start → Game service: starts · Game setup coordinates session creation.
- Game board → Game service: plays · In-game actions flow through the game service.
- Game board → Notification service: alerts · Gameplay interruptions surface via notifications.
- Leaderboard → Player service: reads · Ranking view consumes player-related data.
- Player profile → Player service: reads · Profile view consumes player data.
- Admin management → Room service: manages · Room administration goes through room service.
- Main layout → Language selector: includes · Shell exposes language switching globally.
- Main layout → Notifications: includes · Shell renders app-wide notifications.
- Admin management → Tabs: uses · Tabbed admin workflows reuse shared tabs.
- Language selector → Language service: drives · Language picker updates localization state.
- Notifications → Notification service: binds · Notification widget renders service-backed messages.
- Auth service → Login request: serializes · Login requests use the auth request contract.
- Auth service → Auth response: consumes · Auth responses define session payloads.
- Game service → Game session: tracks · Gameplay service coordinates session state.
- Leaderboard → Leaderboard data: consumes · Leaderboard UI is backed by ranking contract.
- Player profile → Player data: consumes · Profile UI uses player contract.
- Admin management → Room data: consumes · Admin room workflows use room contract.
