# aprkal12/codiit-refactor architecture

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

- Interactive diagram: https://gitdiagram.com/aprkal12/codiit-refactor
- Repository: https://github.com/aprkal12/codiit-refactor

## Overview

Codiit is an Express e-commerce backend supporting buyer and seller accounts, stores and products, carts, orders and payments, inquiries, reviews, real-time notifications, and seller analytics. The principal workflow is an HTTP request routed through middleware to a domain controller and service, which applies business rules and persists data through repositories. Authentication, uploads, and order expiry are additional runtime branches. The README documents the layered request flow and capabilities; sampled source confirms app routing, authentication, review handling, SSE, and the expiry worker. Other domain internals are represented from documented capabilities and the source tree, not inspected in full.

Main entry points: [`src/app.ts`](https://github.com/aprkal12/codiit-refactor/blob/main/src/app.ts) (Express API), [`src/domains/order/order.service.ts`](https://github.com/aprkal12/codiit-refactor/blob/main/src/domains/order/order.service.ts) (Order Processing), [`src/domains/notification/notification.service.ts`](https://github.com/aprkal12/codiit-refactor/blob/main/src/domains/notification/notification.service.ts) (Notifications), [`src/domains/order/order.repository.ts`](https://github.com/aprkal12/codiit-refactor/blob/main/src/domains/order/order.repository.ts) (Data Repositories)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_platform["HTTP Platform"]
  node_app["Express API<br/>[app.ts]"]
  node_middleware["Request Middleware"]
  node_metadata["Metadata API"]
end

subgraph group_commerce["Commerce"]
  node_stores["Store Management<br/>[store.service.ts]"]
  node_products["Product Catalog<br/>[product.service.ts]"]
  node_cart["Shopping Cart<br/>[cart.service.ts]"]
  node_orders["Order Processing<br/>[order.service.ts]"]
  node_payments["Payments<br/>[payment.service.ts]"]
  node_uploads["Image Uploads<br/>[s3.service.ts]"]
end

subgraph group_engagement["Customer Engagement"]
  node_inquiries["Product Inquiries<br/>[inquiry.service.ts]"]
  node_reviews["Product Reviews<br/>[review.service.ts]"]
  node_notifications["Notifications"]
  node_sse["SSE Connections<br/>[sse.manager.ts]"]
  node_dashboard["Seller Dashboard"]
end

subgraph group_identity["Identity &amp; Accounts"]
  node_auth["Authentication<br/>[auth.service.ts]"]
  node_users["User Management<br/>[user.service.ts]"]
end

subgraph group_runtime["Runtime Services"]
  node_repositories["Data Repositories"]
  node_postgres[("PostgreSQL")]
  node_expiry["Order Expiry Worker"]
  node_redis["Redis Queue<br/>[redis.ts]"]
end

node_client(("HTTP Client"))
node_s3service["AWS S3"]
node_portone["Portone"]

node_client -->|"sends requests"| node_app
node_app -->|"applies middleware"| node_middleware
node_app -->|"routes requests"| node_auth
node_app -->|"routes requests"| node_users
node_app -->|"routes requests"| node_stores
node_app -->|"routes requests"| node_products
node_app -->|"routes requests"| node_cart
node_app -->|"routes requests"| node_orders
node_app -->|"routes requests"| node_payments
node_app -->|"routes requests"| node_inquiries
node_app -->|"routes requests"| node_reviews
node_app -->|"routes requests"| node_notifications
node_app -->|"routes requests"| node_dashboard
node_app -->|"routes requests"| node_metadata
node_app -->|"routes requests"| node_uploads
node_auth -->|"looks up users"| node_users
node_reviews -->|"reads and writes"| node_repositories
node_orders -->|"uses notification service"| node_notifications
node_notifications -->|"uses SSE manager"| node_sse
node_orders -->|"accesses data"| node_repositories
node_repositories -->|"queries"| node_postgres
node_expiry -->|"expires orders"| node_orders
node_expiry -->|"monitors queue"| node_redis
node_uploads -.->|"stores images"| node_s3service
node_payments -.->|"integrates payments"| node_portone

click node_app "https://github.com/aprkal12/codiit-refactor/blob/main/src/app.ts"
click node_middleware "https://github.com/aprkal12/codiit-refactor/tree/main/src/common/middlewares"
click node_auth "https://github.com/aprkal12/codiit-refactor/blob/main/src/domains/auth/auth.service.ts"
click node_users "https://github.com/aprkal12/codiit-refactor/blob/main/src/domains/user/user.service.ts"
click node_stores "https://github.com/aprkal12/codiit-refactor/blob/main/src/domains/store/store.service.ts"
click node_products "https://github.com/aprkal12/codiit-refactor/blob/main/src/domains/product/product.service.ts"
click node_cart "https://github.com/aprkal12/codiit-refactor/blob/main/src/domains/cart/cart.service.ts"
click node_orders "https://github.com/aprkal12/codiit-refactor/blob/main/src/domains/order/order.service.ts"
click node_payments "https://github.com/aprkal12/codiit-refactor/blob/main/src/domains/payment/payment.service.ts"
click node_inquiries "https://github.com/aprkal12/codiit-refactor/blob/main/src/domains/inquiry/inquiry.service.ts"
click node_reviews "https://github.com/aprkal12/codiit-refactor/blob/main/src/domains/review/review.service.ts"
click node_notifications "https://github.com/aprkal12/codiit-refactor/blob/main/src/domains/notification/notification.service.ts"
click node_sse "https://github.com/aprkal12/codiit-refactor/blob/main/src/common/utils/sse.manager.ts"
click node_dashboard "https://github.com/aprkal12/codiit-refactor/blob/main/src/domains/dashboard/dashboard.service.ts"
click node_metadata "https://github.com/aprkal12/codiit-refactor/blob/main/src/domains/metadata/metadata.controller.ts"
click node_uploads "https://github.com/aprkal12/codiit-refactor/blob/main/src/domains/s3/s3.service.ts"
click node_repositories "https://github.com/aprkal12/codiit-refactor/blob/main/src/domains/order/order.repository.ts"
click node_expiry "https://github.com/aprkal12/codiit-refactor/blob/main/src/workers/orderExpiryWorker.ts"
click node_redis "https://github.com/aprkal12/codiit-refactor/blob/main/src/config/redis.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_app,node_middleware,node_metadata,node_client toneBlue
class node_stores,node_products,node_cart,node_orders,node_payments,node_uploads toneAmber
class node_inquiries,node_reviews,node_notifications,node_sse,node_dashboard toneMint
class node_auth,node_users toneRose
class node_repositories,node_postgres,node_expiry,node_redis,node_s3service,node_portone toneIndigo
```

## Components

### HTTP Platform

- [Express API](https://github.com/aprkal12/codiit-refactor/blob/main/src/app.ts): `src/app.ts`
- [Request Middleware](https://github.com/aprkal12/codiit-refactor/tree/main/src/common/middlewares): `src/common/middlewares`
- [Metadata API](https://github.com/aprkal12/codiit-refactor/blob/main/src/domains/metadata/metadata.controller.ts): `src/domains/metadata/metadata.controller.ts`

### Commerce

- [Store Management](https://github.com/aprkal12/codiit-refactor/blob/main/src/domains/store/store.service.ts): `src/domains/store/store.service.ts`
- [Product Catalog](https://github.com/aprkal12/codiit-refactor/blob/main/src/domains/product/product.service.ts): `src/domains/product/product.service.ts`
- [Shopping Cart](https://github.com/aprkal12/codiit-refactor/blob/main/src/domains/cart/cart.service.ts): `src/domains/cart/cart.service.ts`
- [Order Processing](https://github.com/aprkal12/codiit-refactor/blob/main/src/domains/order/order.service.ts): `src/domains/order/order.service.ts`
- [Payments](https://github.com/aprkal12/codiit-refactor/blob/main/src/domains/payment/payment.service.ts): `src/domains/payment/payment.service.ts`
- [Image Uploads](https://github.com/aprkal12/codiit-refactor/blob/main/src/domains/s3/s3.service.ts): `src/domains/s3/s3.service.ts`

### Customer Engagement

- [Product Inquiries](https://github.com/aprkal12/codiit-refactor/blob/main/src/domains/inquiry/inquiry.service.ts): `src/domains/inquiry/inquiry.service.ts`
- [Product Reviews](https://github.com/aprkal12/codiit-refactor/blob/main/src/domains/review/review.service.ts): `src/domains/review/review.service.ts`
- [Notifications](https://github.com/aprkal12/codiit-refactor/blob/main/src/domains/notification/notification.service.ts): `src/domains/notification/notification.service.ts`
- [SSE Connections](https://github.com/aprkal12/codiit-refactor/blob/main/src/common/utils/sse.manager.ts): `src/common/utils/sse.manager.ts`
- [Seller Dashboard](https://github.com/aprkal12/codiit-refactor/blob/main/src/domains/dashboard/dashboard.service.ts): `src/domains/dashboard/dashboard.service.ts`

### Identity & Accounts

- [Authentication](https://github.com/aprkal12/codiit-refactor/blob/main/src/domains/auth/auth.service.ts): `src/domains/auth/auth.service.ts`
- [User Management](https://github.com/aprkal12/codiit-refactor/blob/main/src/domains/user/user.service.ts): `src/domains/user/user.service.ts`

### Runtime Services

- [Data Repositories](https://github.com/aprkal12/codiit-refactor/blob/main/src/domains/order/order.repository.ts): `src/domains/order/order.repository.ts`
- **PostgreSQL**
- [Order Expiry Worker](https://github.com/aprkal12/codiit-refactor/blob/main/src/workers/orderExpiryWorker.ts): `src/workers/orderExpiryWorker.ts`
- [Redis Queue](https://github.com/aprkal12/codiit-refactor/blob/main/src/config/redis.ts): `src/config/redis.ts`

### Other components

- **HTTP Client**
- **AWS S3**
- **Portone**

## Connections

- HTTP Client → Express API: sends requests
- Express API → Request Middleware: applies middleware (evidence: `src/app.ts`)
- Express API → Authentication: routes requests (evidence: `src/app.ts`)
- Express API → User Management: routes requests (evidence: `src/app.ts`)
- Express API → Store Management: routes requests (evidence: `src/app.ts`)
- Express API → Product Catalog: routes requests (evidence: `src/app.ts`)
- Express API → Shopping Cart: routes requests (evidence: `src/app.ts`)
- Express API → Order Processing: routes requests (evidence: `src/app.ts`)
- Express API → Payments: routes requests (evidence: `src/app.ts`)
- Express API → Product Inquiries: routes requests (evidence: `src/app.ts`)
- Express API → Product Reviews: routes requests (evidence: `src/app.ts`)
- Express API → Notifications: routes requests (evidence: `src/app.ts`)
- Express API → Seller Dashboard: routes requests (evidence: `src/app.ts`)
- Express API → Metadata API: routes requests (evidence: `src/app.ts`)
- Express API → Image Uploads: routes requests (evidence: `src/app.ts`)
- Authentication → User Management: looks up users (evidence: `src/domains/auth/auth.service.ts`)
- Product Reviews → Data Repositories: reads and writes (evidence: `src/domains/review/review.service.ts`)
- Order Processing → Notifications: uses notification service (evidence: `src/domains/order/order.service.ts`)
- Notifications → SSE Connections: uses SSE manager (evidence: `src/domains/notification/notification.controller.ts`)
- Order Processing → Data Repositories: accesses data (evidence: `src/domains/order/order.service.ts`)
- Data Repositories → PostgreSQL: queries
- Order Expiry Worker → Order Processing: expires orders (evidence: `src/workers/orderExpiryWorker.ts`)
- Order Expiry Worker → Redis Queue: monitors queue (evidence: `src/workers/orderExpiryWorker.ts`)
- Image Uploads → AWS S3: stores images
- Payments → Portone: integrates payments
