# sergio-personalprojects/pokedexangular architecture

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

- Interactive diagram: https://gitdiagram.com/sergio-personalprojects/pokedexangular
- Repository: https://github.com/sergio-personalprojects/pokedexangular

## Overview

1. **Overall shape**
   - This is a single-page Angular client for a Pokedex.
   - There is no custom backend in the repo; the app’s main external dependency is the public **PokeAPI**.
   - Architecture is centered around one feature page and a small set of reusable presentation components.

2. **Application bootstrap and shell**
   - `src/main.ts`, `app.config.ts`, and `app.routes.ts` define the Angular startup path and route setup.
   - `AppComponent` is the top-level shell, with the main experience routed into the `HomeComponent`.
   - This suggests a lightweight SPA with routing used mainly to mount the home screen rather than multiple complex screens.

3. **Primary feature boundary: Home page**
   - `src/app/pages/home/home.component.ts` is the main stateful container.
   - It owns the core application workflow: loading Pokémon, handling pagination/scroll, tracking the selected Pokémon, and toggling the detail panel.
   - In architecture terms, this component is the orchestration layer between remote data, selection state, and the child UI components.

4. **Data access layer**
   - `src/app/services/pokemon.service.ts` is the only dedicated service and is the boundary to the API.
   - It likely wraps HTTP calls to PokeAPI for:
     - the paginated Pokémon list,
     - individual Pokémon details,
     - and description/species-related data for the detail view.
   - This keeps API concerns out of the UI components and concentrates remote-data logic in one place.

5. **Domain models / contracts**
   - `src/app/interfaces/pokeapi.ts` and `src/app/interfaces/pokemon.ts` define the data shapes used across the app.
   - These interfaces form the contract between the service and the UI, especially for list items vs. richer Pokémon detail objects.
   - That separation matters because the list view and detail view consume different levels of data completeness.

6. **Reusable presentation components**
   - `TarjetaPokemonComponent` renders each Pokémon card in the list.
   - `FotoPokemonComponent` renders the selected Pokémon image.
   - `DetalleComponent` renders expanded information such as type, height, weight, and description.
   - These are presentation-focused and receive data from the `HomeComponent`, keeping the page logic separate from rendering.

7. **State and event flow**
   - The main flow is: **PokeAPI → PokemonService → HomeComponent → child components**.
   - User interaction flows back upward: clicking a Pokémon card in `TarjetaPokemonComponent` emits an event to `HomeComponent`, which updates the selected Pokémon state.
   - The selected state then drives both the image display and the detail panel, making the page feel synchronized around one central selection.

8. **Paging / scrolling behavior**
   - The readme indicates Pokémon are loaded “por paginas” and the page supports scroll-based loading.
   - That implies the home container manages incremental fetches and appends results rather than loading the full dataset up front.
   - This is the main performance-oriented behavior in the app and shapes how the list view is structured.

9. **Styling and UI assets**
   - Styling is split between component SCSS files and shared assets/styles, especially `src/assets/styles/var.scss`.
   - This indicates the UI likely uses shared design tokens or variables for consistent Pokedex-themed visuals.
   - `src/assets/img` holds static images used by the interface, while component-level SCSS keeps styling close to each feature.

10. **Testing and project tooling**
   - Each major component and the service have `.spec.ts` files, so the repo is set up for Angular unit testing.
   - The project is built with the standard Angular toolchain (`angular.json`, `package.json`, `tsconfig*.json`) and runs through Node/npm.
   - For an architecture diagram, the important tooling boundary is simply: Angular front end, typed with TypeScript, styled with SCSS, and consuming an external REST API.

11. **What to emphasize in a diagram**
   - Put `HomeComponent` in the center as the orchestration point.
   - Show `PokemonService` as the only data-access boundary to PokeAPI.
   - Show `TarjetaPokemonComponent`, `FotoPokemonComponent`, and `DetalleComponent` as children fed by home-state.
   - Show selection/event flow from cards back up to home, and data flow from service down into the UI.

