# mannuelf/lastfm-nodejs-client architecture

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

- Interactive diagram: https://gitdiagram.com/mannuelf/lastfm-nodejs-client
- Repository: https://github.com/mannuelf/lastfm-nodejs-client

## Overview

LastFm NodeJs client is a typed TypeScript wrapper around the Last.fm API. Callers create a client, select an exposed namespace method (and method-name constant), invoke an operation, and receive a typed API response; authenticated writes additionally require a session key. The graph groups the documented API capabilities and shows the shared request/signing layer. Some endpoint implementations were not sampled, so their internal links are omitted; capability coverage follows the README and client exports.

Main entry points: [`src/index.ts`](https://github.com/mannuelf/lastfm-nodejs-client/blob/main/src/index.ts) (Client facade), [`src/request.ts`](https://github.com/mannuelf/lastfm-nodejs-client/blob/main/src/request.ts) (HTTP request), [`src/artist`](https://github.com/mannuelf/lastfm-nodejs-client/tree/main/src/artist) (Artist operations), [`src/auth`](https://github.com/mannuelf/lastfm-nodejs-client/tree/main/src/auth) (Session exchange)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Client entry"]
  node_facade["Client facade<br/>[index.ts]"]
  node_method_names["Method names<br/>[method.ts]"]
end

subgraph group_domain["API capabilities"]
  node_album_api["Album operations"]
  node_artist_api["Artist operations"]
  node_track_api["Track operations"]
  node_auth_api["Authentication<br/>[auth.ts]"]
  node_auth_sessions["Session exchange"]
  node_discovery["Charts and discovery"]
  node_geo["Geographic charts"]
  node_tags["Tag operations"]
  node_library["Artist library"]
  node_user_legacy["User history and charts<br/>[getTopArtists.ts]"]
end

subgraph group_transport["Request transport"]
  node_request["HTTP request<br/>[request.ts]"]
  node_options["Option builder<br/>[createOptions.ts]"]
  node_signing["MD5 signing<br/>[md5.ts]"]
end

subgraph group_contracts["Configuration and types"]
  node_config["API configuration<br/>[config.ts]"]
  node_types["Response types<br/>[lastfm.types.ts]"]
end

node_caller(("Client caller"))
node_lastfm(("Last.fm API"))

node_caller -->|"creates client"| node_facade
node_facade -->|"exposes names"| node_method_names
node_facade -->|"exposes operations"| node_album_api
node_facade -->|"exposes operations"| node_artist_api
node_facade -->|"exposes operations"| node_track_api
node_facade -->|"exposes methods"| node_auth_api
node_facade -->|"exposes sessions"| node_auth_sessions
node_facade -->|"exposes charts"| node_discovery
node_facade -->|"exposes charts"| node_geo
node_facade -->|"exposes operations"| node_tags
node_facade -->|"exposes operations"| node_library
node_facade -->|"exposes legacy methods"| node_user_legacy
node_caller -->|"invokes methods"| node_artist_api
node_caller -->|"selects method"| node_method_names
node_artist_api -->|"sends query"| node_request
node_album_api -->|"sends query"| node_request
node_discovery -->|"builds options"| node_options
node_auth_api -->|"builds options"| node_options
node_auth_sessions -->|"sends signed request"| node_request
node_request -->|"generates signature"| node_signing
node_request -->|"reads settings"| node_config
node_request -->|"sends HTTP request"| node_lastfm
node_artist_api -->|"types responses"| node_types
node_auth_sessions -->|"reads secret"| node_config

click node_facade "https://github.com/mannuelf/lastfm-nodejs-client/blob/main/src/index.ts"
click node_method_names "https://github.com/mannuelf/lastfm-nodejs-client/blob/main/src/method.ts"
click node_album_api "https://github.com/mannuelf/lastfm-nodejs-client/tree/main/src/album"
click node_artist_api "https://github.com/mannuelf/lastfm-nodejs-client/tree/main/src/artist"
click node_track_api "https://github.com/mannuelf/lastfm-nodejs-client/tree/main/src/track"
click node_auth_api "https://github.com/mannuelf/lastfm-nodejs-client/blob/main/src/auth.ts"
click node_auth_sessions "https://github.com/mannuelf/lastfm-nodejs-client/tree/main/src/auth"
click node_discovery "https://github.com/mannuelf/lastfm-nodejs-client/tree/main/src/chart"
click node_geo "https://github.com/mannuelf/lastfm-nodejs-client/tree/main/src/geo"
click node_tags "https://github.com/mannuelf/lastfm-nodejs-client/tree/main/src/tag"
click node_library "https://github.com/mannuelf/lastfm-nodejs-client/tree/main/src/library"
click node_user_legacy "https://github.com/mannuelf/lastfm-nodejs-client/blob/main/src/getTopArtists.ts"
click node_request "https://github.com/mannuelf/lastfm-nodejs-client/blob/main/src/request.ts"
click node_options "https://github.com/mannuelf/lastfm-nodejs-client/blob/main/src/createOptions.ts"
click node_signing "https://github.com/mannuelf/lastfm-nodejs-client/blob/main/src/md5.ts"
click node_config "https://github.com/mannuelf/lastfm-nodejs-client/blob/main/src/config.ts"
click node_types "https://github.com/mannuelf/lastfm-nodejs-client/blob/main/src/lastfm.types.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_facade,node_method_names,node_caller toneBlue
class node_album_api,node_artist_api,node_track_api,node_auth_api,node_auth_sessions,node_discovery,node_geo,node_tags,node_library,node_user_legacy toneAmber
class node_request,node_options,node_signing,node_lastfm toneMint
class node_config,node_types toneRose
```

## Components

### Client entry

- [Client facade](https://github.com/mannuelf/lastfm-nodejs-client/blob/main/src/index.ts): `src/index.ts`
- [Method names](https://github.com/mannuelf/lastfm-nodejs-client/blob/main/src/method.ts): `src/method.ts`

### API capabilities

- [Album operations](https://github.com/mannuelf/lastfm-nodejs-client/tree/main/src/album): `src/album`
- [Artist operations](https://github.com/mannuelf/lastfm-nodejs-client/tree/main/src/artist): `src/artist`
- [Track operations](https://github.com/mannuelf/lastfm-nodejs-client/tree/main/src/track): `src/track`
- [Authentication](https://github.com/mannuelf/lastfm-nodejs-client/blob/main/src/auth.ts): `src/auth.ts`
- [Session exchange](https://github.com/mannuelf/lastfm-nodejs-client/tree/main/src/auth): `src/auth`
- [Charts and discovery](https://github.com/mannuelf/lastfm-nodejs-client/tree/main/src/chart): `src/chart`
- [Geographic charts](https://github.com/mannuelf/lastfm-nodejs-client/tree/main/src/geo): `src/geo`
- [Tag operations](https://github.com/mannuelf/lastfm-nodejs-client/tree/main/src/tag): `src/tag`
- [Artist library](https://github.com/mannuelf/lastfm-nodejs-client/tree/main/src/library): `src/library`
- [User history and charts](https://github.com/mannuelf/lastfm-nodejs-client/blob/main/src/getTopArtists.ts): `src/getTopArtists.ts`

### Request transport

- [HTTP request](https://github.com/mannuelf/lastfm-nodejs-client/blob/main/src/request.ts): `src/request.ts`
- [Option builder](https://github.com/mannuelf/lastfm-nodejs-client/blob/main/src/createOptions.ts): `src/createOptions.ts`
- [MD5 signing](https://github.com/mannuelf/lastfm-nodejs-client/blob/main/src/md5.ts): `src/md5.ts`

### Configuration and types

- [API configuration](https://github.com/mannuelf/lastfm-nodejs-client/blob/main/src/config.ts): `src/config.ts`
- [Response types](https://github.com/mannuelf/lastfm-nodejs-client/blob/main/src/lastfm.types.ts): `src/lastfm.types.ts`

### Other components

- **Client caller**
- **Last.fm API**

## Connections

- Client caller → Client facade: creates client
- Client facade → Method names: exposes names (evidence: `src/index.ts`)
- Client facade → Album operations: exposes operations (evidence: `src/index.ts`)
- Client facade → Artist operations: exposes operations (evidence: `src/index.ts`)
- Client facade → Track operations: exposes operations (evidence: `src/index.ts`)
- Client facade → Authentication: exposes methods (evidence: `src/index.ts`)
- Client facade → Session exchange: exposes sessions (evidence: `src/index.ts`)
- Client facade → Charts and discovery: exposes charts (evidence: `src/index.ts`)
- Client facade → Geographic charts: exposes charts (evidence: `src/index.ts`)
- Client facade → Tag operations: exposes operations (evidence: `src/index.ts`)
- Client facade → Artist library: exposes operations (evidence: `src/index.ts`)
- Client facade → User history and charts: exposes legacy methods (evidence: `src/index.ts`)
- Client caller → Artist operations: invokes methods
- Client caller → Method names: selects method
- Artist operations → HTTP request: sends query (evidence: `src/artist/search.ts`)
- Album operations → HTTP request: sends query (evidence: `src/album/search.ts`)
- Charts and discovery → Option builder: builds options (evidence: `src/chart/topArtists.ts`)
- Authentication → Option builder: builds options (evidence: `src/auth.ts`)
- Session exchange → HTTP request: sends signed request (evidence: `src/auth/getMobileSession.ts`)
- HTTP request → MD5 signing: generates signature (evidence: `src/request.ts`)
- HTTP request → API configuration: reads settings (evidence: `src/request.ts`)
- HTTP request → Last.fm API: sends HTTP request (evidence: `src/request.ts`)
- Artist operations → Response types: types responses (evidence: `src/artist/search.ts`)
- Session exchange → API configuration: reads secret (evidence: `src/auth/getMobileSession.ts`)
