# parthasarathyhmh/loyalty-api architecture

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

- Interactive diagram: https://gitdiagram.com/parthasarathyhmh/loyalty-api
- Repository: https://github.com/parthasarathyhmh/loyalty-api

## Overview

loyalty-api is a NestJS loyalty-program API. Its main user workflow authenticates a customer, serves profile and tier information, and supports browsing and redeeming catalog rewards against a points wallet; separate machine-facing checkout routes handle exchange redemption, order conversion, and reversals. Rules, milestones, CMS sections, third-party wallet access, and health checks are additional product areas present in the tree. The graph follows documented controller-to-service calls and module registration; unsampled internal interactions are omitted rather than inferred.

Main entry points: [`src/app.module.ts`](https://github.com/parthasarathyhmh/loyalty-api/blob/main/src/app.module.ts) (Application setup), [`src/user/user.controller.ts`](https://github.com/parthasarathyhmh/loyalty-api/blob/main/src/user/user.controller.ts) (User API), [`src/catalog/catalog.controller.ts`](https://github.com/parthasarathyhmh/loyalty-api/blob/main/src/catalog/catalog.controller.ts) (Catalog API), [`src/wallet/wallet.controller.ts`](https://github.com/parthasarathyhmh/loyalty-api/blob/main/src/wallet/wallet.controller.ts) (Wallet API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_identity["Identity and accounts"]
  node_user_api["User API<br/>[user.controller.ts]"]
  node_user_service["User service<br/>[user.service.ts]"]
  node_account_service["Account service"]
end

subgraph group_rewards["Rewards and points"]
  node_catalog_api["Catalog API"]
  node_catalog_service["Catalog service<br/>[catalog.service.ts]"]
  node_wallet_api["Wallet API"]
  node_wallet_service["Wallet service<br/>[wallet.service.ts]"]
  node_point_service["Point service<br/>[points.service.ts]"]
  node_wallet_store[("Wallet records<br/>[wallet.entity.ts]")]
  node_point_records[("Point records")]
end

subgraph group_program["Program operations"]
  node_checkout_api["Checkout API"]
  node_checkout_service["Checkout service"]
  node_rules_api["Rules API<br/>[rule.controller.ts]"]
  node_rules_service["Rule service<br/>[rule.service.ts]"]
  node_milestone["Milestones"]
  node_cms_sections["CMS sections"]
  node_third_party["Third-party access"]
end

subgraph group_runtime["API runtime"]
  node_health["Health checks"]
  node_application["Application setup<br/>[app.module.ts]"]
  node_database_config[("Database setup<br/>[datasource.ts]")]
end

node_customer(("Customer"))

node_customer -->|"authenticates"| node_user_api
node_user_api -->|"calls"| node_user_service
node_customer -->|"browses or redeems"| node_catalog_api
node_catalog_api -->|"calls"| node_catalog_service
node_customer -.->|"requests wallet data"| node_wallet_api
node_wallet_api -->|"calls"| node_wallet_service
node_customer -.->|"requests exchange"| node_checkout_api
node_checkout_api -->|"calls"| node_checkout_service
node_customer -.->|"requests rule operation"| node_rules_api
node_rules_api -->|"calls"| node_rules_service
node_application -->|"configures"| node_database_config
node_application -->|"registers"| node_health
node_application -->|"registers module"| node_user_api
node_application -->|"registers module"| node_catalog_api
node_application -->|"registers module"| node_wallet_api
node_application -->|"registers module"| node_checkout_api
node_application -->|"registers module"| node_rules_api
node_application -->|"registers module"| node_milestone
node_application -->|"registers module"| node_cms_sections
node_application -->|"registers module"| node_third_party

click node_user_api "https://github.com/parthasarathyhmh/loyalty-api/blob/main/src/user/user.controller.ts"
click node_user_service "https://github.com/parthasarathyhmh/loyalty-api/blob/main/src/user/user.service.ts"
click node_account_service "https://github.com/parthasarathyhmh/loyalty-api/blob/main/src/common/services/accounts.service.ts"
click node_catalog_api "https://github.com/parthasarathyhmh/loyalty-api/blob/main/src/catalog/catalog.controller.ts"
click node_catalog_service "https://github.com/parthasarathyhmh/loyalty-api/blob/main/src/catalog/catalog.service.ts"
click node_wallet_api "https://github.com/parthasarathyhmh/loyalty-api/blob/main/src/wallet/wallet.controller.ts"
click node_wallet_service "https://github.com/parthasarathyhmh/loyalty-api/blob/main/src/wallet/wallet.service.ts"
click node_point_service "https://github.com/parthasarathyhmh/loyalty-api/blob/main/src/common/services/points.service.ts"
click node_wallet_store "https://github.com/parthasarathyhmh/loyalty-api/blob/main/src/wallet/entities/wallet.entity.ts"
click node_point_records "https://github.com/parthasarathyhmh/loyalty-api/blob/main/src/wallet/entities/point-transaction.entity.ts"
click node_checkout_api "https://github.com/parthasarathyhmh/loyalty-api/blob/main/src/checkout/checkout.controller.ts"
click node_checkout_service "https://github.com/parthasarathyhmh/loyalty-api/blob/main/src/checkout/checkout.service.ts"
click node_rules_api "https://github.com/parthasarathyhmh/loyalty-api/blob/main/src/rules/rule.controller.ts"
click node_rules_service "https://github.com/parthasarathyhmh/loyalty-api/blob/main/src/rules/rule.service.ts"
click node_milestone "https://github.com/parthasarathyhmh/loyalty-api/tree/main/src/milestone"
click node_cms_sections "https://github.com/parthasarathyhmh/loyalty-api/tree/main/src/cms-sections"
click node_third_party "https://github.com/parthasarathyhmh/loyalty-api/tree/main/src/thridparty"
click node_health "https://github.com/parthasarathyhmh/loyalty-api/tree/main/src/health"
click node_application "https://github.com/parthasarathyhmh/loyalty-api/blob/main/src/app.module.ts"
click node_database_config "https://github.com/parthasarathyhmh/loyalty-api/blob/main/db/datasource.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_user_api,node_user_service,node_account_service toneBlue
class node_catalog_api,node_catalog_service,node_wallet_api,node_wallet_service,node_point_service,node_wallet_store,node_point_records toneAmber
class node_checkout_api,node_checkout_service,node_rules_api,node_rules_service,node_milestone,node_cms_sections,node_third_party toneMint
class node_health,node_application,node_database_config toneRose
class node_customer toneIndigo
```

## Components

### Identity and accounts

- [User API](https://github.com/parthasarathyhmh/loyalty-api/blob/main/src/user/user.controller.ts): `src/user/user.controller.ts`
- [User service](https://github.com/parthasarathyhmh/loyalty-api/blob/main/src/user/user.service.ts): `src/user/user.service.ts`
- [Account service](https://github.com/parthasarathyhmh/loyalty-api/blob/main/src/common/services/accounts.service.ts): `src/common/services/accounts.service.ts`

### Rewards and points

- [Catalog API](https://github.com/parthasarathyhmh/loyalty-api/blob/main/src/catalog/catalog.controller.ts): `src/catalog/catalog.controller.ts`
- [Catalog service](https://github.com/parthasarathyhmh/loyalty-api/blob/main/src/catalog/catalog.service.ts): `src/catalog/catalog.service.ts`
- [Wallet API](https://github.com/parthasarathyhmh/loyalty-api/blob/main/src/wallet/wallet.controller.ts): `src/wallet/wallet.controller.ts`
- [Wallet service](https://github.com/parthasarathyhmh/loyalty-api/blob/main/src/wallet/wallet.service.ts): `src/wallet/wallet.service.ts`
- [Point service](https://github.com/parthasarathyhmh/loyalty-api/blob/main/src/common/services/points.service.ts): `src/common/services/points.service.ts`
- [Wallet records](https://github.com/parthasarathyhmh/loyalty-api/blob/main/src/wallet/entities/wallet.entity.ts): `src/wallet/entities/wallet.entity.ts`
- [Point records](https://github.com/parthasarathyhmh/loyalty-api/blob/main/src/wallet/entities/point-transaction.entity.ts): `src/wallet/entities/point-transaction.entity.ts`

### Program operations

- [Checkout API](https://github.com/parthasarathyhmh/loyalty-api/blob/main/src/checkout/checkout.controller.ts): `src/checkout/checkout.controller.ts`
- [Checkout service](https://github.com/parthasarathyhmh/loyalty-api/blob/main/src/checkout/checkout.service.ts): `src/checkout/checkout.service.ts`
- [Rules API](https://github.com/parthasarathyhmh/loyalty-api/blob/main/src/rules/rule.controller.ts): `src/rules/rule.controller.ts`
- [Rule service](https://github.com/parthasarathyhmh/loyalty-api/blob/main/src/rules/rule.service.ts): `src/rules/rule.service.ts`
- [Milestones](https://github.com/parthasarathyhmh/loyalty-api/tree/main/src/milestone): `src/milestone`
- [CMS sections](https://github.com/parthasarathyhmh/loyalty-api/tree/main/src/cms-sections): `src/cms-sections`
- [Third-party access](https://github.com/parthasarathyhmh/loyalty-api/tree/main/src/thridparty): `src/thridparty`

### API runtime

- [Health checks](https://github.com/parthasarathyhmh/loyalty-api/tree/main/src/health): `src/health`
- [Application setup](https://github.com/parthasarathyhmh/loyalty-api/blob/main/src/app.module.ts): `src/app.module.ts`
- [Database setup](https://github.com/parthasarathyhmh/loyalty-api/blob/main/db/datasource.ts): `db/datasource.ts`

### Other components

- **Customer**

## Connections

- Customer → User API: authenticates (evidence: `src/user/user.controller.ts`)
- User API → User service: calls (evidence: `src/user/user.controller.ts`)
- Customer → Catalog API: browses or redeems (evidence: `src/catalog/catalog.controller.ts`)
- Catalog API → Catalog service: calls (evidence: `src/catalog/catalog.controller.ts`)
- Customer → Wallet API: requests wallet data
- Wallet API → Wallet service: calls (evidence: `src/wallet/wallet.controller.ts`)
- Customer → Checkout API: requests exchange
- Checkout API → Checkout service: calls (evidence: `src/checkout/checkout.controller.ts`)
- Customer → Rules API: requests rule operation
- Rules API → Rule service: calls (evidence: `src/rules/rule.controller.ts`)
- Application setup → Database setup: configures (evidence: `src/app.module.ts`)
- Application setup → Health checks: registers (evidence: `src/app.module.ts`)
- Application setup → User API: registers module (evidence: `src/app.module.ts`)
- Application setup → Catalog API: registers module (evidence: `src/app.module.ts`)
- Application setup → Wallet API: registers module (evidence: `src/app.module.ts`)
- Application setup → Checkout API: registers module (evidence: `src/app.module.ts`)
- Application setup → Rules API: registers module (evidence: `src/app.module.ts`)
- Application setup → Milestones: registers module (evidence: `src/app.module.ts`)
- Application setup → CMS sections: registers module (evidence: `src/app.module.ts`)
- Application setup → Third-party access: registers module (evidence: `src/app.module.ts`)