Main entry points: [`src/app/pages/home/home.component.ts`](https://github.com/sergio-personalprojects/pokedexangular/blob/main/src/app/pages/home/home.component.ts) (Home), [`src/app/services/pokemon.service.ts`](https://github.com/sergio-personalprojects/pokedexangular/blob/main/src/app/services/pokemon.service.ts) (Pokemon service), [`src/main.ts`](https://github.com/sergio-personalprojects/pokedexangular/blob/main/src/main.ts) (Main), [`src/app/app.routes.ts`](https://github.com/sergio-personalprojects/pokedexangular/blob/main/src/app/app.routes.ts) (Routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_group_app["App shell"]
  node_node_main["Main<br/>bootstrap<br/>[main.ts]"]
  node_node_config["Config<br/>[app.config.ts]"]
  node_node_routes["Routes<br/>route map<br/>[app.routes.ts]"]
  node_node_shell["App shell<br/>root component<br/>[app.component.ts]"]
  node_node_app_html["App markup<br/>shell template<br/>[app.component.html]"]
end

subgraph group_group_home["Home page"]
  node_node_home["Home<br/>feature container<br/>[home.component.ts]"]
  node_node_service["Pokemon service<br/>api service<br/>[pokemon.service.ts]"]
end

subgraph group_group_components["Presentational UI"]
  node_node_listcard["Tarjeta Pokémon<br/>list card"]
  node_node_photo["Foto Pokémon<br/>image view"]
  node_node_detail["Detalle<br/>detail panel"]
end

subgraph group_group_domain["Data contracts"]
  node_node_iface_api["PokeAPI types<br/>contracts<br/>[pokeapi.ts]"]
  node_node_iface_pokemon["Pokemon types<br/>domain models<br/>[pokemon.ts]"]
end

subgraph group_group_assets["Assets"]
  node_node_styles["Variables<br/>theme tokens<br/>[var.scss]"]
  node_node_images[("Images<br/>static assets")]
end

node_node_pokeapi[("PokeAPI<br/>external API")]

node_node_main -->|"loads"| node_node_config
node_node_main -->|"registers"| node_node_routes
node_node_routes -->|"mounts"| node_node_home
node_node_shell -->|"renders"| node_node_app_html
node_node_home -->|"fetches"| node_node_service
node_node_service -->|"calls"| node_node_pokeapi
node_node_home -->|"feeds list"| node_node_listcard
node_node_home -->|"feeds image"| node_node_photo
node_node_home -->|"feeds detail"| node_node_detail
node_node_listcard -->|"selects"| node_node_home
node_node_home -.->|"uses"| node_node_iface_api
node_node_home -.->|"uses"| node_node_iface_pokemon
node_node_service -.->|"types"| node_node_iface_api
node_node_service -.->|"maps"| node_node_iface_pokemon
node_node_home -.->|"styles"| node_node_styles
node_node_home -.->|"uses assets"| node_node_images

click node_node_main "https://github.com/sergio-personalprojects/pokedexangular/blob/main/src/main.ts"
click node_node_config "https://github.com/sergio-personalprojects/pokedexangular/blob/main/src/app/app.config.ts"
click node_node_routes "https://github.com/sergio-personalprojects/pokedexangular/blob/main/src/app/app.routes.ts"
click node_node_shell "https://github.com/sergio-personalprojects/pokedexangular/blob/main/src/app/app.component.ts"
click node_node_home "https://github.com/sergio-personalprojects/pokedexangular/blob/main/src/app/pages/home/home.component.ts"
click node_node_service "https://github.com/sergio-personalprojects/pokedexangular/blob/main/src/app/services/pokemon.service.ts"
click node_node_listcard "https://github.com/sergio-personalprojects/pokedexangular/blob/main/src/app/components/tarjeta-pokemon/tarjeta-pokemon.component.ts"
click node_node_photo "https://github.com/sergio-personalprojects/pokedexangular/blob/main/src/app/components/foto-pokemon/foto-pokemon.component.ts"
click node_node_detail "https://github.com/sergio-personalprojects/pokedexangular/blob/main/src/app/components/detalle/detalle.component.ts"
click node_node_iface_api "https://github.com/sergio-personalprojects/pokedexangular/blob/main/src/app/interfaces/pokeapi.ts"
click node_node_iface_pokemon "https://github.com/sergio-personalprojects/pokedexangular/blob/main/src/app/interfaces/pokemon.ts"
click node_node_styles "https://github.com/sergio-personalprojects/pokedexangular/blob/main/src/assets/styles/var.scss"
click node_node_images "https://github.com/sergio-personalprojects/pokedexangular/tree/main/src/assets/img"
click node_node_app_html "https://github.com/sergio-personalprojects/pokedexangular/blob/main/src/app/app.component.html"

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_node_main,node_node_config,node_node_routes,node_node_shell,node_node_app_html toneBlue
class node_node_home,node_node_service toneAmber
class node_node_listcard,node_node_photo,node_node_detail toneMint
class node_node_iface_api,node_node_iface_pokemon toneRose
class node_node_styles,node_node_images toneIndigo
class node_node_pokeapi toneNeutral
```

## Components

### App shell

Angular bootstrap, routing, and top-level shell.

- [Main](https://github.com/sergio-personalprojects/pokedexangular/blob/main/src/main.ts): bootstrap · Angular entry point that starts the app. · `src/main.ts`
- [Config](https://github.com/sergio-personalprojects/pokedexangular/blob/main/src/app/app.config.ts): app config · Provides application-level Angular configuration. · `src/app/app.config.ts`
- [Routes](https://github.com/sergio-personalprojects/pokedexangular/blob/main/src/app/app.routes.ts): route map · Defines the app route that mounts the home page. · `src/app/app.routes.ts`
- [App shell](https://github.com/sergio-personalprojects/pokedexangular/blob/main/src/app/app.component.ts): root component · Top-level component that hosts the routed experience. · `src/app/app.component.ts`
- [App markup](https://github.com/sergio-personalprojects/pokedexangular/blob/main/src/app/app.component.html): shell template · Top-level HTML template for the root component. · `src/app/app.component.html`

### Home page

Main feature container and orchestration layer.

- [Home](https://github.com/sergio-personalprojects/pokedexangular/blob/main/src/app/pages/home/home.component.ts): feature container · Stateful page that loads Pokémon, tracks selection, and coordinates child views. · `src/app/pages/home/home.component.ts`
- [Pokemon service](https://github.com/sergio-personalprojects/pokedexangular/blob/main/src/app/services/pokemon.service.ts): api service · Single data-access boundary for PokeAPI requests. · `src/app/services/pokemon.service.ts`

### Presentational UI

Reusable visual components driven by home state.

- [Tarjeta Pokémon](https://github.com/sergio-personalprojects/pokedexangular/blob/main/src/app/components/tarjeta-pokemon/tarjeta-pokemon.component.ts): list card · Renders one Pokémon entry in the browsable list. · `src/app/components/tarjeta-pokemon/tarjeta-pokemon.component.ts`
- [Foto Pokémon](https://github.com/sergio-personalprojects/pokedexangular/blob/main/src/app/components/foto-pokemon/foto-pokemon.component.ts): image view · Shows the selected Pokémon image. · `src/app/components/foto-pokemon/foto-pokemon.component.ts`
- [Detalle](https://github.com/sergio-personalprojects/pokedexangular/blob/main/src/app/components/detalle/detalle.component.ts): detail panel · Displays selected Pokémon attributes and description. · `src/app/components/detalle/detalle.component.ts`

### Data contracts

TypeScript interfaces shared across service and UI.

- [PokeAPI types](https://github.com/sergio-personalprojects/pokedexangular/blob/main/src/app/interfaces/pokeapi.ts): contracts · Interfaces for API-shaped list, species, and detail payloads. · `src/app/interfaces/pokeapi.ts`
- [Pokemon types](https://github.com/sergio-personalprojects/pokedexangular/blob/main/src/app/interfaces/pokemon.ts): domain models · App-level Pokémon data contracts shared by the UI. · `src/app/interfaces/pokemon.ts`

### Assets

Shared static styling and images.

- [Variables](https://github.com/sergio-personalprojects/pokedexangular/blob/main/src/assets/styles/var.scss): theme tokens · Shared SCSS variables for the app theme. · `src/assets/styles/var.scss`
- [Images](https://github.com/sergio-personalprojects/pokedexangular/tree/main/src/assets/img): static assets · Static image assets used by the interface. · `src/assets/img`

### Other components

- **PokeAPI**: external API · Public Pokémon REST API used as the app's backend.

## Connections

- Main → Config: loads · Bootstraps Angular with application configuration.
- Main → Routes: registers · Initializes routing for the single-page app.
- Routes → Home: mounts · Routes the main experience to the Home page.
- App shell → App markup: renders · Uses the root template to host routed content.
- Home → Pokemon service: fetches · Requests paginated lists and Pokémon details.
- Pokemon service → PokeAPI: calls · Boundary from the app to the external REST API.
- Home → Tarjeta Pokémon: feeds list · Supplies list items and handlers to each card.
- Home → Foto Pokémon: feeds image · Passes the selected Pokémon to the photo view.
- Home → Detalle: feeds detail · Passes the selected Pokémon detail data to the panel.
- Tarjeta Pokémon → Home: selects · Emits selection events back to the home container.
- Home → PokeAPI types: uses · Consumes API-shaped contracts for remote responses.
- Home → Pokemon types: uses · Consumes app-level Pokémon models for view state.
- Pokemon service → PokeAPI types: types · Implements API payload contracts.
- Pokemon service → Pokemon types: maps · Transforms remote payloads into app-friendly data.
- Home → Variables: styles · Relies on shared theme variables for page styling.
- Home → Images: uses assets · Renders static images from the shared asset folder.
