# charuka-g/recommendation-system-for-ecommerce-aws architecture

> Architecture diagram of the GitHub repository charuka-g/recommendation-system-for-ecommerce-aws, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/charuka-g/recommendation-system-for-ecommerce-aws
- Repository: https://github.com/charuka-g/recommendation-system-for-ecommerce-aws

## Overview

This repository implements a two-stage recommendation product: training and preprocessing notebooks prepare retrieval candidates and a ranking model, while a FastAPI endpoint retrieves a user's candidates, enriches them with features, ranks them, and returns the top results. The graph includes the README-documented training, registry, and Feature Store capabilities as well as the sampled API call flow. Notebook internals were not sampled, so their relationships are based on README statements.

Main entry points: [`inference_api.py`](https://github.com/charuka-g/recommendation-system-for-ecommerce-aws/blob/main/inference_api.py) (Inference API), [`01-Train-FM-Model.ipynb`](https://github.com/charuka-g/recommendation-system-for-ecommerce-aws/blob/main/01-Train-FM-Model.ipynb) (Candidate Generation), [`02-Train-XGBoost-Model.ipynb`](https://github.com/charuka-g/recommendation-system-for-ecommerce-aws/blob/main/02-Train-XGBoost-Model.ipynb) (XGBoost Training), [`00-Setup-Configuration.ipynb`](https://github.com/charuka-g/recommendation-system-for-ecommerce-aws/blob/main/00-Setup-Configuration.ipynb) (AWS Setup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_training["Model Training"]
  node_setup["AWS Setup"]
  node_mftrain["MF Training"]
  node_candidategen["Candidate Generation"]
  node_xgbtrain["XGBoost Training"]
end

subgraph group_features["Feature Preparation"]
  node_glue["Feature Processing"]
end

subgraph group_serving["Recommendation Serving"]
  node_api["Inference API<br/>[inference_api.py]"]
  node_candidatefetch["Candidate Lookup<br/>[inference_api.py]"]
  node_enrichment["Feature Enrichment<br/>[inference_api.py]"]
  node_ranking["XGBoost Ranking<br/>[inference_api.py]"]
  node_response["Top-K Results<br/>[inference_api.py]"]
end

subgraph group_aws["AWS Services"]
  node_s3[("S3 Artifacts")]
  node_registry[("SageMaker Registry")]
  node_dynamodb[("DynamoDB Candidates")]
  node_featurestore[("Feature Store")]
  node_endpoint["SageMaker Endpoint"]
end

node_user(("User"))

node_user -->|"requests recommendations"| node_api
node_setup -->|"configures"| node_mftrain
node_setup -->|"configures"| node_xgbtrain
node_mftrain -->|"extracts embeddings"| node_candidategen
node_candidategen -->|"saves artifacts"| node_s3
node_candidategen -->|"registers model"| node_registry
node_candidategen -->|"stores candidates"| node_dynamodb
node_xgbtrain -->|"joins features"| node_featurestore
node_xgbtrain -->|"deploys model"| node_endpoint
node_glue -->|"processes feature data"| node_featurestore
node_api -->|"calls"| node_candidatefetch
node_candidatefetch -->|"reads candidates"| node_dynamodb
node_api -->|"calls"| node_enrichment
node_enrichment -->|"fetches records"| node_featurestore
node_api -->|"calls"| node_ranking
node_ranking -->|"invokes"| node_endpoint
node_api -->|"sorts and limits"| node_response
node_response -->|"returns recommendations"| node_user

click node_setup "https://github.com/charuka-g/recommendation-system-for-ecommerce-aws/blob/main/00-Setup-Configuration.ipynb"
click node_mftrain "https://github.com/charuka-g/recommendation-system-for-ecommerce-aws/blob/main/01-Train-FM-Model.ipynb"
click node_candidategen "https://github.com/charuka-g/recommendation-system-for-ecommerce-aws/blob/main/01-Train-FM-Model.ipynb"
click node_xgbtrain "https://github.com/charuka-g/recommendation-system-for-ecommerce-aws/blob/main/02-Train-XGBoost-Model.ipynb"
click node_glue "https://github.com/charuka-g/recommendation-system-for-ecommerce-aws/blob/main/03-Glue-Feature-Store-Processing.ipynb"
click node_api "https://github.com/charuka-g/recommendation-system-for-ecommerce-aws/blob/main/inference_api.py"
click node_candidatefetch "https://github.com/charuka-g/recommendation-system-for-ecommerce-aws/blob/main/inference_api.py"
click node_enrichment "https://github.com/charuka-g/recommendation-system-for-ecommerce-aws/blob/main/inference_api.py"
click node_ranking "https://github.com/charuka-g/recommendation-system-for-ecommerce-aws/blob/main/inference_api.py"
click node_response "https://github.com/charuka-g/recommendation-system-for-ecommerce-aws/blob/main/inference_api.py"

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_setup,node_mftrain,node_candidategen,node_xgbtrain,node_user toneBlue
class node_glue toneAmber
class node_api,node_candidatefetch,node_enrichment,node_ranking,node_response toneMint
class node_s3,node_registry,node_dynamodb,node_featurestore,node_endpoint toneRose
```

## Components

### Model Training

- [AWS Setup](https://github.com/charuka-g/recommendation-system-for-ecommerce-aws/blob/main/00-Setup-Configuration.ipynb): `00-Setup-Configuration.ipynb`
- [MF Training](https://github.com/charuka-g/recommendation-system-for-ecommerce-aws/blob/main/01-Train-FM-Model.ipynb): `01-Train-FM-Model.ipynb`
- [Candidate Generation](https://github.com/charuka-g/recommendation-system-for-ecommerce-aws/blob/main/01-Train-FM-Model.ipynb): `01-Train-FM-Model.ipynb`
- [XGBoost Training](https://github.com/charuka-g/recommendation-system-for-ecommerce-aws/blob/main/02-Train-XGBoost-Model.ipynb): `02-Train-XGBoost-Model.ipynb`

### Feature Preparation

- [Feature Processing](https://github.com/charuka-g/recommendation-system-for-ecommerce-aws/blob/main/03-Glue-Feature-Store-Processing.ipynb): `03-Glue-Feature-Store-Processing.ipynb`

### Recommendation Serving

- [Inference API](https://github.com/charuka-g/recommendation-system-for-ecommerce-aws/blob/main/inference_api.py): `inference_api.py`
- [Candidate Lookup](https://github.com/charuka-g/recommendation-system-for-ecommerce-aws/blob/main/inference_api.py): `inference_api.py`
- [Feature Enrichment](https://github.com/charuka-g/recommendation-system-for-ecommerce-aws/blob/main/inference_api.py): `inference_api.py`
- [XGBoost Ranking](https://github.com/charuka-g/recommendation-system-for-ecommerce-aws/blob/main/inference_api.py): `inference_api.py`
- [Top-K Results](https://github.com/charuka-g/recommendation-system-for-ecommerce-aws/blob/main/inference_api.py): `inference_api.py`

### AWS Services

- **S3 Artifacts**
- **SageMaker Registry**
- **DynamoDB Candidates**
- **Feature Store**
- **SageMaker Endpoint**

### Other components

- **User**

## Connections

- User → Inference API: requests recommendations (evidence: `README.md`)
- AWS Setup → MF Training: configures (evidence: `README.md`)
- AWS Setup → XGBoost Training: configures (evidence: `README.md`)
- MF Training → Candidate Generation: extracts embeddings (evidence: `README.md`)
- Candidate Generation → S3 Artifacts: saves artifacts (evidence: `README.md`)
- Candidate Generation → SageMaker Registry: registers model (evidence: `README.md`)
- Candidate Generation → DynamoDB Candidates: stores candidates (evidence: `README.md`)
- XGBoost Training → Feature Store: joins features (evidence: `README.md`)
- XGBoost Training → SageMaker Endpoint: deploys model (evidence: `README.md`)
- Feature Processing → Feature Store: processes feature data (evidence: `README.md`)
- Inference API → Candidate Lookup: calls (evidence: `inference_api.py`)
- Candidate Lookup → DynamoDB Candidates: reads candidates (evidence: `inference_api.py`)
- Inference API → Feature Enrichment: calls (evidence: `inference_api.py`)
- Feature Enrichment → Feature Store: fetches records (evidence: `inference_api.py`)
- Inference API → XGBoost Ranking: calls (evidence: `inference_api.py`)
- XGBoost Ranking → SageMaker Endpoint: invokes (evidence: `inference_api.py`)
- Inference API → Top-K Results: sorts and limits (evidence: `inference_api.py`)
- Top-K Results → User: returns recommendations (evidence: `README.md`)
