raouf-b-dev/ecommerce-store-api
57.3
Adequate · 9 November 2026
50.6k
lines of production code
TypeScript
primary language
7
measurements over time
What this system is
Features
Add Grafana monitoring dashboards and configuration
This change introduces pre-configured Grafana dashboards for the E-Commerce API, including views for API performance (request rate, error rate, latency percentiles), business metrics (orders, payments, logins), and checkout saga health. It also adds Grafana provisioning files to connect to Prometheus, Loki, and Tempo, along with configuration files for these monitoring components (Loki, Prometheus, Promtail, Tempo) to enable comprehensive observability.
docker · high confidence
Add ORM entities for credentials and session tokens
The authentication module now includes TypeORM entity definitions for storing user credentials and session data. A new \CredentialEntity\ maps to the \credentials\ table, tracking user IDs, password hashes, and a flag to enforce password changes. A \SessionTokenEntity\ maps to the \session\_tokens\ table, storing UUID-based session identifiers, hashed tokens, expiration times, and revocation status. These entities provide the database schema foundation for the new credential management and session handling capabilities.
src/modules/authentication/secondary-adapters/orm · high confidence
Add OpenTelemetry tracing infrastructure
The application now includes OpenTelemetry tracing support, bootstrapped via the --require flag before the NestJS application starts. This configuration initializes the NodeSDK with an OTLP gRPC exporter, automatically instruments HTTP and other node modules (excluding noisy file-system instrumentation), and tags traces with the service name, version, and deployment environment. Health and metrics endpoints are explicitly ignored to reduce noise, and the SDK performs a graceful shutdown to flush pending spans on process termination. Also in this area: 1 commit (0 fixes) modifying (repo-wide).
src/infrastructure/tracing · low confidence · unverified
Add PostgreSQL analytics query adapter with UTC time-bucketing and revenue filters
This change introduces the PostgreSQL implementation for the analytics query service, enabling users to retrieve revenue KPIs, payment time series, top products, and inventory alerts. The adapter defines specific SQL filters for revenue calculation (counting CAPTURED, COMPLETED, PARTIALLY\_REFUNDED, and REFUNDED payments) and top-product attribution (including confirmed, processing, shipped, and delivered orders). It also adds UTC-based time-bucketing utilities to truncate dates to day or week starts (aligning with PostgreSQL's date\_trunc behavior) and zero-fill missing buckets in time-series results, ensuring consistent chart data. A 5-second statement timeout is applied to analytics queries to prevent long-running scans.
src/modules/analytics/secondary-adapters/query · high confidence
Add Postgres-based cart query adapter with integration tests
This change introduces the PostgresCartQueryAdapter, a new secondary adapter that implements the CartQueryService interface to retrieve cart data from a PostgreSQL database. It provides methods to fetch a cart by its ID or by user ID, returning a CartPresentationDTO that includes item details such as product name, price, currency, and image URL. The implementation uses TypeORM to query the cart and item entities, mapping the raw database rows into the presentation format. Alongside the adapter, integration tests have been added to verify the correct retrieval of single and multi-line carts, as well as handling of non-existent users, ensuring the data access layer functions correctly against a real database.
src/modules/carts/secondary-adapters/query · high confidence
Add category management and demo catalog seeding
Introduces a new CategoriesController with endpoints to create, read, update, delete, activate, and deactivate catalog categories, along with the underlying domain entities, application use cases, and query services. Adds SeedDemoCategoriesUseCase and SeedDemoCatalogUseCase to populate the system with default categories and a set of sample products, including logic to backfill missing category associations for existing demo SKUs. Includes comprehensive unit tests for the new controllers, domain logic, and seeding workflows.
src/modules/products · high confidence
Add checkout payment creation use case
Users can now initiate the creation of a checkout payment through a new use case that delegates to the payment gateway. This addition supports the broader checkout workflow by allowing the system to generate payment intents (including client secrets) for orders, with error handling that preserves gateway failures such as conflicts for pending payments.
src/modules/orders/core/application/usecases/create-checkout-payment · high confidence
Add in-process domain event publishing via EventEmitter2
A new EventEmitter2DomainEventPublisher has been added to the infrastructure layer to handle in-process domain event delivery. This adapter implements the DomainEventPublisher interface, wrapping @nestjs/event-emitter to provide fire-and-forget semantics that prevent listener errors from crashing the calling use case, while logging failures for observability. This change establishes the concrete implementation for domain event publishing, allowing the system to dispatch events without coupling use cases to the underlying transport mechanism.
src/infrastructure/events · high confidence
Add raw user list query row interface
A new TypeScript interface, RawUserListQueryRow, has been added to define the shape of data returned by user list queries. This interface specifies fields for user identification (id, firstName, lastName, email), contact details (phone), status (isActive), role assignment (roleCode), timestamps (createdAt, updatedAt), and related data counts (addressCount).
src/modules/identity/secondary-adapters/dto · high confidence
Add role assignment and lookup use cases
The authorization module now includes application-layer use cases for managing user roles. Users can have a default role assigned automatically, or a specific role assigned by code, with existing assignments updated if necessary. Additionally, the system can look up a user's current role and its associated permissions by user ID, returning a structured record containing the role ID, code, and permission list.
src/modules/authorization/core/application/usecases/user-role · high confidence
Add user lookup by email with role-based access control
A new \GetUserByEmailUseCase\ has been introduced in the identity module, allowing users to retrieve a profile by email address. The implementation enforces strict access policies: system and admin contexts can view any user, while regular users are restricted to viewing only their own profiles; attempts to access another user's data result in a 403 Forbidden error. The use case also correctly handles scenarios where the user is not found (404) or when a database error occurs. Also in this area: 4 commits (2 fixes) modifying src/modules/identity, src/modules/identity/core/application/usecases/user.
src/modules/identity/core/application/usecases/user/get-user-by-email · medium confidence · unverified
Add user query mapping for list and detail views
The identity module now includes a new UserQueryMapper that converts raw database query results into structured DTOs for user lists and details. This mapper handles the transformation of user fields (such as ID, name, email, role code, and status) into ISO date strings and ensures that associated address entities are correctly attached to the user detail view, supporting both list and detailed user information retrieval.
src/modules/identity/secondary-adapters/mappers · high confidence
Added AssignUserRole use case for role assignment
A new AssignUserRole use case has been introduced in the identity module, allowing administrators to assign a specific role to an existing user. The implementation validates that the user exists before attempting the assignment and handles errors gracefully, returning a 404 status if the user is not found or propagating failures from the authorization gateway if the role assignment fails. This change is accompanied by unit tests covering successful assignments, missing user scenarios, and gateway error propagation. Also in this area: 4 commits (2 fixes) modifying src/modules/identity, src/modules/identity/core/application/usecases/user.
src/modules/identity/core/application/usecases/user/assign-user-role · medium confidence · unverified
Added DeleteProductUseCase and its unit tests
A new DeleteProductUseCase has been introduced in the products module to handle product deletion. The implementation delegates to the ProductRepository's deleteById method and wraps the result, returning a success state on completion or a UseCaseError if the deletion fails. A corresponding unit test suite verifies both the successful deletion path and the failure scenario where the product is not found or cannot be deleted.
src/modules/products/core/application/usecases/delete-product · high confidence
Added PostgreSQL implementation for user-role assignment persistence
The authorization module now includes a concrete Postgres-based repository for managing user-role assignments, implementing the core domain interface with save, findByUserId, and deleteByUserId operations. This adapter handles data mapping between the domain entities and the TypeORM schema, wrapping database interactions in a Result type to manage success and failure states consistently. An accompanying integration test suite verifies that assignments are correctly persisted, that duplicate assignments for the same user are rejected, and that deletions effectively remove the association. Also in this area: 2 commits (1 fix) modifying (repo-wide).
src/modules/authorization/secondary-adapter/repositories/postgres-user-role-assignment-repository · medium confidence · unverified
Added Postgres credential repository and integration tests
This change introduces the \PostgresCredentialRepository\ implementation for the authentication module, providing persistence for user credentials via TypeORM. The repository implements the \CredentialRepository\ interface with methods to save, find by user ID, update, and delete credentials, wrapping database operations in a Result type to handle errors. Additionally, integration tests were added to verify that saving a credential persists it correctly, that round-tripping data works as expected, and that attempting to save a duplicate credential for the same user ID is rejected.
src/modules/authentication/secondary-adapters/repositories/postgres-credential.repository · high confidence
Added Redis Search index initialization and query escaping utilities
The application now automatically initializes RediSearch indexes for Orders, Products, Inventory, Cart, Payments, and Users on startup via the new RedisIndexInitializerService, which handles readiness checks and logs creation status or errors. Additionally, new search-utils functions (textEquals, tagEquals) provide safe escaping for Redis Search queries, preventing syntax errors when values contain special characters like quotes, backslashes, or punctuation.
src/infrastructure/redis/search · high confidence
Added ReleaseStock use case for inventory reservations
A new ReleaseStock use case has been introduced to handle the release of inventory stock associated with reservations. This feature allows users to release stock for both pending and confirmed reservations, ensuring that the reservation status is correctly updated to 'RELEASED' upon successful execution. The implementation includes robust error handling for scenarios such as reservation not found or repository failures, and it idempotently handles cases where a reservation is already released. Comprehensive unit tests have been added to verify the correct behavior across these various states.
src/modules/inventory/core/application/usecases/release-stock · high confidence
Added Swagger configuration and nullable response schema support
The API documentation now includes a dedicated configuration for the Swagger document, setting the title to 'E-Commerce API', adding Bearer authentication support, and dynamically setting the version via the application's version utility. Additionally, a new utility function \nullableResponseSchema\ has been introduced to properly handle OpenAPI 3.0 nullable response schemas, allowing developers to explicitly mark DTO responses as nullable when paired with \@ApiExtraModels\.
src/infrastructure/swagger · high confidence
Added ValidateCheckout use case with caller context and address resolution
The ValidateCheckout use case has been introduced to orchestrate checkout validation by verifying the caller's permissions, ensuring the cart is valid and non-empty, confirming the user exists, and resolving the shipping address. It now accepts a caller context to distinguish between customer and system requests, allowing system callers to bypass specific permission checks during saga execution, while customer requests require the 'manage\_own\_cart' permission. The use case integrates with the ShippingAddressResolver to handle address resolution from provided DTOs or user defaults, returning a validated context containing user, cart, and shipping address details.
src/modules/orders/core/application/usecases/validate-checkout · high confidence
Added analytics period parsing and previous period calculation
The analytics module now includes a dedicated parser service that converts ISO date strings into Date objects and calculates an equal-length previous period window for comparative KPIs. This allows the overview and series views to easily compute historical comparisons by deriving a prior date range that matches the duration of the current selected period.
src/modules/analytics/core/application/services · high confidence
Added analytics query and result interfaces
New TypeScript interfaces have been introduced in the analytics application layer to define the input and output structures for several analytics capabilities. These include queries for an overview (with previous window comparison), payment time series, inventory alerts, and top products, along with their corresponding result types detailing KPI snapshots, bucketed payment data, low-stock items, and product sales metrics.
src/modules/analytics/core/application/queries · high confidence
Added analytics query service interface
The application layer now defines an abstract \AnalyticsQueryService\ interface that specifies four query operations: retrieving an analytics overview, fetching payments time-series data, listing top products, and checking inventory alerts. This interface establishes the contract for analytics data retrieval, utilizing result types and query objects defined in the domain layer.
src/modules/analytics/core/application/ports · high confidence
Added analytics use cases for inventory alerts, overview, payments, and top products
New application-layer use cases have been introduced in the analytics module to retrieve key business metrics. These include GetInventoryAlerts for low-stock warnings, GetAnalyticsOverview for period-over-period revenue and order summaries (including previous-period window calculation), GetPaymentsTimeSeries for daily payment trends, and GetTopProducts for best-selling items. Each use case delegates to the AnalyticsQueryService and wraps results in a standard Result type, ensuring consistent error propagation.
(repo-wide) · high confidence
Added application use cases for role and permission management
This change introduces the application-layer use cases for the new Authorization Module, enabling administrators to manage roles and permissions. Specifically, it adds \FindAllPermissionsUseCase\ to retrieve all available permissions, and a full set of CRUD operations for roles: \CreateRoleUseCase\ (with uniqueness validation on the role code), \FindAllRolesUseCase\, \FindRoleByIdUseCase\, \UpdateRoleUseCase\ (which prevents modifying system roles), and \DeleteRoleUseCase\ (which also prevents deletion of system roles). Each use case is accompanied by comprehensive unit tests verifying success paths, repository error handling, and specific business rule validations.
src/modules/authorization/core/application/usecases/role · high confidence
Added demo cart seeding capability
A new SeedDemoCartUseCase has been introduced to automatically populate a user's cart with predefined demo items (specifically headphones, clothing, and home goods) when no existing cart is found. This feature allows users to quickly experience the shopping interface with sample products, while safely skipping the operation if a cart with items already exists.
src/modules/carts/core/application/seed · high confidence
Added demo inventory seeding use cases
New application-layer use cases have been introduced to populate the inventory module with sample data for development and testing. The \SeedDemoInventoryUseCase\ initializes inventory records for specified products, creating new entries only when they do not already exist. Additionally, the \SeedDemoInventoryFromOrdersUseCase\ allows resetting inventory baselines and applying 'hold' or 'consume' effects based on order lines, enabling realistic simulation of stock changes without relying on external reservation systems.
src/modules/inventory/core/application/seed · high confidence
Added inventory query mapper with null-safe field handling
The inventory module now includes an InventoryQueryMapper that converts raw database rows into InventoryListItemDTO objects. This mapper ensures robust data handling by providing default fallback values for nullable fields (e.g., 'N/A' for SKU, 'Unknown Product' for title) and safely converting string-based numeric fields to numbers, ensuring consistent data shapes for downstream consumers.
src/modules/inventory/secondary-adapters/mappers · high confidence
Added refund checkout payment and release checkout stock use cases
This change introduces two new application-layer use cases to support checkout compensation flows. The \RefundCheckoutPaymentUseCase\ validates that the refund amount is greater than zero, delegates the refund to the payment gateway, and publishes a \checkout.saga.compensation\ domain event on success, while preserving the retryable status of gateway errors. The \ReleaseCheckoutStockUseCase\ releases inventory reservations via the inventory gateway and similarly publishes a \checkout.saga.compensation\ domain event upon completion.
src/modules/orders/core/application/usecases/refund-checkout-payment · high confidence
Added refund checkout payment and release checkout stock use cases
This change introduces two new application-layer use cases to support checkout compensation flows. The \RefundCheckoutPaymentUseCase\ validates that the refund amount is greater than zero, delegates the refund to the payment gateway, and publishes a \checkout.saga.compensation\ domain event on success, while preserving the retryable status of gateway errors. The \ReleaseCheckoutStockUseCase\ releases inventory reservations via the inventory gateway and similarly publishes a \checkout.saga.compensation\ domain event upon completion. Also in this area: 1 commit (0 fixes) modifying (repo-wide).
src/modules/orders/core/application/usecases/release-checkout-stock · low confidence · unverified
Added role-based permissions guard for route protection
The application now includes a PermissionsGuard that enforces access control based on specific permissions required by routes. This guard checks if the current user possesses the necessary permissions (defined via decorators) by resolving their role's permission set; it allows access if no permissions are required, denies access if the user is missing or lacks the specific permission, and attaches the resolved permissions to the request context for use by other components.
src/modules/authorization/primary-adapter/guards · high confidence
Added service to resolve role permissions
The authorization module now includes a \ResolveRolePermissionsService\ that retrieves the list of permission codes associated with a specific role. This service queries the \RoleRepository\ and returns a \RolePermissionsVO\ containing the resolved permissions, handling cases where the role code is missing or the repository call fails.
src/modules/authorization/core/application/services · high confidence
Added smoke testing framework with health and authentication probes
A new smoke testing suite has been introduced in the scripts/smoke directory to validate service availability and core functionality. The framework includes probes for liveness, readiness, and full health endpoints, as well as a check for the Prometheus metrics endpoint. It also performs an end-to-end authentication flow by registering a temporary user, logging in to obtain an access token, and verifying access to the user API. The runner executes these checks in a fail-fast manner, ensuring that any failure in the health or authentication path is immediately reported.
scripts/smoke · high confidence
Added sweep-expired-reservations use case and tests
This change introduces the \SweepExpiredReservationsUseCase\ and its corresponding unit tests. The new use case allows the system to identify and transition pending reservations to an expired state in batches, handling failures gracefully by tracking failed IDs and excluding them from subsequent batches. It supports configurable batch sizes and date filters, ensuring that inventory state is correctly updated for expired reservations.
src/modules/inventory/core/application/usecases/sweep-expired-reservations · high confidence
Added use case to expire pending orders
A new ExpirePendingOrdersUseCase has been introduced to automatically cancel orders that have remained in the PENDING\_PAYMENT state for longer than a specified duration. The use case queries the order repository for matching orders and invokes the existing CancelOrderUseCase for each, returning a summary of successfully cancelled and failed cancellations. A corresponding test suite validates the core logic, including handling repository errors, partial cancellation failures, and empty result sets. Also in this area: 1 commit adding/updating tests in src/modules/orders/core/application/usecases/expire-pending-orders; 1 commit (0 fixes) modifying (repo-wide).
src/modules/orders/core/application/usecases/expire-pending-orders · low confidence · unverified
Added use case to revoke all user sessions
A new RevokeAllForUserUsecase has been introduced in the authentication module, allowing users to invalidate all active session tokens for a specific user ID. This use case integrates with the existing SessionTokenRepository to perform the bulk revocation operation.
src/modules/authentication/core/application/usecases/revoke-all-for-user · high confidence
Adds custom type definitions for Express and Socket.io
The application now includes explicit TypeScript definitions that extend the Express Request and Socket.io Socket interfaces. This allows developers to access user payload data, role permissions, and correlation IDs directly on request objects, and user verification data on socket connections, improving type safety and developer experience when handling authenticated requests and real-time events.
src/types · high confidence
Authentication module introduces session-aware refresh tokens and JWT signing services
The authentication module now includes a new \JwtSignerService\ that implements RS256 JWT signing for access tokens, refresh tokens, and cart session tokens, utilizing the \jose\ library. A key behavioral addition is the \signRefreshTokenWithSession\ method, which embeds a unique session ID (\sid\) into refresh tokens and generates distinct tokens (via \jti\) even when issued for the same session within the same second, supporting the session revocation logic referenced in commit \#299. Additionally, a \BcryptService\ has been added to handle password hashing and comparison using bcrypt with 10 salt rounds.
src/modules/authentication/secondary-adapters/services · high confidence
Automatic initialization of system permissions and roles on application startup
The application now automatically bootstraps its core authorization data when it starts. A new PermissionSystemDataInitializer ensures that the required system permission catalog exists, creating any missing entries while skipping initialization if permissions are already present or if the application is shutting down. The RoleSystemDataInitializer then runs, creating system roles (such as SUPER\_ADMIN and ADMIN) and updating their permissions if they have changed or if an existing role was incorrectly marked as non-system. This process is idempotent and respects the application lifecycle, ensuring that role-permission links are correctly established to prevent access errors during startup.
src/modules/authorization/core/application/lifecycle · high confidence
Automatic refresh token cookie management for authentication routes
The authentication module now automatically sets and clears HTTP-only refresh token cookies for specific API endpoints. The new RefreshTokenCookieInterceptor handles this by setting the cookie on successful login, password changes, and token refresh requests, and clearing it upon logout. This behavior applies to both versioned (e.g., /v1/authentication) and unversioned routes, ensuring consistent session management across API versions.
src/modules/authentication/primary-adapters/interceptors · high confidence
Cached inventory repository with integration and unit tests
The inventory module now uses a \CachedInventoryRepository\ that wraps the existing Postgres repository with a Redis cache layer. This adapter intercepts read operations (\findById\, \findByProductId\, \findByProductIds\) to serve data from cache when available, falling back to the database on misses and populating the cache with a defined TTL. Write operations (\save\) write through to Postgres and invalidate relevant cache entries. Comprehensive unit and integration tests have been added to verify cache hit/miss behavior, error handling for Redis/DB failures, and data consistency between the cache and the database.
src/modules/inventory/secondary-adapters/repositories/cached-inventory-repository · high confidence
Centralized API versioning and optimized demo media serving
The HTTP infrastructure now centralizes API versioning via a new \api-version.ts\ module that defines the default version and prefix, ensuring consistency across NestJS configuration, cookies, and E2E tests. Additionally, a new \serveDemoMedia\ utility serves optimized demo product images with long-lived caching (immutable, 365-day max age) and relaxed Cross-Origin Resource Policy (CORP) headers to support cross-origin loading, while failing fast at startup if the media folder is missing. A \parseTrustProxy\ utility was also added to standardize how proxy trust settings are parsed from environment variables.
src/infrastructure/http · high confidence
Centralized Redis caching configuration and search index schemas
This change introduces a new constants module for Redis infrastructure, consolidating cache key definitions, expiration policies, and search index schemas for core domain entities. Users benefit from consistent caching behavior across Orders, Products, Inventory, Carts, Payments, and Users, with default expiration set to 7 days (30 days for Carts). The module also defines schemas for RediSearch-style indexing on these entities, enabling efficient querying by fields such as price, stock quantity, and user ID. Additionally, it includes configuration for idempotency handling (24-hour expiration, 2-second retry hint) and role-permission caching (1-hour expiration, invalidated on role changes), supporting more predictable and performant access control checks.
src/infrastructure/redis/constants · high confidence
Graceful application shutdown with safety timeout
The application now implements a graceful shutdown mechanism via the new ShutdownModule and ShutdownService. When a shutdown signal (such as SIGTERM) is received, the service initiates a graceful shutdown process and starts a 15-second safety timeout. If the application does not complete its shutdown within this period, the process is forcibly exited to prevent hanging. The service also ensures that subsequent shutdown signals are ignored once the process has begun shutting down and clears the safety timeout if the shutdown completes successfully.
src/infrastructure/shutdown · high confidence
Identity module exposes user and address management APIs with role-based access control
The identity module now provides a comprehensive set of endpoints for managing user profiles and addresses, secured by the new authorization system. Administrators can list, view, update, delete, activate, and deactivate users, as well as assign roles, while users can view their own profiles via a dedicated 'me' endpoint. Address management (add, update, delete, set default) is also exposed, requiring specific permissions. These capabilities are backed by a new \GetUserByEmailUseCase\ that enforces ownership policies and a \ModuleAuthorizationGateway\ that delegates role assignment to the authorization module.
src/modules/identity · high confidence
Initial Carts module implementation with Hexagonal architecture
The Carts module is now available, providing a complete set of endpoints for managing shopping carts (create, retrieve, add/update/remove items, clear) and seeding demo data. The implementation follows a Hexagonal architecture, exposing a NestJS controller that delegates to domain use cases, backed by both Postgres and cached repositories, and integrated with Inventory and Product modules via gateways for stock and product data.
src/modules/carts · high confidence
Initial NestJS application bootstrap with modular architecture and security defaults
The application is now bootstrapped as a NestJS service, wiring together core modules (Orders, Products, Carts, Payments, Inventory, Identity, Authentication, Authorization, Notifications, Analytics, Health, and Shutdown) via the AppModule. The bootstrap process in main.ts configures global behaviors including URI-based API versioning, request validation with property whitelisting, sanitization, and centralized exception handling. Security is enforced via Helmet, CORS, cookie parsing, and global guards for authentication, permission checks, and mandatory password changes. Infrastructure features include Redis-backed WebSocket support, graceful shutdown hooks, and Winston logging. Swagger documentation is available in non-production environments, and health checks are exposed via the HealthModule.
src · high confidence
Initial project scaffolding and configuration
The repository is initialized with a NestJS application structure, including a multi-stage Dockerfile, docker-compose configurations for development and production, and a comprehensive set of environment variable examples (.env.example, .secrets.example). This entry also establishes developer tooling and governance, such as ESLint and Prettier configurations, TypeScript settings, and AI agent policy documents (AGENT.md, CLAUDE.md, etc.), alongside standard project documentation (README, CHANGELOG, LICENSE, SECURITY.md).
(repo-wide) · high confidence
Introduce Cart Ownership Validator for Access Control
A new CartOwnershipValidator service has been added to enforce stricter access control on cart operations. This validator checks the caller's context to ensure that only system users, administrators with 'manage\_carts' permission, or the specific user owning the cart (with 'manage\_own\_cart' permission) can access it. It returns a Result wrapper indicating success or failure, preventing unauthorized access attempts. Also in this area: 3 commits (1 fix) modifying (repo-wide).
src/modules/carts/core/application/services · medium confidence · unverified
Introduce Cart and CartItem domain entities with currency support
The cart module now defines explicit domain entities for \Cart\ and \CartItem\, replacing previous implicit structures. These entities enforce strict validation, including mandatory 3-letter ISO currency codes, non-negative prices, and positive quantities. The \Cart\ entity manages a single-currency constraint, preventing the mixing of different currencies within one cart, and exposes aggregate metrics like \itemCount\ and \totalAmount\. \CartItem\ handles line-item logic, including quantity adjustments and price updates, while normalizing inputs like trimming whitespace from product names and SKUs.
src/modules/carts/core/domain/entities · high confidence
Introduce ORM entities and mappers for Role-Based Access Control
This change adds the persistence layer for the new authorization module, introducing TypeORM entities for Permissions, Roles, and User-Role assignments, along with the corresponding mappers to translate between domain objects and database records. Users can now have roles assigned, where roles define specific permissions, enabling granular access control within the application.
src/modules/authorization/secondary-adapter/orm · high confidence
Introduce ORM entities for User and Address with optimistic locking
The identity module now includes TypeORM entity definitions for users and addresses, establishing the database schema for the \users\ and \user\_addresses\ tables. The \UserEntity\ supports optimistic concurrency control via a \version\ column and maintains a one-to-many relationship with \AddressEntity\, which includes fields for street, city, state, postal code, country, and type. This change provides the persistence layer for user identity data, enforcing non-nullable core properties like email and name while allowing optional fields such as phone and secondary address lines.
src/modules/identity/secondary-adapters/orm · high confidence
Introduce analytics query mapper for raw SQL data transformation
Added the AnalyticsQueryMapper class and its corresponding DTO interfaces to convert raw database query results (from node-pg/TypeORM) into structured application objects. This includes mapping revenue aggregates, order attention counts, payment time-series buckets (with zero-filling for missing days), top products, and inventory alerts, ensuring consistent numeric coercion and currency handling for the analytics module.
src/modules/analytics/secondary-adapters/mappers · high confidence
Introduce core authorization domain model for roles and permissions
This change establishes the foundational domain layer for the authorization module by adding the \Permission\, \Role\, and \UserRoleAssignment\ entities, along with the \RolePermissions\ value object. It defines the data structures and business rules for managing permissions (such as \manage\_users\ and \access\_admin\) and roles (including system roles like \Super Administrator\ and \Customer\), while enforcing constraints like preventing the deletion or renaming of system roles. The update also introduces abstract repository interfaces for persisting these entities and provides reference data for default system permissions and roles, laying the groundwork for role-based access control. Also in this area: 1 commit (1 fix) fixing src/modules/authorization; 1 commit (0 fixes) modifying (repo-wide).
src/modules/authorization/core/domain · medium confidence · unverified
Introduce credential and session token domain models
The authentication module now includes core domain entities for managing user credentials and session tokens. The new Credential entity supports password updates via a changePassword method that refreshes the hash and clears the mustChangePassword flag, while the SessionToken entity provides functionality for creating, validating, and revoking tokens with expiration checks. Corresponding repository interfaces have been added to define persistence operations for both entities, including saving, finding, updating, and deleting credentials, as well as saving, finding, revoking all tokens for a user, and cleaning up expired session tokens.
src/modules/authentication/core/domain/entities · high confidence
Introduce notifications module with API endpoints and background processing
The new notifications module exposes REST endpoints for retrieving a user's notifications (with pagination and status filtering) and marking individual notifications as read. It integrates a BullMQ-based job processor to handle notification delivery, history saving, status updates, and cleanup of expired notifications, while using WebSockets to push updates and PostgreSQL to persist notification data. Also in this area: 2 commits (1 fix) modifying (repo-wide); Introduce core notification domain and application services; Add WebSocket-based notification delivery gateway; Add notification entity schema for database persistence; Add notification query mapper for database row to DTO conversion; and 5 more.
src/modules/notifications · medium confidence · unverified
Introduce persistence mappers for User and Address entities
New mapper classes (AddressMapper, UserMapper, UserCacheMapper) have been added to the persistence layer to handle the conversion between domain models and database entities. This includes support for mapping user addresses, generating update payloads for user records, and serializing/deserializing user data for caching purposes, ensuring consistent data transformation between the identity domain and the underlying storage.
src/modules/identity/secondary-adapters/persistence · high confidence
Introduce user listing and detail query interfaces with address support
The identity module now exposes structured query interfaces and DTOs for retrieving user data. The ListUsersQuery allows filtering users by role code, active status, and search terms, while the UserDetailDTO extends the basic user list item to include a count and list of associated addresses (including street, city, and type details). This enables consumers to fetch paginated user lists and detailed user profiles with their address information.
src/modules/identity/core/application/queries · high confidence
Introduces structured error handling, domain value objects, and access control policies
The shared-kernel now provides a comprehensive foundation for domain-driven development, including a typed \Result\ monad and a hierarchy of \AppError\ classes (Domain, UseCase, Service, Repository, Infrastructure, Query) with a central \ErrorFactory\ for consistent error creation. New domain value objects for \Money\ (with arithmetic and validation), \Quantity\, \PaymentMethod\, and \AddressType\ are available for use across bounded contexts. The kernel also introduces \CallerContext\ and \OwnedResourceAccessPolicy\ to enforce user-scoped resource access (view/mutate) based on permissions, alongside interfaces for JWT verification, caching, and idempotency to standardize infrastructure interactions. Also in this area: 1 commit adding/updating tests in src/shared-kernel; 4 commits (2 fixes) modifying src/shared-kernel; 1 commit (0 fixes) modifying (repo-wide).
src/shared-kernel · medium confidence · unverified
Introduction of CachedCartRepository with Redis caching and updated test coverage
A new CachedCartRepository has been added to the cart module, implementing the CartRepository interface to wrap database operations with Redis caching. This adapter intercepts find and save operations to store and retrieve cart data from Redis using a defined expiration time, while ensuring cache consistency by deleting entries on cart deletion. The implementation includes specific logic for handling user-ID based lookups and versioned updates, delegating directly to the underlying Postgres repository for update operations. Corresponding unit tests have been added to verify the repository's behavior, including scenarios for cache misses, successful saves, and deletions across both the cache and database layers.
src/modules/carts/secondary-adapters/repositories/cached-cart-repository · high confidence
Inventory and Reservation domain repository contracts defined
The inventory module now exposes explicit domain contracts for managing stock and reservations. The InventoryRepository defines operations for finding inventory by ID or product, batch traversal, low-stock queries, and versioned saves/deletes. The ReservationRepository provides methods to save, update, and retrieve reservations by order, as well as lifecycle actions like release, confirm, and expire, including a new capability to sum pending reserved quantities by product IDs.
src/modules/inventory/core/domain/repositories · high confidence
Inventory module with stock management, reservations, and reconciliation
The new Inventory module exposes endpoints for listing and viewing inventory details, adjusting stock quantities, and checking availability (publicly for shoppers). It introduces stock reservation capabilities, allowing orders to temporarily hold inventory and release it upon cancellation. Additionally, it includes a background job for inventory reconciliation to detect and log discrepancies between database records and active reservations, ensuring data consistency.
src/modules/inventory · high confidence
Inventory query interface defined for data retrieval
A new abstract port, InventoryQueryService, has been added to the inventory module's application layer. This interface defines the contract for retrieving inventory data, specifically requiring implementations to support listing inventory items via a query object and fetching individual items by product ID. This change establishes the API that downstream adapters (such as the Postgres adapter mentioned in commit history) must implement to serve inventory read operations.
src/modules/inventory/core/application/ports · high confidence
JWT verification now supports cart session tokens
The JWT verification service has been extended to validate cart session tokens in addition to access and refresh tokens. The new \JwtVerifierService\ implements a \verifyCartSessionToken\ method that checks for the \cart\_session\ token type and asserts the presence of required claims such as \cartId\, \sub\, \typ\, \iss\, \iat\, and \exp\. This change is supported by a new \JwksService\ that handles RSA key import and JWKS generation, ensuring the public key is available for verifying these new token signatures. Also in this area: 1 commit (0 fixes) modifying (repo-wide).
src/infrastructure/jwt/services · low confidence · unverified
Metrics endpoint secured and business events instrumented
The metrics infrastructure now includes a new authentication guard that protects the /metrics endpoint by requiring a valid API key (passed via X-Metrics-API-Key header or Authorization: Bearer token) using constant-time comparison to prevent timing attacks; if the key is missing, access is denied. Additionally, a business metrics listener has been added to automatically increment counters for key operational events, including order creation, checkout saga lifecycle stages (completed, failed, compensation), payment capture and refund, authentication success and failure, and cart checkout initiation.
src/infrastructure/metrics/guards, src/infrastructure/metrics/listeners · high confidence
New DTOs for Role and Permission management API
Added new Data Transfer Objects (CreateRoleDto, UpdateRoleDto, RoleResponseDto, PermissionResponseDto) to the authorization primary adapter. These define the input and output structures for role and permission endpoints, enforcing non-nullable properties for role codes and names, and specifying permission lists as arrays of strings. This enables users to create, update, and retrieve roles with associated permissions through the API.
src/modules/authorization/primary-adapter/dto · high confidence
New Identity Domain Model for Users and Addresses
The identity module now includes a core domain layer defining the User and Address entities, their interfaces, and repository contracts. Users can be activated or deactivated, manage multiple addresses, and set a default address, with automatic validation for required fields like email and street address. The User repository introduces optimistic concurrency control via versioning (findByIdForUpdate and save with expectedVersion), ensuring data integrity during concurrent updates.
src/modules/identity/core/domain/entities · high confidence
New ORM schema definitions for inventory and reservation entities
This change introduces the TypeORM entity schemas for the inventory module, defining the database structure for inventory records, reservations, and reservation items. The InventoryEntity includes versioning support, check constraints to ensure non-negative quantities, and indexes for product ID and availability. The ReservationEntity tracks order associations, status, and expiration, with specific indexes to optimize queries for pending reservations. The ReservationItemEntity links items to their parent reservation using a many-to-one relationship with cascade deletion. These schemas establish the persistence layer for managing stock levels and temporary reservations.
src/modules/inventory/secondary-adapters/orm · high confidence
New Prometheus metrics endpoint and middleware for application monitoring
The application now exposes a new \/metrics\ endpoint that returns Prometheus-formatted metrics, protected by an optional API key guard and exempt from rate limiting. A new \MetricsMiddleware\ automatically tracks HTTP request counts and durations for all routes, normalizing paths by replacing UUIDs and integer IDs with \:id\ placeholders to prevent cardinality explosion. The underlying \MetricsService\ registers a comprehensive set of counters, gauges, and histograms, including HTTP metrics, business indicators (orders, checkout sagas, payments, auth, carts), infrastructure status (DB pool, Redis health/cache, throttler degradation, BullMQ queue depth, WebSocket connections), and audit metrics (inventory drift, Redis cache hits/misses/recovery failures).
src/infrastructure/metrics · high confidence
New Redis JSON-based cache service with search and fail-open behavior
The application now uses a new CacheService in the Redis infrastructure layer that stores data as RedisJSON documents. This service provides standard caching operations (get, set, delete) as well as a new search capability that queries Redis FT indexes and returns mapped domain objects. It includes fail-open logic, meaning Redis outages or pipeline errors will not crash the application but instead fall back to the primary data source (PostgreSQL). The implementation also adds metrics tracking for cache hits and misses.
src/infrastructure/redis/cache · high confidence
New Redis-backed Idempotency Service with robust error handling
The infrastructure layer now includes a new \IdempotencyService\ that uses Redis (via the \CachePort\) to manage idempotency keys. This service provides atomic locking via \checkAndLock\ (using SET NX), allows marking operations as \complete\ with stored data, and supports \release\ to delete keys. It is designed to fail closed when the cache is unavailable or when encountering malformed records/unknown statuses, ensuring system stability. The service is exposed via a new \IdempotencyModule\ and registered as a global provider, making it available across the application.
src/infrastructure/idempotency · high confidence
New admin analytics API endpoints for operational insights
This change introduces the \AnalyticsModule\ in \src/modules/analytics\, exposing a new REST API under the \/admin/analytics\ path for administrative users. The module provides four endpoints: an operational overview (\/overview\) for KPIs like revenue and order counts, a payments time-series endpoint (\/payments/time-series\) for revenue trends, a top products list (\/products/top\), and low-stock inventory alerts (\/inventory/alerts\). Access to these endpoints is controlled by specific permissions (\view\_all\_orders\, \view\_all\_payments\, \view\_all\_inventory\), and the implementation includes unit tests for the controller logic and dependency injection setup via a Postgres-based query adapter.
src/modules/analytics · high confidence
New analytics API request and response schemas
This change introduces the primary-adapter Data Transfer Objects (DTOs) that define the contract for the new analytics endpoints. Users can now query for an overview of key performance indicators (including net/gross revenue, order counts, and average order value), retrieve payment time-series data with configurable day or week buckets, fetch top-selling products, and check inventory alerts. The request schemas enforce strict validation, including a maximum 90-day range for period queries and specific bucket constraints, while the response schemas structure the returned metrics, time-series buckets, and product details.
src/modules/analytics/primary-adapters · high confidence
New application ports for cart queries and external service communication
The cart module now exposes three new application-layer ports to support hexagonal architecture patterns. A new \CartQueryService\ abstract class defines interfaces for retrieving cart data by ID or user ID, returning presentation DTOs. Additionally, \CartInventoryGateway\ and \CartProductGateway\ interfaces are introduced to handle cross-module communication for stock availability checks and product data retrieval, respectively. These ports decouple the cart's core logic from specific infrastructure implementations for inventory and product services.
src/modules/carts/core/application/ports · high confidence
New authentication DTOs for login, registration, and password management
The authentication module now exposes a comprehensive set of Data Transfer Objects to support user registration, login, token refresh, and password changes. Clients can register with email, password, and optional phone details; log in with email and password; and refresh sessions using either an HttpOnly cookie or an optional JSON body token. A new change-password endpoint requires the current password and a new one (minimum 6 characters). Responses include structured token data (access and refresh tokens), a flag indicating if password rotation is required, and the user's permission codes, alongside standard user profile details for registration responses.
src/modules/authentication/primary-adapters/dto · high confidence
New authentication module components for token handling and session management
This change introduces new files for the Authentication module, including a NestJS parameter decorator to extract refresh tokens from cookies or request bodies, an event listener that revokes all user sessions upon deactivation, and a mapper for persisting session token data.
src/modules/authentication/primary-adapters/decorators, src/modules/authentication/primary-adapters/listeners, src/modules/authentication/secondary-adapters/persistence · high confidence
New authentication ports for identity, authorization, and JWT signing
The authentication module now exposes three new application-layer ports that define how the system interacts with identity data, role assignments, and token generation. The IdentityGateway allows the application to create, find, and delete users by email or ID, while the AuthorizationGateway enables assigning roles to users and retrieving role details including permissions. Additionally, the JwtSignerPort standardizes the creation of access and refresh tokens, introducing a mustChangePassword claim in access tokens to support password-reset workflows and adding session-aware refresh token signing to improve security.
src/modules/authentication/core/application/ports · high confidence
New authorization module with role-based access control and permission caching
The application now includes a new Authorization module that introduces role-based access control (RBAC) and permission management. Users can manage roles and permissions via new REST endpoints at /roles and /permissions, which support creating, reading, updating, and deleting roles, as well as listing all available permissions. The system uses a CachedRoleRepository to store role permissions in Redis, improving performance by caching permission lookups and invalidating the cache when roles are modified. This module also includes data initializers to set up default roles and permissions on startup.
src/modules/authorization · high confidence
New category management use cases with role-based visibility
Added application-layer use cases for creating, updating, activating, deactivating, deleting, retrieving, and listing categories. These use cases enforce role-based visibility: shoppers only see active categories, while operators with the view\_all\_products permission can view inactive ones. The implementation uses a CategoryQueryService for read operations and a CategoryRepository for write operations, ensuring consistent error handling and validation for name and slug uniqueness. Also in this area: 3 commits (1 fix) modifying (repo-wide).
src/modules/products/core/application/usecases/categories · medium confidence · unverified
New checkout use case with validation, event publishing, and scheduling
The checkout flow now uses a dedicated CheckoutUseCase that first validates the cart and shipping context via ValidateCheckoutUseCase, publishes domain events (cart.checkout.initiated and order.created) upon success, persists the order, and schedules the checkout job. If scheduling fails, the order is cancelled and saved before returning an error. The use case accepts a callerContext for access control and supports optional shipping address details.
src/modules/orders/core/application/usecases/checkout · high confidence
New checkout use cases for cart clearing, stock reservation, and reservation confirmation
This change introduces three new application-layer use cases to support the checkout flow: ClearCheckoutCartUseCase, ReserveStockForCheckoutUseCase, and ConfirmCheckoutReservationUseCase. ClearCheckoutCartUseCase allows users to clear their shopping cart by interacting with the CartGateway. ReserveStockForCheckoutUseCase enables reserving inventory for an order by accepting order ID and item details via the InventoryReservationGateway, returning reservation data. ConfirmCheckoutReservationUseCase allows confirming a previously made stock reservation via the InventoryReservationGateway. These use cases provide the core logic for managing cart state and inventory reservations during the checkout process.
src/modules/orders/core/application/usecases/clear-checkout-cart, src/modules/orders/core/application/usecases/confirm-checkout-reservation, src/modules/orders/core/application/usecases/reserve-stock-for-checkout · high confidence
New database infrastructure module and error handling utilities
This change introduces the core database configuration and error handling components for the application. The new \DatabaseModule\ sets up the TypeORM connection to PostgreSQL, configuring connection details via environment variables, enabling SSL when specified, and adjusting logging verbosity based on the environment (logging errors and warnings in non-production, errors only in production). Additionally, a \numericToNumber\ transformer is added to handle database-to-entity number conversions, and \postgres-error.utils\ provides robust parsing of PostgreSQL error codes and constraint names, supporting both direct error properties and nested \driverError\ envelopes to improve error diagnostics.
src/infrastructure/database · high confidence
New decorators for public access, optional authentication, and password-change bypass
Three new NestJS decorators have been added to simplify access control: \Public\ marks routes as publicly accessible, \OptionalAuth\ allows requests to proceed with or without authentication, and \AllowDuringPasswordChange\ permits access to specific endpoints while a user is in the process of changing their password. These decorators set internal metadata keys that guards can check to determine authorization behavior.
src/guards/decorators · high confidence
New identity API decorators and user/address DTOs
The identity module now exposes structured request decorators and DTOs that shape how users and addresses are managed via the API. The new CurrentUser and CallerCtx decorators allow controllers to cleanly extract the authenticated user and their caller context (including permissions) from the request, while the new DTOs define the input and output contracts for user and address operations. Specifically, ListUsersQueryDto adds support for filtering users by role code, active status, and search terms, and pagination. AssignRoleDto enforces uppercase role codes for role assignment. Address handling is supported via AddAddressDto, UpdateAddressDto, and AddressResponseDto, which define the fields for creating, updating, and returning address details. User management is supported via UpdateUserDto for profile updates and UserListItemResponseDto/UserDetailResponseDto for reading user data, with the detail response including an address count and list of addresses. PaginatedUsersResponseDto structures the paginated list of users.
src/modules/identity/primary-adapters · high confidence
New identity and authorization gateway adapters
Added ModuleIdentityGateway and ModuleAuthorizationGateway adapters in the authentication secondary adapters layer. These new files implement the IdentityGateway and AuthorizationGateway ports by wiring to specific use cases (CreateUser, GetUser, DeleteUser, AssignRole, FindRoleByUserId, etc.), providing the concrete implementation for user identity and role management operations within this module.
src/modules/authentication/secondary-adapters/adapters · high confidence
New infrastructure metrics collector for database, Redis, and queues
A new InfraMetricsCollector has been added to periodically gather operational metrics every 60 seconds. It tracks PostgreSQL database pool usage (active connections), Redis health status and cache generation, and BullMQ notification queue depth (active, waiting, and delayed jobs). If collecting queue metrics fails, the error is logged without stopping the collection cycle.
src/infrastructure/metrics/collectors · high confidence
New input sanitization and result-handling interceptors
Added a SanitizeInterceptor that recursively strips HTML/JavaScript from request body fields to prevent XSS, while preserving password fields and allowing specific routes (login, Stripe webhooks) to opt out via a decorator. Also added a ResultInterceptor that automatically converts domain Result objects into appropriate HTTP responses, throwing HttpExceptions on failure and unwrapping success values.
src/interceptors · high confidence
New inventory API request and response DTOs
This change introduces a comprehensive set of Data Transfer Objects for the inventory module's primary adapters, defining the structure for both incoming requests and outgoing responses. New request DTOs include AdjustStockDto, BulkCheckStockBodyDto, CheckStockQueryDto, ListInventoryQueryDto, LowStockQueryDto, and ReserveStockDto, which enforce validation rules (such as integer types, minimum/maximum limits, and enum constraints) and provide Swagger documentation for endpoints like stock adjustment, bulk stock checks, inventory listing with pagination and filtering, and stock reservation. Corresponding response DTOs—InventoryListItemResponseDto, PaginatedInventoryResponseDto, InventoryStockResponseDto, CheckStockResponseDto, ReservationResponseDto, and StockReservationResponseDto—standardize the shape of API responses, ensuring consistent fields for inventory details, pagination metadata, stock availability checks, and reservation status.
src/modules/inventory/primary-adapters/dto · high confidence
New inventory availability and retrieval use cases
The inventory module now exposes two new application-layer capabilities: a CheckStock use case that determines product availability by verifying stock levels (defaulting to a quantity of 1 if unspecified) and returning a structured availability result, and a GetInventory use case that retrieves the inventory presentation DTO for a specific product, returning null if no stock row exists. Both use cases are implemented with comprehensive unit tests covering success, failure, and edge cases like missing inventory or invalid quantities. Also in this area: 1 commit (0 fixes) modifying (repo-wide).
src/modules/inventory/core/application/usecases/check-stock, src/modules/inventory/core/application/usecases/get-inventory · low confidence
New inventory management use cases for stock adjustments and reservations
The inventory module now includes new application-layer use cases to handle stock adjustments (adding, subtracting, or setting stock levels), reservation lifecycles (reserving, confirming, and releasing stock), and inventory reconciliation. Users can now adjust stock quantities with validation for negative or zero values, manage the state of stock reservations through their full lifecycle, and run a reconciliation process that detects discrepancies between recorded reserved quantities and active pending reservations.
src/modules/inventory/core/application/usecases/reconcile-inventory · high confidence
New inventory reservation use cases and tests
Added the ConfirmReservationUseCase and ReserveStockUseCase application services, along with their corresponding unit tests. The ReserveStockUseCase handles creating new stock reservations via the ReservationRepository, while the ConfirmReservationUseCase manages the lifecycle of existing reservations by validating their status (ensuring they are pending and not expired) before confirming them. These changes provide the core application logic for managing inventory reservations within the inventory module.
src/modules/inventory/core/application/usecases/reserve-stock · high confidence
New inventory use cases for bulk stock checks and low-stock listing
The inventory module now includes two new application-layer use cases: BulkCheckStockUseCase, which allows checking stock availability for multiple products in a single request (handling duplicates, missing records, and default quantities), and ListLowStockUseCase, which retrieves a list of inventory items falling below a specified threshold. These changes introduce new capabilities for batch inventory validation and low-stock monitoring within the core inventory service.
src/modules/inventory/core/application/usecases/bulk-check-stock, src/modules/inventory/core/application/usecases/list-low-stock · high confidence
New local development setup with Docker integration and automated bootstrapping
The \scripts/lib\ directory now includes a new CLI utility (\cli.js\) for environment loading and argument parsing, a Docker integration module (\docker.js\) that checks for Docker availability and starts PostgreSQL and Redis via Docker Compose, a PostgreSQL utility module (\pg.js\) for database operations using Docker or local tools, and a setup orchestrator (\setup-bootstrap.js\) that automates the local development environment initialization. This includes checking Docker, generating environment files, starting infrastructure, running migrations, and seeding data, with comprehensive test coverage for the new modules.
scripts/lib · high confidence
New logout and logout-all authentication use cases
The authentication module now includes dedicated application use cases for logging out. The new LogoutUseCase revokes a single active session by verifying the refresh token, locating the corresponding session token, and marking it as revoked. The new LogoutAllUseCase revokes all active sessions for the authenticated user by verifying the token and calling the session repository's revoke-all method. Both use cases are implemented as NestJS injectable services, rely on the JwtVerifierPort and SessionTokenRepository, and are idempotent, ensuring that invalid tokens or missing sessions do not cause errors.
src/modules/authentication/core/application/usecases/logout, src/modules/authentication/core/application/usecases/logout-all · high confidence
New operational scripts for environment setup, database management, and code quality
This change introduces a suite of new scripts in the \scripts/\ directory to streamline development, deployment, and maintenance. For environment setup, \generate-envs.js\ now creates \.env\ files from templates with environment-specific defaults (such as \TRUST\_PROXY\ and \IS\_DB\_SYNCHRONIZE\) and generates RSA keys for JWT secrets, while \setup.js\ orchestrates the full local development bootstrap including Docker, migrations, and seeding. Database operations are now supported by \db-backup.js\ and \db-restore.js\ for automated PostgreSQL dumps and restores, and a new \db-restore-drill.js\ script allows safe validation of restore procedures in a disposable database. Deployment is enhanced by \docker-migrate.js\, a self-contained runner for TypeORM migrations in production containers. The seed process (\seed.ts\, \seed-admin.ts\) now supports seeding categories, inventory, carts, orders, and payments, with explicit blocking in production environments. Code quality is improved by \lint-ascii-prose.cjs\ to enforce ASCII punctuation in documentation and comments, and \audit-openapi.js\ validates the OpenAPI spec for consistency. Additionally, \sync-agent-skills.js\ synchronizes AI agent skills across local and CI directories, and \smoke-test.js\ provides post-deployment HTTP probes. Also in this area: Hosted demo reset capability and cross-origin cookie support; Improved environment file generation and setup robustness; Staging demo deployment support and production security hardening.
scripts · high confidence
New query interfaces and DTOs for listing inventory items
The inventory module now exposes structured interfaces for querying inventory data. A new \ListInventoryQuery\ interface allows filtering and sorting inventory lists by page, limit, product ID, SKU, title, stock status, and sort direction. Additionally, an \InventoryListItemDTO\ (aliased as \InventoryListItemResult\) defines the shape of the returned data, including item ID, product details, SKU, title, and quantity breakdowns (available, reserved, total).
src/modules/inventory/core/application/queries · high confidence
New use case to create orders from a shopping cart
Added the CreateOrderFromCartUseCase, which allows users to convert their current shopping cart into a new order. The use case fetches the cart via the CartGateway, validates that it is not empty, constructs the order domain entity using the OrderFactory (incorporating user ID, shipping address, payment method, and optional notes), and persists it via the OrderRepository. A corresponding test suite verifies successful creation, failure when the cart cannot be fetched, and failure when the cart is empty.
src/modules/orders/core/application/usecases/create-order-from-cart · high confidence
New user creation and activation capabilities in the Identity module
The Identity module now exposes two new application-level use cases for user management. The \CreateUserUseCase\ allows users to be created with basic profile details (first name, last name, email, and optional phone), persisting them via the user repository. The \ActivateUserUseCase\ enables administrators to activate previously deactivated users by finding the user record, invoking the domain activation logic, and saving the updated state. Both use cases include specific error handling for scenarios such as repository failures, user not found, or attempting to activate an already active user.
src/modules/identity/core/application/usecases/user/create-user · high confidence
Payments module restructured with hexagonal architecture and Stripe integration
The Payments module has been reorganized to follow hexagonal architecture best practices, introducing a clear separation between domain, application, and infrastructure layers. This change adds core domain entities for Payment and Refund with full lifecycle management (pending, authorized, captured, failed, refunded), application use cases for creating payment intents, processing refunds, and querying payments by order ID, and a new Stripe gateway integration with signature verification for webhooks. The module now supports Stripe as the primary payment method, replacing previous PayPal and COD components, and includes a demo payment seeding capability for development environments.
src/modules/payments · high confidence
PostgreSQL adapter for inventory data retrieval
The inventory module now includes a PostgresInventoryQueryAdapter that implements the InventoryQueryService interface, enabling users to retrieve inventory data from a PostgreSQL database. This adapter supports paginated listing of inventory items with filtering by product ID, SKU, product title, and low-stock status, as well as fetching individual inventory projections by product ID. It performs cross-context reads by joining inventory and product entities to include product SKUs and titles in the results, and includes integration tests to verify correct behavior with a real database.
src/modules/inventory/secondary-adapters/query · high confidence
PostgreSQL reservation repository with concurrency-safe inventory locking
The PostgresReservationRepository now implements reservation logic using a REPEATABLE READ transaction with pessimistic write locks on inventory rows, ensuring that concurrent checkout attempts serialize correctly and prevent overselling. It provides save, release, confirm, findById, findByOrderId, findAllByOrderId, and findPendingExpired methods, all wrapped in Result-based error handling. Integration and unit tests verify correct inventory decrementing, stock validation, and concurrent safety. Also in this area: 3 commits (1 fix) modifying (repo-wide).
src/modules/inventory/secondary-adapters/repositories/postgres-reservation-repository · medium confidence · unverified
PostgreSQL session token repository implementation and tests
The PostgresSessionTokenRepository now provides the persistence layer for session tokens, supporting save, find-by-id, token rotation with conditional updates (replaceTokenIfCurrent), bulk revocation for a user (revokeAllForUser), and expiration cleanup (deleteExpired). Unit and integration tests verify that token rotation fails with a conflict when the token is already rotated or expired, and that revoking all sessions for a user correctly marks only that user's active sessions as revoked.
src/modules/authentication/secondary-adapters/repositories/postgres-session-token-repository · high confidence
Ship Order Use Case Implementation
The ShipOrderUseCase has been implemented to handle the logic for transitioning an order to the shipped status. It retrieves the order using a versioned find operation (findByIdForUpdate) to ensure data consistency, validates that the order is in the correct processing state, and persists the change via the order repository. The implementation includes comprehensive unit tests covering success scenarios, various invalid states (pending, confirmed, already shipped, delivered, cancelled), and error handling for repository failures. Also in this area: 1 commit (1 fix) fixing (repo-wide).
src/modules/orders/core/application/usecases/ship-order · medium confidence · unverified
User deactivation capability with optimistic locking and event publishing
The system now supports deactivating a user account. When a user is deactivated, the system finds the user record using optimistic locking (findByIdForUpdate), marks the user as inactive, saves the change, and publishes a 'user.deactivated' domain event. If the user is not found or is already deactivated, the operation fails with an appropriate error.
src/modules/identity/core/application/usecases/user/deactivate-user · high confidence
User profile update capability added
The system now supports updating user profile information (first name, last name, email, and phone). This change introduces the UpdateUserUseCase, which retrieves the user record for update, applies the provided personal information changes, and persists them to the repository, handling cases where the user is not found or the save operation fails.
src/modules/identity/core/application/usecases/user/update-user · high confidence
WebSocket adapter now supports Redis for cross-instance communication with resilient shutdown
The WebSocket infrastructure now includes a Redis-based adapter that enables real-time communication across multiple application instances. This adapter automatically attempts to connect to Redis using the configured environment settings; if Redis is unavailable, it gracefully falls back to an in-memory adapter to ensure service continuity. Additionally, the adapter implements robust shutdown logic that safely closes both publish and subscribe Redis clients, preventing race conditions and double-close errors during application termination.
src/infrastructure/websocket/adapters · high confidence
WebSocket authentication service with token extraction and verification
The WsAuthService now handles WebSocket connection authentication by extracting JWT tokens from Socket.IO handshake data, prioritizing the \auth.token\ field over URL query parameters or Authorization headers to improve security. It uses the JwtVerifierPort to validate tokens and throws specific errors for missing or invalid tokens, with unit tests verifying the token extraction priority and error handling. Also in this area: 1 commit (0 fixes) modifying (repo-wide).
src/infrastructure/websocket/services · low confidence · unverified
Architecture
Orders module restructured with domain entities, application ports, and demo seeding
The orders module has been reorganized to follow hexagonal architecture principles, introducing dedicated application-layer ports (CartGateway, InventoryReservationGateway, PaymentGateway, UserGateway, OrderQueryService) and command/query interfaces (CancelOrderCommand, CheckoutCommand, ListOrdersQuery) to decouple business logic from infrastructure. The core domain model is now defined by explicit Order and OrderItem entities with strict validation, pricing calculations, and a defined lifecycle (pending, confirmed, processing, shipped, delivered, cancelled). Additionally, a new demo seeding capability (SeedDemoOrdersUseCase, LinkDemoOrderPaymentsUseCase) allows populating the system with realistic test data, and a ShippingAddressResolver service standardizes address resolution from user defaults or explicit input.
src/modules/orders · high confidence
Behavioural changes
1 commit (0 fixes) modifying (repo-wide)
A change to existing behaviour in (repo-wide) — 1 commit, 34 files: “refactor(shared-kernel): single options-based constructor for all errors (\#411)” (refs \#411). Also in this area: Centralized environment configuration with strict validation.
src/config/validators, src/infrastructure/health · low confidence · unverified
10 commits (3 fixes) modifying src/infrastructure/logging/middleware
A change to existing behaviour in src/infrastructure/logging/middleware — 10 commits (3 fixs), 6 files: “docs: relicense the project under AGPL-3.0-only”; “docs: stay MIT and keep the CLA and SPDX headers”; “ES-118: Implement Winston-based logging and correlation ID middleware”; and 7 more (refs \#387).
src/infrastructure/logging/middleware · medium confidence · unverified
11 commits (2 fixes) modifying src/infrastructure/logging
A change to existing behaviour in src/infrastructure/logging — 11 commits (2 fixs), 4 files: “docs: relicense the project under AGPL-3.0-only”; “docs: stay MIT and keep the CLA and SPDX headers”; “ES-118: Implement Winston-based logging and correlation ID middleware”; and 8 more (refs \#387, \#411).
src/infrastructure/logging · medium confidence · unverified
11 commits (3 fixes) modifying src/modules/payments/core/application/usecases/get-payment-by-order-id
A change to existing behaviour in src/modules/payments/core/application/usecases/get-payment-by-order-id — 11 commits (3 fixs), 2 files: “docs: relicense the project under AGPL-3.0-only”; “docs: stay MIT and keep the CLA and SPDX headers”; “ES-149: Add GetPaymentByOrderIdUseCase and integrate into PaymentsController”; and 8 more (refs \#387, \#384, \#388, \#414, \#411).
src/modules/payments/core/application/usecases/get-payment-by-order-id · medium confidence · unverified
12 commits (2 fixes) modifying src/modules/authorization/secondary-adapter/repositories/postgres-role-repository
A change to existing behaviour in src/modules/authorization/secondary-adapter/repositories/postgres-role-repository — 12 commits (2 fixs), 4 files: “ES-170: Implement role creation and update functionality with enhanced permissions handling”; “docs: relicense the project under AGPL-3.0-only”; “docs: stay MIT and keep the CLA and SPDX headers”; and 9 more (refs \#414, \#411).
src/modules/authorization/secondary-adapter/repositories/postgres-role-repository · medium confidence · unverified
14 commits (2 fixes) modifying src/modules/authentication/core/application/seed
A change to existing behaviour in src/modules/authentication/core/application/seed — 14 commits (2 fixs), 4 files: “ES-174: Enhance database seeding scripts to prevent production seeding and improve logging”; “docs: relicense the project under AGPL-3.0-only”; “docs: stay MIT and keep the CLA and SPDX headers”; and 11 more (refs \#387, \#386, \#411, \#297).
src/modules/authentication/core/application/seed · medium confidence · unverified
15 commits (3 fixes) modifying src/modules/payments/core/application/usecases/get-payment
A change to existing behaviour in src/modules/payments/core/application/usecases/get-payment — 15 commits (3 fixs), 2 files: “docs: relicense the project under AGPL-3.0-only”; “ES-101: Rename Folder Structure and naming to follow Hexagonal best practices”; “docs: stay MIT and keep the CLA and SPDX headers”; and 12 more (refs \#387, \#384, \#388, \#414).
src/modules/payments/core/application/usecases/get-payment · medium confidence · unverified
17 commits (4 fixes) modifying src/filters
A change to existing behaviour in src/filters — 17 commits (4 fixs), 4 files: “ES-174: Enhance GlobalExceptionFilter to expose machine-readable error codes in production”; “ES-142: Implement handling for OptimisticLockVersionMismatchError in GlobalExceptionFilter”; “docs: relicense the project under AGPL-3.0-only”; and 14 more (refs \#413, \#387, \#412, \#384, \#388, …).
src/filters · medium confidence · unverified
2 commits (0 fixes) modifying (repo-wide)
A change to existing behaviour in (repo-wide) — 2 commits, 25 files: “refactor(shared-kernel): replace error statusCode with closed ErrorKind (\#412)”; “refactor(shared-kernel): single options-based constructor for all errors (\#411)” (refs \#412, \#411). Also in this area: New hosted demo reset endpoint with secured, idempotent seeding.
src/infrastructure/demo/core/application/usecases/reset-demo · medium confidence · unverified
2 commits (1 fix) modifying src/filters/dto
A change to existing behaviour in src/filters/dto — 2 commits (1 fix), 2 files: “fix(api): return 404 with resource NOT\_FOUND codes for missing resources (\#414)”; “docs(api): document common error codes on OpenAPI error body (\#417)” (refs \#414, \#417).
src/filters/dto · medium confidence · unverified
3 commits (1 fix) modifying src/modules/identity/core/domain/value-objects
A change to existing behaviour in src/modules/identity/core/domain/value-objects — 3 commits (1 fix), 2 files: “ES-162: Remove unused value object files for cart owner, cart total, email, phone, and stock reservation to streamline the codebase and improve maintainability”; “ES-138: Refactor Access Module to Identity and Authorization Modules”; “fix(identity): normalize email on lookup so mixed-case login works (\#416)” (refs \#416).
src/modules/identity/core/domain/value-objects · medium confidence · unverified
4 commits (1 fix) modifying src/infrastructure/demo
A change to existing behaviour in src/infrastructure/demo — 4 commits (1 fix), 10 files: “feat(demo): enhance hosted demo configuration with detailed seed accounts”; “fix(demo): viewer-only seed, read-only credentials, masked customer PII, and PII-free logs (\#387)”; “feat(auth): hosted DEMO\_READ\_ONLY viewer seed and ADMIN\_READONLY”; and 1 more (refs \#387).
src/infrastructure/demo · medium confidence · unverified
5 commits (2 fixes) modifying src/modules/authentication/core/domain/policies
A change to existing behaviour in src/modules/authentication/core/domain/policies — 5 commits (2 fixs), 4 files: “feat(orders): let shoppers cancel their own orders (\#408)”; “fix(demo): viewer-only seed, read-only credentials, masked customer PII, and PII-free logs (\#387)”; “refactor(shared-kernel): replace error statusCode with closed ErrorKind (\#412)”; and 2 more (refs \#408, \#387, \#412, \#386, \#411).
src/modules/authentication/core/domain/policies · medium confidence · unverified
6 commits (0 fixes) modifying src/modules/identity/secondary-adapters/adapters
A change to existing behaviour in src/modules/identity/secondary-adapters/adapters — 6 commits, 1 file: “docs: relicense the project under AGPL-3.0-only”; “Add authorization capabilities to identity module”; “docs: stay MIT and keep the CLA and SPDX headers”; and 3 more (refs \#412, \#411).
src/modules/identity/secondary-adapters/adapters · medium confidence · unverified
9 commits (0 fixes) modifying src/modules/orders/core/application/usecases/release-order-stock
A change to existing behaviour in src/modules/orders/core/application/usecases/release-order-stock — 9 commits, 1 file: “docs: relicense the project under AGPL-3.0-only”; “ES-102: refactor: implement gateway pattern for cross-module communication”; “ES-101: Rename Folder Structure and naming to follow Hexagonal best practices”; and 6 more (refs \#411).
src/modules/orders/core/application/usecases/release-order-stock · medium confidence · unverified
9 commits (1 fix) modifying src/modules/inventory/secondary-adapters/schedulers
A change to existing behaviour in src/modules/inventory/secondary-adapters/schedulers — 9 commits (1 fix), 2 files: “docs: relicense the project under AGPL-3.0-only”; “docs: stay MIT and keep the CLA and SPDX headers”; “feat(queue): move cron jobs to BullMQ Job Schedulers”; and 6 more (refs \#293, \#411, \#297).
src/modules/inventory/secondary-adapters/schedulers · medium confidence · unverified
Address management use cases migrated to Identity module with type support
The address management use cases (Add, Update, Delete, and Set Default) have been moved from the Access module into the Identity module's core application layer. This change introduces support for address types (e.g., HOME, WORK, SHIPPING) during creation and updates, defaulting to SHIPPING when omitted. The use cases now enforce ownership policies via \OwnedResourceAccessPolicy\, allowing admins and system callers to manage any user's addresses while restricting customers to their own. All operations utilize \findByIdForUpdate\ for optimistic concurrency control and return structured \Result\ objects with specific error types (UseCaseError, RepositoryError, DomainError) for better error handling. Also in this area: 3 commits (1 fix) modifying (repo-wide).
src/modules/identity/core/application/usecases/address · medium confidence · unverified
Authentication module restructured with new endpoints and tests
The authentication module has been reorganized into a new file structure, introducing an HTTP contract test suite for the AuthenticationController and unit tests for core use cases like registration and password changes. The controller now exposes endpoints for user registration, login, token refresh, logout, and password changes, with specific handling for refresh tokens via HttpOnly cookies. The module wiring in AuthenticationModule registers these use cases and dependencies, including credential and session token repositories, while the ChangePasswordUseCase implements logic to revoke all user sessions upon password change. Also in this area: 2 commits (0 fixes) modifying (repo-wide).
src/modules/authentication, src/modules/authentication/core/application/usecases/change-password, src/modules/authentication/core/application/usecases/register-user · medium confidence
Cached user repository with improved error handling and test coverage
The identity module now uses a dedicated CachedUserRepository that wraps the Postgres user repository with Redis caching. This implementation improves reliability by handling cache failures gracefully: if a cache lookup fails or returns null, it falls back to the database without throwing errors, and if a cache write fails after a successful database save, it logs a warning but still returns the success result. The repository now properly escapes special characters in email addresses when searching the Redis index, and includes comprehensive integration and unit tests to verify cache hit/miss behavior, save/delete operations, and error resilience.
src/modules/identity/secondary-adapters/repositories/cached-user-repository · high confidence
Cart and CartItem domain interfaces now include currency support
The core domain interfaces for carts have been updated to support multi-currency transactions. The new \ICartItem\ interface includes a \currency\ field alongside existing properties like price and quantity, and the \ICart\ interface now tracks a \currency\ field at the cart level. This allows the system to associate specific currencies with individual items and the overall cart total.
src/modules/carts/core/domain/interfaces · high confidence
Cart creation now returns presentation data and enforces permission checks
The CreateCartUseCase now returns a CartPresentationDTO containing fields such as id, userId, items, subtotal, shippingCost, totalAmount, and currency, rather than just a void or raw domain entity. It also validates that the caller has the 'manage\_own\_cart' permission and a valid userId, rejecting unauthorized attempts with a 'Not authorized to create a customer cart' error. If a cart already exists for the user, it returns that existing cart instead of creating a new one.
src/modules/carts/core/application/usecases/create-cart · high confidence
Cart item operations now enforce ownership validation and inventory checks
The AddCartItem and UpdateCartItem use cases have been refactored to strictly validate that the user owns the cart before allowing modifications, replacing previous session-token dependencies with a dedicated CartOwnershipValidator. Additionally, both operations now integrate with external product and inventory gateways to verify product existence and ensure sufficient stock availability before persisting changes, while also supporting currency and image data for new items.
src/modules/carts/core/application/usecases/add-cart-item · high confidence
Cart presentation mapper enforces strict currency validation and correct decimal conversion
The new CartPresentationMapper now strictly validates that all line items in a cart share the same currency, returning an error if mixed currencies (e.g., USD and JPY) are detected. It also correctly converts internal minor-unit prices to major-unit decimals for API responses, handling zero-decimal currencies like JPY and three-decimal currencies like KWD accurately. This ensures that users see precise, correctly formatted totals and are prevented from creating carts with incompatible currencies.
src/modules/carts/core/application/mappers · high confidence
Cart query mapping now includes currency, images, and stable item ordering
The cart query mapper now transforms raw database rows into a presentation DTO that includes per-item currency, image URLs, and SKUs, while correctly handling zero-decimal (e.g., JPY) and three-decimal (e.g., KWD) currencies. It also enforces strict validation for required fields like productName and price, and ensures line items are returned in a stable, ascending ID order to maintain consistent shopper experience even when underlying data changes.
src/modules/carts/secondary-adapters/mappers · high confidence
Cart repository interface updated to use userId and optimistic locking
The cart repository interface has been refactored to replace customer-centric identifiers with userId, aligning with the application's shift to user-based ownership. The interface now enforces optimistic concurrency control by requiring an expected version number for find and save operations, ensuring data integrity during concurrent updates. Additionally, the repository abstract class defines methods for finding carts by ID or user ID, saving carts with version checks, and deleting carts, all returning standardized Result types for error handling.
src/modules/carts/core/domain/repositories · high confidence
Cart schema migration to TypeORM with versioning and currency support
The cart persistence layer has been updated to use TypeORM entities, introducing optimistic concurrency control via a version column on the CartEntity and adding a currency field to CartItemEntity to explicitly track the currency of each item's price. These schema changes ensure data integrity through versioning and support multi-currency pricing at the item level.
src/modules/carts/secondary-adapters/orm · high confidence
Cart use cases now enforce ownership validation and return void
The ClearCart and RemoveCartItem use cases have been refactored to require a CartOwnershipValidator, ensuring that only the cart owner can modify the cart contents. Additionally, these use cases now return void instead of a result object upon success, simplifying the caller's handling of successful operations while still propagating errors via the Result type.
src/modules/carts/core/application/usecases/clear-cart, src/modules/carts/core/application/usecases/remove-cart-item · high confidence
Centralized environment configuration with strict validation
The application now uses a unified configuration system that validates environment variables at startup and exposes them through a global \EnvConfigService\. This system enforces security and operational rules: it requires HTTPS for the public base URL in production/staging, mandates the Stripe webhook secret in production/staging (unless mock auto-complete is on), blocks Swagger and mock payment auto-complete in production, and requires TLS certificate verification for Postgres in production. It also supports environment-specific \.env\ files (e.g., \.env.production\), validates CORS origins, currency codes, and JWT durations, and provides settings for logging, rate limiting, OpenTelemetry, and demo reset tokens.
src/config · high confidence
Centralized infrastructure module with logging, metrics, and throttling middleware
The application now uses a single InfrastructureModule that consolidates core services (database, Redis, queue, jobs, idempotency, JWT) and registers global middleware. On every request, MetricsMiddleware runs first to capture full request duration, followed by CorrelationIdMiddleware to establish a correlation context, and then HttpLoggingMiddleware to write logs with that context. The module also exports a DomainEventPublisher backed by EventEmitter2 for domain events, and integrates throttling and metrics modules for monitoring and rate limiting.
src/infrastructure · high confidence
Database schema overhaul and data integrity enforcement
This update introduces a comprehensive set of database migrations that establish the initial baseline schema and apply several structural and behavioral changes. The system now supports product categorization with a new categories table and associated indexes. To improve data precision, money columns across products, carts, orders, payments, and refunds have been widened to support three decimal places, and currency tracking has been added to cart items and orders. Payment processing has been refactored to support provider-neutral gateways, renaming the 'STRIPE' method to 'CARD' and enforcing strict validation. Additionally, data integrity is strengthened by requiring non-whitespace product names on order items, enforcing non-negative inventory quantities, and adding analytics query indexes for better performance.
src/migrations · high confidence
Define analytics query configuration and attention order statuses
The analytics module now exposes a dedicated policy file that centralizes query configuration constants and status definitions. Users can rely on the new \ANALYTICS\_TIMEZONE\ (set to UTC), \ANALYTICS\_MAX\_RANGE\_DAYS\ (90 days), and \ANALYTICS\_BUCKETS\ (day or week) for consistent time-series data handling. Additionally, the \ATTENTION\_ORDER\_STATUSES\ constant defines the specific order statuses ('pending\_payment', 'confirmed', 'processing') that require operator attention on the operations home page.
src/modules/analytics/core/application · high confidence
Enforced branch protection and automated Jira issue key tagging
The development workflow now prevents direct commits and pushes to main branches (master, develop, development, main), requiring developers to use feature branches and Pull Requests. Additionally, a commit-msg hook automatically prepends the Jira issue key (extracted from the branch name) to commit messages when working on feature branches, ensuring traceability without manual intervention.
.husky · high confidence
GetCartUseCase now returns 404 when cart is not found
The GetCartUseCase has been updated to explicitly return a 404 Not Found status when a requested cart does not exist, rather than potentially returning a generic error or null. This change ensures that clients receive a clear HTTP 404 response in cases where the cart ID or user ID does not correspond to an existing cart, improving error handling clarity for API consumers. The implementation also includes comprehensive tests verifying this behavior for both owned and admin-accessed carts.
src/modules/carts/core/application/usecases/get-cart · high confidence
GetOrder use case now enforces caller context and resource ownership policies
The GetOrder use case has been refactored to require a CallerContext input, enabling access control based on user roles and permissions. It now utilizes the OwnedResourceAccessPolicy to determine if the caller is authorized to view the order (e.g., admins can view all orders, customers only their own). The use case delegates data retrieval to the OrderQueryService, passing the authorized user ID when applicable, and returns a 404-style error if the order is not found or access is denied. Also in this area: 1 commit (1 fix) fixing (repo-wide); 1 commit (0 fixes) modifying (repo-wide).
src/modules/orders/core/application/usecases/get-order · medium confidence · unverified
Idempotency enforcement now requires the Idempotency-Key header
The IdempotencyInterceptor has been refactored to strictly enforce idempotency by extracting the key exclusively from the request header via shared helper functions. Requests lacking a valid Idempotency-Key header are now rejected with a 400 Bad Request error, removing support for legacy headers or body-based keys. The interceptor also improves error handling by returning a 503 Service Unavailable if the idempotency store is unavailable or if result persistence fails, and includes a Retry-After header when a request with the same key is already in progress.
src/infrastructure/interceptors · high confidence
Introduce authentication command interfaces and result structures
The authentication module now defines specific command interfaces for user registration, login, and password changes, establishing the input contracts for these core flows. Additionally, the AuthTokensResult structure has been updated to include a mustChangePassword flag and a permissions array, allowing the system to signal immediate password change requirements and return user permissions alongside access and refresh tokens.
src/modules/authentication/core/application/commands · high confidence
Introduce cart presentation DTOs with subtotal and shipping cost fields
A new result type file defines the data structures for cart presentation queries. The \CartPresentationDTO\ now explicitly includes \subtotal\ and \shippingCost\ fields alongside the existing \totalAmount\, and the \CartItemPresentationDTO\ includes a \subtotal\ field. This change exposes these specific monetary breakdowns to the application layer for cart display purposes.
src/modules/carts/core/application/queries · high confidence
Introduce gateway adapters for cross-module inventory and product communication
The cart module now communicates with other modules via dedicated gateway adapters. A new ModuleInventoryGateway implements the CartInventoryGateway port to check stock availability by delegating to the inventory module's CheckStockUseCase, while a new ModuleProductGateway implements the CartProductGateway port to fetch product details (including price, currency, and image URL) by delegating to the products module's GetProductUseCase. These adapters translate internal use-case results into the cart module's domain Result types, ensuring consistent error handling and data shape for cart operations.
src/modules/carts/secondary-adapters/adapters · high confidence
Introduce optimistic locking and new stock-release use case in Orders module
The DeliverOrder use case now uses optimistic locking (findByIdForUpdate with version checking) to prevent concurrent modification conflicts when changing an order's status to delivered. A new ReleaseOrderStock use case has been added to handle releasing inventory reservations by scheduling stock-release jobs via the OrderScheduler. These changes are part of a broader refactor to align with hexagonal architecture, standardize error handling, and improve consistency across the Orders module. Also in this area: 1 commit (1 fix) fixing (repo-wide).
src/modules/orders/core/application/usecases/deliver-order · medium confidence · unverified
Introduce typed command interfaces for user and address management
The application layer now defines explicit TypeScript interfaces for user and address commands, replacing implicit or untyped parameter handling. CreateUserCommand and UpdateUserCommand specify fields for identity data (name, email, phone), while AddAddressCommand and UpdateAddressCommand define address details including a new optional type field (AddressType), default flag, and delivery instructions. All address commands now require a CallerContext, ensuring consistent auditability and context propagation for address operations.
src/modules/identity/core/application/commands · high confidence
Inventory domain interfaces and value objects introduced
The inventory module now exposes explicit domain contracts and value objects to structure stock management. New interfaces define the shape of inventory records (IInventory), reservation records (IReservation) with their items (IReservationItem), and stock check outcomes (CheckStockResult). Value objects introduce a ReservationStatus enum (PENDING, CONFIRMED, RELEASED, EXPIRED) and a StockAdjustmentReason class with typed reasons (MANUAL\_ADJUSTMENT, RESTOCK, DAMAGE, LOST, RETURN, INVENTORY\_COUNT, CORRECTION) and helper factories, alongside a StockAdjustmentType enum (ADD, SUBTRACT, SET). These additions standardize how inventory state and adjustments are modeled internally.
src/modules/inventory/core/domain/interfaces, src/modules/inventory/core/domain/value-objects · high confidence
JWT authentication now propagates a mustChangePassword flag and enforces password rotation
The AuthGuard now attaches a mustChangePassword boolean to the request user object based on the JWT claim, and a new MustChangePasswordGuard blocks access for users flagged for password rotation. When a user's token includes mustChangePassword=true, the new guard verifies the flag against the credential repository and returns a ForbiddenException with code MUST\_CHANGE\_PASSWORD if the password has not yet been changed, while allowing access once the credential is updated or for routes marked as public or allowed during password change.
src/guards · high confidence
JWT infrastructure refactored to use shared kernel ports
The JWT module has been restructured to decouple implementation from interface by introducing port abstractions. The \JwtModule\ now registers \JwksService\ and \JwtVerifierService\ against \JwksPort\ and \JwtVerifierPort\ respectively, exporting these ports for use by other parts of the application. A new \JwksPort\ abstract class defines the contract for JWKS operations (getting public keys, JWKS data, and key IDs), ensuring that JWT handling relies on defined interfaces rather than concrete service classes.
src/infrastructure/jwt · high confidence
List Payments use case now enforces caller-based access control
The ListPaymentsUseCase has been refactored to accept a CallerContext and enforce access policies before querying. Admins can view all payments, while customers are scoped to their own payments only. The use case now delegates to PaymentQueryService and returns an empty result when access is denied. Also in this area: 2 commits (0 fixes) modifying (repo-wide).
src/modules/payments/core/application/usecases/list-payments · medium confidence · unverified
List orders use case now enforces caller context and access policies
The ListOrdersUsecase has been refactored to accept a CallerContext and apply the OwnedResourceAccessPolicy, ensuring that customers can only view their own orders while admins can view all. The use case now delegates data retrieval to the OrderQueryService and handles errors via the Result pattern, with corresponding unit tests verifying access control logic and error propagation. Also in this area: 2 commits (0 fixes) modifying (repo-wide).
src/modules/orders/core/application/usecases/list-orders · medium confidence · unverified
Login flow now includes password change requirement and user permissions in response
The LoginUserUseCase has been updated to enrich the authentication response with additional context for the client. Upon successful login, the returned token payload and result object now include a \mustChangePassword\ boolean (derived from the user's credential record) and a list of \permissions\ (resolved from the user's assigned role via the AuthorizationGateway). This allows clients to immediately enforce password rotation policies and apply fine-grained UI/feature gating based on the user's specific permissions without making a separate API call. Also in this area: 3 commits (1 fix) modifying src/modules/authentication/core/application/usecases/login-user; 1 commit adding/updating tests in (repo-wide).
src/modules/authentication/core/application/usecases/login-user · medium confidence · unverified
New job infrastructure with configurable retry policies and correlation context
The \src/infrastructure/jobs\ module now provides a structured foundation for background jobs, introducing a \BaseJobHandler\ that automatically restores correlation IDs for better log tracing and handles retry logic based on error types. A new \JobConfigService\ centralizes job ID generation and applies specific retry policies (exponential, linear, or fixed backoff) to each job type defined in \JobNames\, such as \inventory-reconciliation\, \sweep-expired-reservations\, and \simulate-mock-payment-webhook\. This change ensures that job failures are handled consistently with appropriate retry attempts and delays, while also improving observability through correlation-aware logging.
src/infrastructure/jobs · high confidence
New persistence mappers for Inventory, Reservation, and ReservationItem
The persistence layer now includes dedicated mapper classes (InventoryMapper, InventoryCacheMapper, ReservationMapper, and ReservationItemMapper) that handle the translation between domain entities and ORM schema objects. These mappers ensure consistent data transformation for inventory stock levels, reservation orders, and their associated line items, with the cache mapper specifically handling date serialization and null-safe deserialization for improved reliability.
src/modules/inventory/secondary-adapters/persistence · high confidence
Order confirmation logic now uses optimistic locking and decouples post-payment scheduling
The HandlePaymentCompleted use case has been refactored to use optimistic locking (findByIdForUpdate with version checking) when saving order state, ensuring data consistency during payment confirmation. The post-payment flow (e.g., shipping, notifications) is now scheduled as a separate, independent job via OrderScheduler, allowing it to fail or retry without affecting the core order confirmation. Additionally, the use case now handles idempotency by skipping re-processing if the order is already confirmed, and gracefully logs errors if the post-payment scheduling fails after the order is successfully saved.
src/modules/orders/core/application/usecases/handle-payment-completed · high confidence
Payment capture now publishes domain events and preserves domain errors
The CapturePaymentUseCase now publishes a 'payment.captured' domain event upon successful capture, enabling other parts of the system to react to this state change. Additionally, the use case now returns domain failures (such as 'Can only capture authorized payments') unchanged rather than wrapping them, ensuring that specific domain validation errors are preserved for the caller.
src/modules/payments/core/application/usecases/capture-payment · high confidence
Payment creation and verification now enforce caller-based access control
The CreatePayment and VerifyPayment use cases now require a caller context to enforce access policies. When creating a payment, the system verifies that the user has permission to access the associated order before proceeding with gateway authorization and persistence. Similarly, verifying a payment now checks that the caller is either an admin or the payment owner, returning a failure if access is denied. This ensures that payment operations are restricted to authorized users based on their role and resource ownership. Also in this area: 1 commit adding/updating tests in src/modules/orders/core/application/usecases/checkout, src/modules/payments/core/application/usecases/capture-payment, src/modules/payments/core/application/usecases/verify-payment; 1 commit (1 fix) fixing (repo-wide).
src/modules/payments/core/application/usecases/create-payment, src/modules/payments/core/application/usecases/verify-payment · medium confidence
PostgreSQL cart repository now supports optimistic locking and improved error handling
The PostgresCartRepository has been refactored to support optimistic concurrency control (OCC) for cart updates. When saving a cart with an expected version, the repository now performs an atomic update that checks the version and increments it, preventing lost updates from concurrent modifications. If the version does not match, a conflict error is returned. The repository also now handles cart item synchronization within transactions, ensuring that items are correctly added, updated, or removed in a single atomic operation. Error handling has been improved to provide specific error messages for not-found and conflict scenarios. Also in this area: 3 commits (1 fix) modifying (repo-wide); Cart items now include SKU and orders snapshot SKU, with stricter validation and nullable user details.
src/modules/carts/secondary-adapters/repositories/postgres-cart-repository · medium confidence · unverified
PostgreSQL user repository now supports optimistic locking for concurrent updates
The PostgresUserRepository has been updated to handle concurrent modifications safely using optimistic locking. When saving a user with an \expectedVersion\, the repository performs an atomic update that checks the current database version; if the versions match, the user and their associated addresses are updated and the version is incremented. If the versions do not match (indicating a concurrent change), the save fails with a conflict error rather than silently overwriting data. This change also includes comprehensive integration and unit tests to verify the locking behavior, address synchronization, and error handling for both new and existing users. Also in this area: 4 commits (2 fixes) modifying src/modules/identity, src/modules/identity/core/application/usecases/user.
src/modules/identity/secondary-adapters/repositories/postgres-user-repository · medium confidence · unverified
Postgres inventory repository refactored with enhanced query capabilities and optimistic locking
The Postgres inventory repository has been restructured to support advanced inventory operations, including batch queries, low-stock filtering, and optimistic concurrency control. Users can now retrieve inventory in batches or filter by stock levels, while save operations enforce version checks to prevent concurrent modification conflicts. The repository also provides improved error handling with specific HTTP status codes for not-found scenarios and includes comprehensive unit and integration tests to verify these new behaviors. Also in this area: 3 commits (1 fix) modifying (repo-wide).
src/modules/inventory/secondary-adapters/repositories/postgres-inventory-repository · medium confidence · unverified
Process refund use case now enforces idempotency and provider-specific validation
The ProcessRefundUseCase now requires an idempotency key when calling the payment provider, generated automatically based on the payment ID and existing refund count, to prevent duplicate refund processing. It also validates that the refund amount is positive, does not exceed the remaining payment amount, and matches the payment's provider, returning specific errors for invalid amounts, missing transaction IDs, or provider mismatches. Additionally, the use case publishes a 'payment.refunded' domain event upon successful completion and handles idempotent retries for already-refunded payments without calling the provider again.
src/modules/payments/core/application/usecases/process-refund · high confidence
ProcessOrder use case now uses optimistic locking for state transitions
The ProcessOrder use case has been refactored to use optimistic locking when updating order status. It now calls findByIdForUpdate to retrieve the order with its current version, performs the state transition via the domain entity's process() method, and then saves the order using the expected version. This ensures that concurrent modifications to the same order are detected and rejected, preventing lost updates. The use case also validates that the order is in a processable state (confirmed) before proceeding, returning a failure if the order is not found, not confirmed, or if the save operation fails due to version mismatch. Also in this area: 1 commit (1 fix) fixing (repo-wide).
src/modules/orders/core/application/usecases/process-order · medium confidence · unverified
Product activation now requires a valid category
The new ActivateProductUseCase enforces that a product must have a category assigned before it can be activated. If a product lacks a category, the operation fails with a BAD\_REQUEST error and the message 'Cannot activate a product without a category'. The use case also correctly handles cases where the product is already active or not found, preventing unintended state changes.
src/modules/products/core/application/usecases/activate-product · high confidence
Product creation and updates now validate categories and currencies
The CreateProduct and UpdateProduct use cases now enforce stricter validation before persisting changes. When creating a product, the system requires a valid categoryId and validates that the currency is a supported, 3-letter ISO 4217 code (normalizing lowercase inputs to uppercase). When updating a product, the system rejects null category IDs, validates that any provided category ID exists and is active, and validates currency codes if a currency change is requested. These changes ensure data integrity by preventing products from being saved with missing categories or unsupported currencies.
src/modules/products/core/application/usecases/create-product, src/modules/products/core/application/usecases/update-product · high confidence
Refactor cart item persistence to omit unset child IDs
The infrastructure mappers now ensure that unset or legacy child IDs are not persisted to the database. A new utility function, \stripUnsetChildId\, is introduced to remove the \id\ property from cart items when it is null, undefined, or a legacy zero value, preventing invalid data from being written during persistence. This change is supported by new type definitions (\CreateFromEntity\ and \UpdateFromEntity\) that enforce stricter typing for entity creation and optimistic-lock updates, ensuring that application-controlled fields are explicitly handled while excluding identity and version columns.
src/infrastructure/mappers · high confidence
Refactored GetUserUseCase to use UserQueryService and access policies
The GetUserUseCase now retrieves user data via the new UserQueryService instead of direct repository access, and enforces access control through the OwnedResourceAccessPolicy. This ensures that customers can only view their own profiles, while admins and system callers can view any user profile, returning a clear 'not found' error for unauthorized access attempts.
src/modules/identity/core/application/usecases/user/get-user · high confidence
Refactored cart persistence mappers to support currency and stable item ordering
The cart persistence layer has been updated with new mapper implementations that explicitly handle currency fields on cart items and ensure line items are stored and retrieved in a stable order. The CartItemMapper now maps currency data and uses a utility to omit unset child IDs during persistence, while the CartMapper sorts items by ID when loading from the database to maintain consistent ordering. Additionally, a new CartCacheMapper was introduced to handle serialization of cart data for caching, converting date objects to timestamps and handling potential deserialization errors gracefully.
src/modules/carts/secondary-adapters/persistence · high confidence
Refactored queue infrastructure to use shared BullMQ connection and improved shutdown handling
The queue infrastructure in src/infrastructure/queue has been reorganized to introduce a dedicated BullMQ connection module (BullMqConnectionModule) that centralizes connection options via a shared token (BULLMQ\_CONNECTION\_OPTIONS), ensuring consistent configuration across QueueModule, FlowProducer, and QueueEvents. New services include FlowProducerService for managing flow-based job production and QueueEventsService for handling queue events (failed, completed) with proper lifecycle management. Both services now implement OnApplicationShutdown to ensure graceful closure of connections and event listeners during application shutdown, replacing previous module-destroy patterns for more reliable resource cleanup.
src/infrastructure/queue · high confidence
Refactored user listing to use UserQueryService with access control
The ListUsersUseCase now delegates data retrieval to a dedicated UserQueryService instead of direct repository access, and enforces access policies via OwnedResourceAccessPolicy to filter results based on the caller's context and permissions. This change improves separation of concerns and ensures that users only see data they are authorized to access, while maintaining paginated result handling.
src/modules/identity/core/application/usecases/user/list-users · high confidence
Refined cart API request and response structures
The cart module's primary adapters now use updated Data Transfer Objects that enforce stricter input validation and expose more detailed financial data. Request DTOs for adding and updating cart items now require positive integer quantities. Response DTOs have been expanded to include per-item subtotals, currency codes, and product images, while the main cart response now explicitly exposes subtotal, shipping cost (currently fixed at 0), and total amount fields to provide clearer pricing information to clients.
src/modules/carts/primary-adapters · high confidence
Refined order cancellation logic with refund handling and saga compensation
The CancelOrderUseCase now explicitly handles refunds for paid orders by scheduling a refund payment when an order is cancelled, ensuring that customers are reimbursed for completed transactions. It also supports saga compensation flows, publishing specific domain events when cancellation is part of a broader checkout compensation sequence. Additionally, the use case now schedules stock release for cancelled orders and includes improved error logging for scheduling failures. A new HandlePaymentFailedUseCase has been introduced to manage payment failure scenarios, marking orders as failed and independently scheduling stock release.
src/modules/orders/core/application/usecases/cancel-order · high confidence
Resilient rate limiting with user-specific tracking and Redis fallback
The throttling infrastructure now includes a ResilientThrottlerStorage that automatically falls back to in-memory storage if the Redis connection is unavailable or fails, ensuring rate limiting continues to function (albeit with per-instance limits) during outages. A new UserThrottlerGuard enables user-specific rate limiting by tracking requests against user IDs rather than just IP addresses, which prevents shared-client scenarios (like E2E tests) from causing cascading blocks. Additionally, specific throttle constants for authentication endpoints (login, register, password change) have been introduced to enforce stricter limits on sensitive routes.
src/infrastructure/throttler · high confidence
Revoke all sessions on refresh token reuse
The RefreshTokenUseCase now detects when a refresh token is used more than once (token reuse) and automatically revokes all active sessions for that user. This security enhancement ensures that if a refresh token is compromised and replayed, the attacker's session is invalidated along with any other active sessions, forcing re-authentication across all devices. The use case also integrates credential management to include password change requirements and user permissions in the returned token payload.
src/modules/authentication/core/application/usecases/refresh-token · high confidence
Role-based visibility filtering for product listings
The ListProductsUseCase now enforces catalog visibility policies based on the user's role. Unauthenticated users and customers are restricted to viewing only active products (isActive: true), while operators with the VIEW\_ALL\_PRODUCTS\_PERMISSION can view all products regardless of status. This ensures that inactive items are hidden from general shoppers while remaining accessible to administrators.
src/modules/products/core/application/usecases/list-products · high confidence
Role-based visibility for product retrieval
The GetProductUseCase now enforces catalog visibility policies based on the caller's role. Shoppers without the 'view\_all\_products' permission will receive a 404 error when attempting to access inactive products, while operators with the appropriate permission can still retrieve them. This change ensures that inactive products are hidden from general users while remaining accessible to authorized administrative users.
src/modules/products/core/application/usecases/get-product · high confidence
User query adapter now supports role-based filtering and detailed address retrieval
The PostgresUserQueryAdapter in the identity module now implements the UserQueryService interface, enabling users to filter user lists by role code (e.g., 'CUSTOMER') in addition to existing search, pagination, and active status filters. When retrieving a specific user's details, the adapter now joins with the authorization context to resolve role codes and fetches associated addresses, ordering them by default status and creation date. This change provides a more comprehensive view of user data, including their assigned roles and address history, directly through the query layer.
src/modules/identity/secondary-adapters/query · high confidence
Versioned cache key management and automatic recovery on Redis reconnection
The Redis infrastructure now supports cache generation versioning to handle stale data after Redis outages. Domain-specific cache keys (e.g., product, user, order) are prefixed with a generation number (e.g., \c1:\), while stable keys like idempotency tokens and metadata remain unchanged. A new \RedisCacheRecoveryService\ listens for Redis reconnection events; upon reconnection, it increments the cache generation, drops RediSearch indexes from the previous generation, clears cached flags, and reinitializes indexes. This ensures that stale cache-aside data is invalidated and the system repopulates the cache on demand with fresh data, while metrics track any recovery failures.
src/infrastructure/redis · high confidence
WebSocket connection handling and authentication restructured
The WebSocket infrastructure has been refactored to improve connection management and shutdown behavior. A new \WsAuthGuard\ has been introduced to centralize authentication logic for WebSocket clients, attaching the authenticated user payload to the socket object upon successful validation. The \WebsocketConnectionGateway\ now implements the \BeforeApplicationShutdown\ lifecycle hook, ensuring that all active WebSocket clients are gracefully disconnected when the application shuts down, which resolves previous race conditions and double-close issues. Additionally, the module structure has been updated to import from \AuthenticationModule\ instead of the legacy \Auth\ module, and the gateway now explicitly joins users to private rooms based on their user ID upon connection.
src/infrastructure/websocket · high confidence
Fixes
1 commit (1 fix) fixing src/modules/identity/core/application/services
A fix in src/modules/identity/core/application/services — 1 commit (1 fix), 1 file: “fix(api): return 404 with resource NOT\_FOUND codes for missing resources (\#414)” (refs \#414).
src/modules/identity/core/application/services · medium confidence · unverified
4 commits (3 fixes) fixing src/modules/orders/core/application/usecases/create-order-payment
A fix in src/modules/orders/core/application/usecases/create-order-payment — 4 commits (3 fixs), 2 files: “fix(orders): charge the owned order total when creating a payment (\#306)”; “fix(orders): expose one order total field and remove totalPrice (\#422)”; “fix(api): return 404 with resource NOT\_FOUND codes for missing resources (\#414)”; and 1 more (refs \#306, \#422, \#414, \#316).
src/modules/orders/core/application/usecases/create-order-payment · medium confidence · unverified
Inventory cache is now evicted after reservation writes
The CachedReservationRepository now automatically invalidates cached inventory data whenever a reservation is saved, released, confirmed, or expired. This ensures that subsequent reads of inventory levels reflect the most recent reservation activity, preventing users from seeing stale stock counts. The implementation safely handles cache unavailability and write failures without disrupting the reservation process.
src/modules/inventory/secondary-adapters/repositories/cached-reservation-repository · high confidence
Inventory stock checks now use numeric comparison to prevent quantity errors
The Inventory entity's stock availability checks (such as isInStock) now correctly compare quantities numerically. Previously, string-based comparisons could incorrectly evaluate stock levels (e.g., treating 79 as less than 8). This fix ensures that stock queries and reservation logic accurately reflect available inventory, preventing false 'out of stock' errors or over-reservations. The change is accompanied by new unit tests for Inventory, Reservation, and ReservationItem entities to verify these behaviors.
src/modules/inventory/core/domain/entities · high confidence
Test coverage
Added Redis testing utilities and mocks; Added authentication module test mocks; Added mock JWT verifier for testing; Added mock implementation for AnalyticsQueryService; Added mock implementations for cart testing infrastructure; Added mock implementations for inventory testing; Added test factories and builders for inventory module testing; Added test factories and builders for the cart module; Added test factories for authentication module DTOs; Added test factories for user and address entities; Added test mocks for identity module components; Added testing utilities and mocks for the authentication module; Added testing utilities for carts and inventory modules; Added testing utilities for the notifications module; Added tests for the Confirm Order use case; Expanded end-to-end and architecture test coverage; New centralized testing utilities and mock infrastructure.
Dependencies
Initial dependency manifest for NestJS 12 ecommerce API
The project now includes a \package.json\ and \package-lock.json\ defining the initial dependency set for the ecommerce-store-api. This establishes a runtime on Node.js 24+ and NestJS 12, integrating PostgreSQL via TypeORM, Redis and BullMQ for background job processing, and Socket.IO for real-time communication. Security and observability are addressed through Helmet, JWT handling via Jose, and OpenTelemetry instrumentation, while development workflows are supported by Vitest, ESLint, and Docker-based environment management scripts.
(dependencies) · high confidence
Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
This is the PUBLIC form of this artifact. Findings are listed in full, but the details of SECURITY findings — which rule fired, in which file, on which line, and how to fix it — are deliberately withheld, and any secret-scanner results are excluded entirely. Where detail is absent here it was REMOVED FOR PUBLICATION; it is not missing from the analysis. The complete artifact is available from the repository owner.
Score
- CAI 53 → 57 (+4.0)
- Rubric changed (rubric-2026.10.5 → rubric-2026.11.2) — scores are not directly comparable.
Lenses
- Code Health 54 → 54 (+0.5)
- Architecture 59 → 58 (-1.7)
- Maturity 55 → 84 (+29.6)
- Readiness 48 → 55 (+6.9)
- Security 69 → 66 (-2.7)
- Domain Modelling 70 → 62 (-7.9)
- Performance 100 → 100 (+0.0)
Resolved (181)
- ADR not followed: ADR-0004: Inventory Data Integrity, Concurrency & Schema Optimization (docs/architecture/adr/ADR-0004-inventory-integrity-and-concurrency.md)
- ADR not followed: ADR-0005: Typed Atomic OCC Update Contract (docs/architecture/adr/ADR-0005-typed-atomic-occ-update-contract.md)
- ADR not followed: ADR-0006: Redis Fail-Open Cache-Aside & Key-Space Generation (docs/architecture/adr/ADR-0006-redis-fail-open-cache-aside.md)
- ADR not followed: ADR-0009: Hosted Demo Reset as Ops Infrastructure (docs/architecture/adr/ADR-0009-demo-reset-ops-infrastructure.md)
- Boundary-crossing change coupling: cached-inventory-repository.ts ↔ cached.product-repository.ts (src/modules/inventory/secondary-adapters/repositories/cached-inventory-repository/cached-inventory-repository.ts)
- Boundary-crossing change coupling: cached-user.repository.ts ↔ cached-inventory-repository.ts (src/modules/identity/secondary-adapters/repositories/cached-user-repository/cached-user.repository.ts)
- Boundary-crossing change coupling: cached-user.repository.ts ↔ cached.product-repository.ts (src/modules/identity/secondary-adapters/repositories/cached-user-repository/cached-user.repository.ts)
- Boundary-crossing change coupling: cached.cart-repository.ts ↔ cached-inventory-repository.ts (src/modules/carts/secondary-adapters/repositories/cached-cart-repository/cached.cart-repository.ts)
- Boundary-crossing change coupling: cached.cart-repository.ts ↔ cached.product-repository.ts (src/modules/carts/secondary-adapters/repositories/cached-cart-repository/cached.cart-repository.ts)
- Checkable ADR rule enforced only by prose: ADR-0009: Hosted Demo Reset as Ops Infrastructure (docs/architecture/adr/ADR-0009-demo-reset-ops-infrastructure.md)
- Deprecated: glob (package-lock.json)
- High CVE: [GHSA redacted] (package-lock.json)
- Leaked secret: hardcoded-credential (src/modules/authentication/core/application/seed/seed-demo-auth-users.usecase.ts)
- Low coverage: src/config/config.module.ts (src/config/config.module.ts)
- Low coverage: src/config/configuration.ts (src/config/configuration.ts)
- Low coverage: src/config/env-config.service.ts (src/config/env-config.service.ts)
- Low coverage: src/config/resolve-env-file-path.ts (src/config/resolve-env-file-path.ts)
- Low coverage: src/infrastructure/database/database.module.ts (src/infrastructure/database/database.module.ts)
- Low coverage: src/infrastructure/database/number.transformer.ts (src/infrastructure/database/number.transformer.ts)
- Low coverage: src/infrastructure/demo/secondary-adapters/adapters/demo-seed-runner.adapter.ts (src/infrastructure/demo/secondary-adapters/adapters/demo-seed-runner.adapter.ts)
- …and 161 more
New (55)
- Classify ADR enforcement: ADR-0004: Inventory Data Integrity, Concurrency & Schema Optimization (docs/architecture/adr/ADR-0004-inventory-integrity-and-concurrency.md)
- Classify ADR enforcement: ADR-0005: Typed Atomic OCC Update Contract (docs/architecture/adr/ADR-0005-typed-atomic-occ-update-contract.md)
- Classify ADR enforcement: ADR-0006: Redis Fail-Open Cache-Aside & Key-Space Generation (docs/architecture/adr/ADR-0006-redis-fail-open-cache-aside.md)
- Classify ADR enforcement: ADR-0007: Admin Analytics as Query-Only Composition Module (docs/architecture/adr/ADR-0007-admin-analytics-query-composition.md)
- Classify ADR enforcement: ADR-0008: Money Snapshot, Cart Domain Currency Boundaries, and CQRS Separation (docs/architecture/adr/ADR-0008-money-snapshot-and-store-currency.md)
- Classify ADR enforcement: ADR-0009: Hosted Demo Reset as Ops Infrastructure (docs/architecture/adr/ADR-0009-demo-reset-ops-infrastructure.md)
- GlobalExceptionFilter.catch (cognitive 21) (src/filters/global-exception.filter.ts)
- High secret: WD-SECRET-0005 (src/config/validate-env.ts)
- High secret: WD-SECRET-0005 (src/modules/authentication/core/application/seed/seed-demo-auth-users.usecase.ts)
- High: security finding (details withheld)
- Hotspot: src/modules/authentication/core/application/usecases/change-password/change-password.usecase.ts (src/modules/authentication/core/application/usecases/change-password/change-password.usecase.ts)
- Hotspot: src/modules/payments/core/application/usecases/create-payment-intent/create-payment-intent.usecase.ts (src/modules/payments/core/application/usecases/create-payment-intent/create-payment-intent.usecase.ts)
- Hotspot: src/modules/payments/core/application/usecases/process-refund/process-refund.usecase.ts (src/modules/payments/core/application/usecases/process-refund/process-refund.usecase.ts)
- Hotspot: src/modules/payments/secondary-adapters/query/postgres-payment-query.adapter.ts (src/modules/payments/secondary-adapters/query/postgres-payment-query.adapter.ts)
- Leaked secret: hardcoded-credential (package-lock.json)
- Low CVE: [GHSA redacted] (package-lock.json)
- Medium CVE: [GHSA redacted] (package-lock.json)
- Medium CVE: [GHSA redacted] (package-lock.json)
- Medium CVE: [GHSA redacted] (package-lock.json)
- Medium CVE: [GHSA redacted] (package-lock.json)
- …and 35 more
Changes since last survey
- 93 commits — 78 feature/other, 15 fixes
By area
- (repo) — 36 commits
- (root) — 32 commits
- src/modules — 18 commits
- src/filters — 2 commits
- .github/dependabot.yml — 1 commit
- .github/workflows — 1 commit
- docs/data — 1 commit
- src/infrastructure — 1 commit
- src/shared-kernel — 1 commit
Notable commits
- fix: Merge pull request #370 from raouf-b-dev/fix/nestjs-12.3.2-audit
- fix: Merge pull request #371 from raouf-b-dev/fix/typeorm-1.1.2
- fix: fix(api): return 404 with resource NOT_FOUND codes for missing resources (#414)
- fix: fix(api): uppercase codes for 401, 403 and 429 (#413)
- fix: fix(authorization): sync permission descriptions on boot (#421)
- fix: fix(demo): harden hosted demo seed and fix release review items (#386)
- fix: fix(demo): viewer-only seed, read-only credentials, masked customer PII, and PII-free logs (#387)
- fix: fix(deps): adapt to typeorm 1
- fix: fix(deps): align engines.node with typeorm 1.1.2 (>=24.11.0)
- fix: fix(deps): bump NestJS to 12.3.2 and body-parser to 2.4.0
- fix: fix(identity): normalize email on lookup so mixed-case login works (#416)
- fix: fix(orders): expose one order total field and remove totalPrice (#422)
- fix: fix(orders): refund surplus payments per payment (#409)
- fix: fix(orders): return REFUND_AMOUNT_INVALID when a cancel has nothing to refund (#420)
- fix: fix: QA follow-ups from #384 (#388)
- change: Merge branch 'master' into dependabot/npm_and_yarn/fast-uri-3.1.9
- change: Merge branch 'master' into dependabot/npm_and_yarn/master/dotenv-18.0.8
- change: Merge branch 'master' into dependabot/npm_and_yarn/master/production-deps-9c81f57514
- change: Merge branch 'master' into dependabot/npm_and_yarn/undici-8.12.3
- change: Merge master into chore/sync-master-into-develop-2
- …and 73 more
Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
raouf-b-dev/ecommerce-store-api was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 9 November 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit 0470229729f7b5241c1ffc5e038d25cd4982b0c4 — the exact code this score is about.
- Scored under rubric-2026.11.2 — the same rubric and the same method as every other entry in this index.
- Measured by Canine Code Analyzer (cca.canine.dev) using cca measure-2026.11.3+preprod-bb0cb800cd0f.