# tonysamperi/ts-mapi-core architecture

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

- Interactive diagram: https://gitdiagram.com/tonysamperi/ts-mapi-core
- Repository: https://github.com/tonysamperi/ts-mapi-core

## Overview

This package is a reusable TypeScript library of frontend/backend services and shared domain utilities. A consumer imports its public entry point, then uses relevant HTTP, Firebase-authentication, or DynamoDB functionality and receives responses or service results; it also exports standalone API, gift-card, crypto, caching, RxJS, validation, and utility components. The graph preserves these documented export branches and the sampled internal calls. Some subsystem implementations were not sampled, so their internal relationships are omitted.

Main entry points: [`src/index.ts`](https://github.com/tonysamperi/ts-mapi-core/blob/master/src/index.ts) (Public exports), [`src/services/http/smp-http.service.ts`](https://github.com/tonysamperi/ts-mapi-core/blob/master/src/services/http/smp-http.service.ts) (HTTP client), [`src/services/firebase/smp-firebase.service.ts`](https://github.com/tonysamperi/ts-mapi-core/blob/master/src/services/firebase/smp-firebase.service.ts) (Firebase auth), [`src/services/http/smp-http-session-storage-cache.class.ts`](https://github.com/tonysamperi/ts-mapi-core/blob/master/src/services/http/smp-http-session-storage-cache.class.ts) (Session cache)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry_services["Entry and services"]
  node_public_api["Public exports<br/>[index.ts]"]
  node_http["HTTP client"]
  node_session_cache["Session cache"]
  node_firebase["Firebase auth"]
  node_firebase_config["Firebase config"]
  node_dynamo["DynamoDB service"]
end

subgraph group_domain_types["Domain models"]
  node_api_responses["API responses"]
  node_error_response["Error responses"]
  node_giftcard["Gift-card transactions"]
  node_marketing_cloud["Marketing Cloud types"]
  node_common_auth["Common auth types"]
end

subgraph group_shared_runtime["Shared runtime"]
  node_crypto["AES crypto"]
  node_cache_core["Cache strategies"]
  node_ttl_cache["TTL cache"]
  node_browser_cache["Browser cache"]
  node_common_utils["Common utilities"]
end

subgraph group_reactive_validation["Reactive and validation"]
  node_rxjs_cache["RxJS TTL cache"]
  node_rxjs_tools["RxJS operators"]
  node_zod_datetime["Zod date-time"]
end

node_consumer(("Library consumer"))
node_dynamo_remote[("AWS DynamoDB")]

node_consumer -.->|"imports"| node_public_api
node_public_api -->|"exports"| node_http
node_public_api -->|"exports"| node_firebase
node_public_api -->|"exports"| node_dynamo
node_public_api -->|"exports"| node_api_responses
node_public_api -->|"exports"| node_crypto
node_public_api -->|"exports"| node_giftcard
node_public_api -->|"exports"| node_marketing_cloud
node_public_api -->|"exports"| node_common_auth
node_public_api -->|"exports"| node_rxjs_cache
node_public_api -->|"exports"| node_rxjs_tools
node_public_api -->|"exports"| node_zod_datetime
node_http -->|"uses errors"| node_error_response
node_http -->|"selects cache"| node_session_cache
node_http -->|"uses strategy"| node_ttl_cache
node_session_cache -->|"extends"| node_browser_cache
node_firebase -->|"reads config"| node_firebase_config
node_firebase -->|"uses sign-in types"| node_common_auth
node_dynamo -->|"reads and writes"| node_dynamo_remote
node_error_response -->|"extends"| node_api_responses
node_giftcard -->|"encrypts and decrypts"| node_crypto
node_ttl_cache -->|"extends"| node_cache_core
node_rxjs_cache -->|"extends"| node_cache_core

click node_public_api "https://github.com/tonysamperi/ts-mapi-core/blob/master/src/index.ts"
click node_http "https://github.com/tonysamperi/ts-mapi-core/blob/master/src/services/http/smp-http.service.ts"
click node_session_cache "https://github.com/tonysamperi/ts-mapi-core/blob/master/src/services/http/smp-http-session-storage-cache.class.ts"
click node_firebase "https://github.com/tonysamperi/ts-mapi-core/blob/master/src/services/firebase/smp-firebase.service.ts"
click node_firebase_config "https://github.com/tonysamperi/ts-mapi-core/blob/master/src/services/firebase/smp-firebase-service-config.interface.ts"
click node_dynamo "https://github.com/tonysamperi/ts-mapi-core/blob/master/src/services/smp-dynamo.service.ts"
click node_api_responses "https://github.com/tonysamperi/ts-mapi-core/blob/master/src/shared/api/smp-generic-response.class.ts"
click node_error_response "https://github.com/tonysamperi/ts-mapi-core/blob/master/src/shared/api/smp-error-response.class.ts"
click node_giftcard "https://github.com/tonysamperi/ts-mapi-core/blob/master/src/shared/giftcard/smp-giftcard-transaction.class.ts"
click node_marketing_cloud "https://github.com/tonysamperi/ts-mapi-core/blob/master/src/shared/marketing-cloud/smp-marketing-cloud-validation-response.interface.ts"
click node_common_auth "https://github.com/tonysamperi/ts-mapi-core/blob/master/src/shared/common/smp-base-jwt-token.class.ts"
click node_crypto "https://github.com/tonysamperi/ts-mapi-core/blob/master/src/shared/crypto/smp-aes-crypt.class.ts"
click node_cache_core "https://github.com/tonysamperi/ts-mapi-core/blob/master/src/shared/utils/cache/smp-abstract-cache-strategy.class.ts"
click node_ttl_cache "https://github.com/tonysamperi/ts-mapi-core/blob/master/src/shared/utils/cache/smp-abstract-ttl-cache-strategy.class.ts"
click node_browser_cache "https://github.com/tonysamperi/ts-mapi-core/blob/master/src/shared/utils/cache/smp-browser-cache.class.ts"
click node_common_utils "https://github.com/tonysamperi/ts-mapi-core/blob/master/src/shared/utils/smp-common-utils.class.ts"
click node_rxjs_cache "https://github.com/tonysamperi/ts-mapi-core/blob/master/src/shared/rxjs/smp-abstract-rxjs-ttl-cache-strategy.class.ts"
click node_rxjs_tools "https://github.com/tonysamperi/ts-mapi-core/blob/master/src/shared/rxjs/smp-rxjs-throw-on-condition.function.ts"
click node_zod_datetime "https://github.com/tonysamperi/ts-mapi-core/blob/master/src/shared/zod/smp-zod-date-time.definition.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_public_api,node_http,node_session_cache,node_firebase,node_firebase_config,node_dynamo toneBlue
class node_api_responses,node_error_response,node_giftcard,node_marketing_cloud,node_common_auth,node_dynamo_remote toneAmber
class node_crypto,node_cache_core,node_ttl_cache,node_browser_cache,node_common_utils toneMint
class node_rxjs_cache,node_rxjs_tools,node_zod_datetime toneRose
class node_consumer toneIndigo
```

## Components

### Entry and services

- [Public exports](https://github.com/tonysamperi/ts-mapi-core/blob/master/src/index.ts): `src/index.ts`
- [HTTP client](https://github.com/tonysamperi/ts-mapi-core/blob/master/src/services/http/smp-http.service.ts): `src/services/http/smp-http.service.ts`
- [Session cache](https://github.com/tonysamperi/ts-mapi-core/blob/master/src/services/http/smp-http-session-storage-cache.class.ts): `src/services/http/smp-http-session-storage-cache.class.ts`
- [Firebase auth](https://github.com/tonysamperi/ts-mapi-core/blob/master/src/services/firebase/smp-firebase.service.ts): `src/services/firebase/smp-firebase.service.ts`
- [Firebase config](https://github.com/tonysamperi/ts-mapi-core/blob/master/src/services/firebase/smp-firebase-service-config.interface.ts): `src/services/firebase/smp-firebase-service-config.interface.ts`
- [DynamoDB service](https://github.com/tonysamperi/ts-mapi-core/blob/master/src/services/smp-dynamo.service.ts): `src/services/smp-dynamo.service.ts`

### Domain models

- [API responses](https://github.com/tonysamperi/ts-mapi-core/blob/master/src/shared/api/smp-generic-response.class.ts): `src/shared/api/smp-generic-response.class.ts`
- [Error responses](https://github.com/tonysamperi/ts-mapi-core/blob/master/src/shared/api/smp-error-response.class.ts): `src/shared/api/smp-error-response.class.ts`
- [Gift-card transactions](https://github.com/tonysamperi/ts-mapi-core/blob/master/src/shared/giftcard/smp-giftcard-transaction.class.ts): `src/shared/giftcard/smp-giftcard-transaction.class.ts`
- [Marketing Cloud types](https://github.com/tonysamperi/ts-mapi-core/blob/master/src/shared/marketing-cloud/smp-marketing-cloud-validation-response.interface.ts): `src/shared/marketing-cloud/smp-marketing-cloud-validation-response.interface.ts`
- [Common auth types](https://github.com/tonysamperi/ts-mapi-core/blob/master/src/shared/common/smp-base-jwt-token.class.ts): `src/shared/common/smp-base-jwt-token.class.ts`

### Shared runtime

- [AES crypto](https://github.com/tonysamperi/ts-mapi-core/blob/master/src/shared/crypto/smp-aes-crypt.class.ts): `src/shared/crypto/smp-aes-crypt.class.ts`
- [Cache strategies](https://github.com/tonysamperi/ts-mapi-core/blob/master/src/shared/utils/cache/smp-abstract-cache-strategy.class.ts): `src/shared/utils/cache/smp-abstract-cache-strategy.class.ts`
- [TTL cache](https://github.com/tonysamperi/ts-mapi-core/blob/master/src/shared/utils/cache/smp-abstract-ttl-cache-strategy.class.ts): `src/shared/utils/cache/smp-abstract-ttl-cache-strategy.class.ts`
- [Browser cache](https://github.com/tonysamperi/ts-mapi-core/blob/master/src/shared/utils/cache/smp-browser-cache.class.ts): `src/shared/utils/cache/smp-browser-cache.class.ts`
- [Common utilities](https://github.com/tonysamperi/ts-mapi-core/blob/master/src/shared/utils/smp-common-utils.class.ts): `src/shared/utils/smp-common-utils.class.ts`

### Reactive and validation

- [RxJS TTL cache](https://github.com/tonysamperi/ts-mapi-core/blob/master/src/shared/rxjs/smp-abstract-rxjs-ttl-cache-strategy.class.ts): `src/shared/rxjs/smp-abstract-rxjs-ttl-cache-strategy.class.ts`
- [RxJS operators](https://github.com/tonysamperi/ts-mapi-core/blob/master/src/shared/rxjs/smp-rxjs-throw-on-condition.function.ts): `src/shared/rxjs/smp-rxjs-throw-on-condition.function.ts`
- [Zod date-time](https://github.com/tonysamperi/ts-mapi-core/blob/master/src/shared/zod/smp-zod-date-time.definition.ts): `src/shared/zod/smp-zod-date-time.definition.ts`

### Other components

- **Library consumer**
- **AWS DynamoDB**

## Connections

- Library consumer → Public exports: imports
- Public exports → HTTP client: exports (evidence: `src/index.ts`)
- Public exports → Firebase auth: exports (evidence: `src/index.ts`)
- Public exports → DynamoDB service: exports (evidence: `src/index.ts`)
- Public exports → API responses: exports (evidence: `src/index.ts`)
- Public exports → AES crypto: exports (evidence: `src/index.ts`)
- Public exports → Gift-card transactions: exports (evidence: `src/index.ts`)
- Public exports → Marketing Cloud types: exports (evidence: `src/index.ts`)
- Public exports → Common auth types: exports (evidence: `src/index.ts`)
- Public exports → RxJS TTL cache: exports (evidence: `src/index.ts`)
- Public exports → RxJS operators: exports (evidence: `src/index.ts`)
- Public exports → Zod date-time: exports (evidence: `src/index.ts`)
- HTTP client → Error responses: uses errors (evidence: `src/services/http/smp-http.service.ts`)
- HTTP client → Session cache: selects cache (evidence: `src/services/http/smp-http.service.ts`)
- HTTP client → TTL cache: uses strategy (evidence: `src/services/http/smp-http.service.ts`)
- Session cache → Browser cache: extends (evidence: `src/services/http/smp-http-session-storage-cache.class.ts`)
- Firebase auth → Firebase config: reads config (evidence: `src/services/firebase/smp-firebase.service.ts`)
- Firebase auth → Common auth types: uses sign-in types (evidence: `src/services/firebase/smp-firebase.service.ts`)
- DynamoDB service → AWS DynamoDB: reads and writes (evidence: `src/services/smp-dynamo.service.ts`)
- Error responses → API responses: extends (evidence: `src/shared/api/smp-error-response.class.ts`)
- Gift-card transactions → AES crypto: encrypts and decrypts (evidence: `src/shared/giftcard/smp-giftcard-transaction.class.ts`)
- TTL cache → Cache strategies: extends (evidence: `src/shared/utils/cache/smp-abstract-ttl-cache-strategy.class.ts`)
- RxJS TTL cache → Cache strategies: extends (evidence: `src/shared/rxjs/smp-abstract-rxjs-ttl-cache-strategy.class.ts`)
