# sumeshpatva97/ecommerce-api-ci architecture

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

- Interactive diagram: https://gitdiagram.com/sumeshpatva97/ecommerce-api-ci
- Repository: https://github.com/sumeshpatva97/ecommerce-api-ci

## Overview

ecommerce-api is a Node.js/Express REST API scaffold for the jewellery platform. The current workflow is process startup and configuration, HTTP request handling through an ordered middleware pipeline, health/API routing, and standardized error responses; no commerce business routes are implemented yet. The platform layer includes readiness, Prisma database wiring, logging, and graceful shutdown. Email, payment, and WhatsApp provider modules are documented as adapter scaffolds, not verified live integrations. Relationships reflect the sampled source and README; database connectivity and provider behavior remain unverified.

Main entry points: [`src/app.ts`](https://github.com/sumeshpatva97/ecommerce-api-ci/blob/main/src/app.ts) (Express App), [`src/server.ts`](https://github.com/sumeshpatva97/ecommerce-api-ci/blob/main/src/server.ts) (Server Entrypoint), [`src/core/middleware/errorHandler.ts`](https://github.com/sumeshpatva97/ecommerce-api-ci/blob/main/src/core/middleware/errorHandler.ts) (Error Handler), [`src/core/logger/logger.ts`](https://github.com/sumeshpatva97/ecommerce-api-ci/blob/main/src/core/logger/logger.ts) (Structured Logger)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["HTTP API"]
  node_api_app["Express App<br/>[app.ts]"]
  node_v1_router["V1 Router<br/>[v1.ts]"]
  node_pipeline["HTTP Middleware"]
  node_health_routes["Health Routes<br/>[health.routes.ts]"]
  node_error_handler["Error Handler<br/>[errorHandler.ts]"]
  node_envelope["Response Envelopes<br/>[envelope.ts]"]
  node_errors["Application Errors<br/>[AppError.ts]"]
end

subgraph group_platform["Runtime Platform"]
  node_server["Server Entrypoint<br/>[server.ts]"]
  node_config["Environment Config<br/>[env.ts]"]
  node_readiness["Readiness Registry<br/>[readiness.ts]"]
  node_database["Prisma Client<br/>[prisma.ts]"]
  node_lifecycle["HTTP Lifecycle<br/>[httpServer.ts]"]
  node_logger["Structured Logger<br/>[logger.ts]"]
  node_context["Request Context<br/>[context.ts]"]
  node_ulid["ULID Generator<br/>[ulid.ts]"]
end

subgraph group_integrations["Provider Adapters"]
  node_email_adapter["Email Adapter<br/>[emailProvider.ts]"]
  node_payments_adapter["Payment Adapter<br/>[paymentProvider.ts]"]
  node_whatsapp_adapter["WhatsApp Adapter"]
end

node_storefront(("Storefront"))
node_admin(("Admin Panel"))
node_mysql[("MySQL")]

node_storefront -->|"calls REST"| node_api_app
node_admin -->|"calls REST"| node_api_app
node_server -->|"loads settings"| node_config
node_server -->|"creates logger"| node_logger
node_server -->|"registers checks"| node_readiness
node_server -->|"connects and pings"| node_database
node_server -->|"builds app"| node_api_app
node_server -->|"starts and closes"| node_lifecycle
node_api_app -->|"installs middleware"| node_pipeline
node_api_app -->|"mounts health"| node_health_routes
node_api_app -->|"mounts API"| node_v1_router
node_api_app -->|"installs last"| node_error_handler
node_health_routes -->|"evaluates"| node_readiness
node_error_handler -->|"builds errors"| node_envelope
node_error_handler -->|"logs failures"| node_logger
node_error_handler -->|"maps failures"| node_errors
node_logger -->|"reads context"| node_context
node_pipeline -->|"generates request IDs"| node_ulid
node_pipeline -->|"sets request context"| node_context
node_lifecycle -->|"marks shutdown"| node_readiness
node_lifecycle -->|"logs lifecycle"| node_logger
node_database -.->|"connects optionally"| node_mysql

click node_api_app "https://github.com/sumeshpatva97/ecommerce-api-ci/blob/main/src/app.ts"
click node_v1_router "https://github.com/sumeshpatva97/ecommerce-api-ci/blob/main/src/routes/v1.ts"
click node_pipeline "https://github.com/sumeshpatva97/ecommerce-api-ci/tree/main/src/core/middleware"
click node_health_routes "https://github.com/sumeshpatva97/ecommerce-api-ci/blob/main/src/core/health/health.routes.ts"
click node_error_handler "https://github.com/sumeshpatva97/ecommerce-api-ci/blob/main/src/core/middleware/errorHandler.ts"
click node_envelope "https://github.com/sumeshpatva97/ecommerce-api-ci/blob/main/src/core/http/envelope.ts"
click node_errors "https://github.com/sumeshpatva97/ecommerce-api-ci/blob/main/src/core/errors/AppError.ts"
click node_server "https://github.com/sumeshpatva97/ecommerce-api-ci/blob/main/src/server.ts"
click node_config "https://github.com/sumeshpatva97/ecommerce-api-ci/blob/main/src/core/config/env.ts"
click node_readiness "https://github.com/sumeshpatva97/ecommerce-api-ci/blob/main/src/core/health/readiness.ts"
click node_database "https://github.com/sumeshpatva97/ecommerce-api-ci/blob/main/src/core/db/prisma.ts"
click node_lifecycle "https://github.com/sumeshpatva97/ecommerce-api-ci/blob/main/src/core/lifecycle/httpServer.ts"
click node_logger "https://github.com/sumeshpatva97/ecommerce-api-ci/blob/main/src/core/logger/logger.ts"
click node_context "https://github.com/sumeshpatva97/ecommerce-api-ci/blob/main/src/core/logger/context.ts"
click node_ulid "https://github.com/sumeshpatva97/ecommerce-api-ci/blob/main/src/lib/ulid.ts"
click node_email_adapter "https://github.com/sumeshpatva97/ecommerce-api-ci/blob/main/src/integrations/email/emailProvider.ts"
click node_payments_adapter "https://github.com/sumeshpatva97/ecommerce-api-ci/blob/main/src/integrations/payments/paymentProvider.ts"
click node_whatsapp_adapter "https://github.com/sumeshpatva97/ecommerce-api-ci/blob/main/src/integrations/whatsapp/whatsappProvider.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_api_app,node_v1_router,node_pipeline,node_health_routes,node_error_handler,node_envelope,node_errors toneBlue
class node_server,node_config,node_readiness,node_database,node_lifecycle,node_logger,node_context,node_ulid,node_mysql toneAmber
class node_email_adapter,node_payments_adapter,node_whatsapp_adapter toneMint
class node_storefront,node_admin toneIndigo
```

## Components

### HTTP API

- [Express App](https://github.com/sumeshpatva97/ecommerce-api-ci/blob/main/src/app.ts): `src/app.ts`
- [V1 Router](https://github.com/sumeshpatva97/ecommerce-api-ci/blob/main/src/routes/v1.ts): `src/routes/v1.ts`
- [HTTP Middleware](https://github.com/sumeshpatva97/ecommerce-api-ci/tree/main/src/core/middleware): `src/core/middleware`
- [Health Routes](https://github.com/sumeshpatva97/ecommerce-api-ci/blob/main/src/core/health/health.routes.ts): `src/core/health/health.routes.ts`
- [Error Handler](https://github.com/sumeshpatva97/ecommerce-api-ci/blob/main/src/core/middleware/errorHandler.ts): `src/core/middleware/errorHandler.ts`
- [Response Envelopes](https://github.com/sumeshpatva97/ecommerce-api-ci/blob/main/src/core/http/envelope.ts): `src/core/http/envelope.ts`
- [Application Errors](https://github.com/sumeshpatva97/ecommerce-api-ci/blob/main/src/core/errors/AppError.ts): `src/core/errors/AppError.ts`

### Runtime Platform

- [Server Entrypoint](https://github.com/sumeshpatva97/ecommerce-api-ci/blob/main/src/server.ts): `src/server.ts`
- [Environment Config](https://github.com/sumeshpatva97/ecommerce-api-ci/blob/main/src/core/config/env.ts): `src/core/config/env.ts`
- [Readiness Registry](https://github.com/sumeshpatva97/ecommerce-api-ci/blob/main/src/core/health/readiness.ts): `src/core/health/readiness.ts`
- [Prisma Client](https://github.com/sumeshpatva97/ecommerce-api-ci/blob/main/src/core/db/prisma.ts): `src/core/db/prisma.ts`
- [HTTP Lifecycle](https://github.com/sumeshpatva97/ecommerce-api-ci/blob/main/src/core/lifecycle/httpServer.ts): `src/core/lifecycle/httpServer.ts`
- [Structured Logger](https://github.com/sumeshpatva97/ecommerce-api-ci/blob/main/src/core/logger/logger.ts): `src/core/logger/logger.ts`
- [Request Context](https://github.com/sumeshpatva97/ecommerce-api-ci/blob/main/src/core/logger/context.ts): `src/core/logger/context.ts`
- [ULID Generator](https://github.com/sumeshpatva97/ecommerce-api-ci/blob/main/src/lib/ulid.ts): `src/lib/ulid.ts`

### Provider Adapters

- [Email Adapter](https://github.com/sumeshpatva97/ecommerce-api-ci/blob/main/src/integrations/email/emailProvider.ts): `src/integrations/email/emailProvider.ts`
- [Payment Adapter](https://github.com/sumeshpatva97/ecommerce-api-ci/blob/main/src/integrations/payments/paymentProvider.ts): `src/integrations/payments/paymentProvider.ts`
- [WhatsApp Adapter](https://github.com/sumeshpatva97/ecommerce-api-ci/blob/main/src/integrations/whatsapp/whatsappProvider.ts): `src/integrations/whatsapp/whatsappProvider.ts`

### Other components

- **Storefront**
- **Admin Panel**
- **MySQL**

## Connections

- Storefront → Express App: calls REST (evidence: `README.md`)
- Admin Panel → Express App: calls REST (evidence: `README.md`)
- Server Entrypoint → Environment Config: loads settings (evidence: `src/server.ts`)
- Server Entrypoint → Structured Logger: creates logger (evidence: `src/server.ts`)
- Server Entrypoint → Readiness Registry: registers checks (evidence: `src/server.ts`)
- Server Entrypoint → Prisma Client: connects and pings (evidence: `src/server.ts`)
- Server Entrypoint → Express App: builds app (evidence: `src/server.ts`)
- Server Entrypoint → HTTP Lifecycle: starts and closes (evidence: `src/server.ts`)
- Express App → HTTP Middleware: installs middleware (evidence: `src/app.ts`)
- Express App → Health Routes: mounts health (evidence: `src/app.ts`)
- Express App → V1 Router: mounts API (evidence: `src/app.ts`)
- Express App → Error Handler: installs last (evidence: `src/app.ts`)
- Health Routes → Readiness Registry: evaluates (evidence: `src/core/health/health.routes.ts`)
- Error Handler → Response Envelopes: builds errors (evidence: `src/core/middleware/errorHandler.ts`)
- Error Handler → Structured Logger: logs failures (evidence: `src/core/middleware/errorHandler.ts`)
- Error Handler → Application Errors: maps failures (evidence: `src/core/middleware/errorHandler.ts`)
- Structured Logger → Request Context: reads context (evidence: `src/core/logger/logger.ts`)
- HTTP Middleware → ULID Generator: generates request IDs (evidence: `src/core/middleware/requestId.ts`)
- HTTP Middleware → Request Context: sets request context (evidence: `src/core/middleware/requestId.ts`)
- HTTP Lifecycle → Readiness Registry: marks shutdown (evidence: `src/core/lifecycle/httpServer.ts`)
- HTTP Lifecycle → Structured Logger: logs lifecycle (evidence: `src/core/lifecycle/httpServer.ts`)
- Prisma Client → MySQL: connects optionally (evidence: `README.md`)
