# is213-ecoshop/ecoshop-main architecture

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

- Interactive diagram: https://gitdiagram.com/is213-ecoshop/ecoshop-main
- Repository: https://github.com/is213-ecoshop/ecoshop-main

## Overview

SustainaMart is a Flask microservices e-commerce platform with a GraphQL aggregation service and RabbitMQ-based asynchronous workflows. The user-facing GraphQL service exposes cart and recommendation queries; the README describes separate commerce, delivery, trade-in, and gamification capabilities. The graph preserves these documented domains, while linking shared helpers only where the excerpts or source index show references. Many service-to-service routes and event subscriptions are not shown, so those connections are omitted rather than inferred.

Main entry points: [`utils/supabase.py`](https://github.com/is213-ecoshop/ecoshop-main/blob/main/utils/supabase.py) (Supabase Client), [`utils/amqp_lib.py`](https://github.com/is213-ecoshop/ecoshop-main/blob/main/utils/amqp_lib.py) (AMQP Helpers), [`utils/cors_config.py`](https://github.com/is213-ecoshop/ecoshop-main/blob/main/utils/cors_config.py) (CORS Config), [`delivery/delivery.py`](https://github.com/is213-ecoshop/ecoshop-main/blob/main/delivery/delivery.py) (Delivery Service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_commerce["Commerce Services"]
  node_profile["Profile Service<br/>[profile.py]"]
  node_cart["Cart Service<br/>[cart.py]"]
  node_cart_product["Cart Products<br/>[cart_product.py]"]
  node_payment["Payment Service<br/>[payment.py]"]
  node_place_order["Order Placement<br/>[place_order.py]"]
  node_delivery["Delivery Service<br/>[delivery.py]"]
  node_recommendation["Recommendations<br/>[recommendation.py]"]
end

subgraph group_engagement["Rewards and Trade-in"]
  node_trade_in["Trade-in Service<br/>[app.py]"]
  node_verification["Trade Verification<br/>[app.py]"]
  node_mission["Mission Service<br/>[app.py]"]
  node_leaderboard["Leaderboard<br/>[app.py]"]
  node_reward_orchestrator["Reward Orchestrator<br/>[events.py]"]
  node_voucher["Voucher Service<br/>[app.py]"]
  node_wallet["Wallet Service<br/>[app.py]"]
end

subgraph group_integration["API and Messaging"]
  node_graphql["GraphQL API<br/>[server.py]"]
  node_resolvers["Query Resolvers<br/>[resolvers.py]"]
  node_graphql_types["GraphQL Types<br/>[graphql_types.py]"]
  node_email["Email Service<br/>[send_email.py]"]
  node_broker["RabbitMQ"]
end

subgraph group_shared["Shared Infrastructure"]
  node_supabase[("Supabase Client<br/>[supabase.py]")]
  node_amqp_lib["AMQP Helpers<br/>[amqp_lib.py]"]
  node_http_invokes["HTTP Invoker<br/>[invokes.py]"]
  node_cors["CORS Config<br/>[cors_config.py]"]
end

node_shopper(("Shopper"))

node_shopper -->|"queries"| node_graphql
node_graphql -->|"dispatches"| node_resolvers
node_graphql -->|"types queries"| node_graphql_types
node_cart -->|"uses client"| node_supabase
node_cart -->|"enables CORS"| node_cors
node_cart -->|"uses helpers"| node_amqp_lib
node_cart_product -->|"uses invoker"| node_http_invokes
node_cart_product -->|"enables CORS"| node_cors
node_delivery -->|"uses client"| node_supabase
node_delivery -->|"enables CORS"| node_cors
node_delivery -->|"calls HTTP"| node_http_invokes
node_delivery -->|"consumes and publishes"| node_amqp_lib
node_payment -->|"uses client"| node_supabase
node_payment -->|"enables CORS"| node_cors
node_payment -->|"uses helpers"| node_amqp_lib
node_place_order -->|"uses invoker"| node_http_invokes
node_place_order -->|"enables CORS"| node_cors
node_place_order -->|"uses helpers"| node_amqp_lib
node_recommendation -->|"uses client"| node_supabase
node_recommendation -->|"uses invoker"| node_http_invokes
node_recommendation -->|"enables CORS"| node_cors
node_recommendation -->|"uses helpers"| node_amqp_lib
node_mission -->|"uses client"| node_supabase
node_mission -->|"publishes events"| node_broker
node_trade_in -->|"uses storage"| node_supabase
node_verification -->|"uses client"| node_supabase
node_wallet -->|"consumes messages"| node_amqp_lib

click node_graphql "https://github.com/is213-ecoshop/ecoshop-main/blob/main/graphql/server.py"
click node_resolvers "https://github.com/is213-ecoshop/ecoshop-main/blob/main/graphql/resolvers.py"
click node_graphql_types "https://github.com/is213-ecoshop/ecoshop-main/blob/main/graphql/graphql_types.py"
click node_profile "https://github.com/is213-ecoshop/ecoshop-main/blob/main/profile/profile.py"
click node_cart "https://github.com/is213-ecoshop/ecoshop-main/blob/main/cart/cart.py"
click node_cart_product "https://github.com/is213-ecoshop/ecoshop-main/blob/main/cart_product/cart_product.py"
click node_payment "https://github.com/is213-ecoshop/ecoshop-main/blob/main/payment/payment.py"
click node_place_order "https://github.com/is213-ecoshop/ecoshop-main/blob/main/place_order/place_order.py"
click node_delivery "https://github.com/is213-ecoshop/ecoshop-main/blob/main/delivery/delivery.py"
click node_recommendation "https://github.com/is213-ecoshop/ecoshop-main/blob/main/recommendation/recommendation.py"
click node_trade_in "https://github.com/is213-ecoshop/ecoshop-main/blob/main/trade_in/app.py"
click node_verification "https://github.com/is213-ecoshop/ecoshop-main/blob/main/verification/app.py"
click node_mission "https://github.com/is213-ecoshop/ecoshop-main/blob/main/mission/app.py"
click node_leaderboard "https://github.com/is213-ecoshop/ecoshop-main/blob/main/leaderboard/app.py"
click node_reward_orchestrator "https://github.com/is213-ecoshop/ecoshop-main/blob/main/reward_orchestrator/events.py"
click node_voucher "https://github.com/is213-ecoshop/ecoshop-main/blob/main/voucher/app.py"
click node_wallet "https://github.com/is213-ecoshop/ecoshop-main/blob/main/wallet/app.py"
click node_email "https://github.com/is213-ecoshop/ecoshop-main/blob/main/send_email/send_email.py"
click node_supabase "https://github.com/is213-ecoshop/ecoshop-main/blob/main/utils/supabase.py"
click node_amqp_lib "https://github.com/is213-ecoshop/ecoshop-main/blob/main/utils/amqp_lib.py"
click node_http_invokes "https://github.com/is213-ecoshop/ecoshop-main/blob/main/utils/invokes.py"
click node_cors "https://github.com/is213-ecoshop/ecoshop-main/blob/main/utils/cors_config.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_profile,node_cart,node_cart_product,node_payment,node_place_order,node_delivery,node_recommendation toneBlue
class node_trade_in,node_verification,node_mission,node_leaderboard,node_reward_orchestrator,node_voucher,node_wallet toneAmber
class node_graphql,node_resolvers,node_graphql_types,node_email,node_broker toneMint
class node_supabase,node_amqp_lib,node_http_invokes,node_cors toneRose
class node_shopper toneIndigo
```

## Components

### Commerce Services

- [Profile Service](https://github.com/is213-ecoshop/ecoshop-main/blob/main/profile/profile.py): `profile/profile.py`
- [Cart Service](https://github.com/is213-ecoshop/ecoshop-main/blob/main/cart/cart.py): `cart/cart.py`
- [Cart Products](https://github.com/is213-ecoshop/ecoshop-main/blob/main/cart_product/cart_product.py): `cart_product/cart_product.py`
- [Payment Service](https://github.com/is213-ecoshop/ecoshop-main/blob/main/payment/payment.py): `payment/payment.py`
- [Order Placement](https://github.com/is213-ecoshop/ecoshop-main/blob/main/place_order/place_order.py): `place_order/place_order.py`
- [Delivery Service](https://github.com/is213-ecoshop/ecoshop-main/blob/main/delivery/delivery.py): `delivery/delivery.py`
- [Recommendations](https://github.com/is213-ecoshop/ecoshop-main/blob/main/recommendation/recommendation.py): `recommendation/recommendation.py`

### Rewards and Trade-in

- [Trade-in Service](https://github.com/is213-ecoshop/ecoshop-main/blob/main/trade_in/app.py): `trade_in/app.py`
- [Trade Verification](https://github.com/is213-ecoshop/ecoshop-main/blob/main/verification/app.py): `verification/app.py`
- [Mission Service](https://github.com/is213-ecoshop/ecoshop-main/blob/main/mission/app.py): `mission/app.py`
- [Leaderboard](https://github.com/is213-ecoshop/ecoshop-main/blob/main/leaderboard/app.py): `leaderboard/app.py`
- [Reward Orchestrator](https://github.com/is213-ecoshop/ecoshop-main/blob/main/reward_orchestrator/events.py): `reward_orchestrator/events.py`
- [Voucher Service](https://github.com/is213-ecoshop/ecoshop-main/blob/main/voucher/app.py): `voucher/app.py`
- [Wallet Service](https://github.com/is213-ecoshop/ecoshop-main/blob/main/wallet/app.py): `wallet/app.py`

### API and Messaging

- [GraphQL API](https://github.com/is213-ecoshop/ecoshop-main/blob/main/graphql/server.py): `graphql/server.py`
- [Query Resolvers](https://github.com/is213-ecoshop/ecoshop-main/blob/main/graphql/resolvers.py): `graphql/resolvers.py`
- [GraphQL Types](https://github.com/is213-ecoshop/ecoshop-main/blob/main/graphql/graphql_types.py): `graphql/graphql_types.py`
- [Email Service](https://github.com/is213-ecoshop/ecoshop-main/blob/main/send_email/send_email.py): `send_email/send_email.py`
- **RabbitMQ**

### Shared Infrastructure

- [Supabase Client](https://github.com/is213-ecoshop/ecoshop-main/blob/main/utils/supabase.py): `utils/supabase.py`
- [AMQP Helpers](https://github.com/is213-ecoshop/ecoshop-main/blob/main/utils/amqp_lib.py): `utils/amqp_lib.py`
- [HTTP Invoker](https://github.com/is213-ecoshop/ecoshop-main/blob/main/utils/invokes.py): `utils/invokes.py`
- [CORS Config](https://github.com/is213-ecoshop/ecoshop-main/blob/main/utils/cors_config.py): `utils/cors_config.py`

### Other components

- **Shopper**

## Connections

- Shopper → GraphQL API: queries (evidence: `graphql/server.py`)
- GraphQL API → Query Resolvers: dispatches (evidence: `graphql/server.py`)
- GraphQL API → GraphQL Types: types queries (evidence: `graphql/server.py`)
- Cart Service → Supabase Client: uses client (evidence: `cart/cart.py`)
- Cart Service → CORS Config: enables CORS (evidence: `cart/cart.py`)
- Cart Service → AMQP Helpers: uses helpers (evidence: `cart/cart.py`)
- Cart Products → HTTP Invoker: uses invoker (evidence: `cart_product/cart_product.py`)
- Cart Products → CORS Config: enables CORS (evidence: `cart_product/cart_product.py`)
- Delivery Service → Supabase Client: uses client (evidence: `delivery/delivery.py`)
- Delivery Service → CORS Config: enables CORS (evidence: `delivery/delivery.py`)
- Delivery Service → HTTP Invoker: calls HTTP (evidence: `delivery/delivery.py`)
- Delivery Service → AMQP Helpers: consumes and publishes (evidence: `delivery/delivery.py`)
- Payment Service → Supabase Client: uses client (evidence: `payment/payment.py`)
- Payment Service → CORS Config: enables CORS (evidence: `payment/payment.py`)
- Payment Service → AMQP Helpers: uses helpers (evidence: `payment/payment.py`)
- Order Placement → HTTP Invoker: uses invoker (evidence: `place_order/place_order.py`)
- Order Placement → CORS Config: enables CORS (evidence: `place_order/place_order.py`)
- Order Placement → AMQP Helpers: uses helpers (evidence: `place_order/place_order.py`)
- Recommendations → Supabase Client: uses client (evidence: `recommendation/recommendation.py`)
- Recommendations → HTTP Invoker: uses invoker (evidence: `recommendation/recommendation.py`)
- Recommendations → CORS Config: enables CORS (evidence: `recommendation/recommendation.py`)
- Recommendations → AMQP Helpers: uses helpers (evidence: `recommendation/recommendation.py`)
- Mission Service → Supabase Client: uses client (evidence: `mission/app.py`)
- Mission Service → RabbitMQ: publishes events
- Trade-in Service → Supabase Client: uses storage
- Trade Verification → Supabase Client: uses client (evidence: `verification/app.py`)
- Wallet Service → AMQP Helpers: consumes messages (evidence: `wallet/app.py`)
