Skip to content
CAI
Software that uses CAICheck a score

MehrdadShirvani/AlibabaClone-Backend

46.9

Weak · 20 September 2026

3.8k

lines of production code

C#

primary language

4

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

This system is a .NET 8 backend service for a transportation ticketing platform, structured using Clean Architecture to manage user accounts, vehicle logistics, and ticket sales. It provides core capabilities for user authentication, profile management, and financial operations such as wallet top-ups and transaction tracking. The system facilitates the booking workflow by allowing users to search for transportation options, validate discount coupons, and purchase tickets with specific seat assignments. Additionally, it handles the generation of PDF tickets and maintains a comprehensive history of user transactions and travel records.

Features

Add BaseRepository and UnitOfWork implementations

The AlibabaClone.Infrastructure/Framework area now includes concrete implementations for data access patterns: a generic BaseRepository class that implements IRepository, providing standard CRUD operations (Add, GetById, GetAll, Update, Remove, Find) via Entity Framework Core, and a UnitOfWork class implementing IUnitOfWork to manage database context lifecycle and save changes. These components establish the foundational infrastructure for repository-based data access within the application.

AlibabaClone.Infrastructure/Framework · high confidence

Add City, Location, and LocationType domain entities

Introduced three new domain entities—City, Location, and LocationType—to model geographic hierarchy and location classification. City and LocationType are defined with virtual navigation collections to support lazy loading, while Location includes foreign keys (CityId as int, LocationTypeId as short) and virtual references to both parent entities, along with virtual collections for departing and arriving transportations.

AlibabaClone.Domain/Aggregates/LocationAggregates · high confidence

Add Company domain entity

A new Company entity has been introduced within the CompanyAggregates aggregate root. This entity includes a required Title property and maintains a one-to-many relationship with Transportation entities, allowing a company to be associated with multiple transportation records.

AlibabaClone.Domain/Aggregates/CompanyAggregates · high confidence

Add Entity Framework Core configurations for Location and Vehicle aggregates

New Entity Framework Core mapping files have been added to define the database schema for the Location and Vehicle domains. The Location aggregate now includes configurations for City, Location, and LocationType, establishing required relationships and unique indexes on titles. The Vehicle aggregate adds configurations for Vehicle, VehicleType, and Seat, enforcing required fields, unique plate numbers, and restricting delete behaviors on foreign keys to ensure data integrity.

AlibabaClone.Infrastructure/Configurations/LocationAggregates, AlibabaClone.Infrastructure/Configurations/VehicleAggregates · high confidence

Add JWT token generation and user context extraction

The API now includes a new JWT generation pipeline and user context service. A \JwtGenerator\ implementation creates tokens containing the user ID, phone number, and roles, configured via a new \JwtSettings\ class. Additionally, a \UserContext\ service extracts the authenticated user's ID from the incoming request's security claims, enabling downstream components to identify the current user.

AlibabaClone.WebAPI/Authentication · high confidence

Add PDF ticket generation service

The infrastructure layer now includes a PdfGenerator service that implements the IPdfGenerator interface using the QuestPDF library. This service generates PDF documents for ticket orders, formatting each ticket into an A4 page with details such as order ID, route, seat number, date/time, price, and traveler information (name, phone, national ID) presented in structured tables.

AlibabaClone.Infrastructure/Services · high confidence

Add Result and ResultStatus types

Introduces a new Result\<T\> class and ResultStatus enum in the Application layer to standardize operation outcomes. The Result class provides factory methods for Success, Error, NotFound, and Unauthorized states, allowing callers to easily handle different response scenarios with associated error messages.

AlibabaClone.Application/Result · high confidence

Add authentication request and response DTOs

Introduced new Data Transfer Objects for the authentication flow: LoginRequestDto and RegisterRequestDto define the input structure for user login and registration, with RegisterRequestDto including validation attributes for phone number format, password length, and confirmation matching. AuthResponseDto defines the structure returned after successful authentication, including user ID, token, phone number, and roles.

AlibabaClone.Application/DTOs/Authentication · high confidence

Add configuration for Transaction, TransactionType, and Coupon entities

This change introduces Entity Framework Core configuration classes for the Transaction, TransactionType, and Coupon aggregates within the TransactionAggregates folder. The Transaction configuration defines required fields for transaction type, account, and financial amounts, along with one-to-one and one-to-many relationships to TicketOrder, Account, Coupon, and TransactionType. The TransactionType configuration establishes a unique title constraint, while the Coupon configuration enforces a unique code and specifies decimal precision for discount amounts and percentages.

AlibabaClone.Infrastructure/Configurations/TransactionAggregates · high confidence

Add repository implementations for Coupon and Transaction aggregates

The infrastructure layer now includes concrete repository classes for the Coupon and Transaction domain aggregates. CouponRepository implements ICouponRepository, providing methods to retrieve coupons by code and track usage statistics (total and per-account). TransactionRepository implements ITransactionRepository, adding the GetAllByAccountIdAsync method to fetch a buyer's transaction history along with related ticket orders and transaction types.

AlibabaClone.Infrastructure/Services/TransactionAggregates · high confidence

Add repository implementations for Transportation, Ticket, and TicketOrder aggregates

New repository classes (TransportationRepository, TicketRepository, TicketOrderRepository, TicketStatusRepository) have been added to the Infrastructure layer to implement domain repository interfaces. These implementations provide data access methods for the transportation aggregates, including searching for transportations by vehicle type, origin/destination cities, and date range, retrieving ticket orders by buyer ID with related transaction and transportation details, and fetching tickets by order ID with traveler and seat information.

AlibabaClone.Infrastructure/Services/TransportationAggregates · high confidence

New Data Transfer Objects have been introduced in the Transaction namespace to support coupon validation and transaction data exchange. CouponValidationRequestDto allows clients to submit a coupon code and original price for validation, while DiscountDto returns the validation result including validity status, message, and discount amount. TransactionDto defines the structure for transaction records, including identifiers (Id, TicketOrderId, CouponId), transaction type details, amounts (BaseAmount, FinalAmount), and a unique SerialNumber.

AlibabaClone.Application/DTOs/Transaction · high confidence

Add vehicle domain entities for seat and type management

Introduces new domain entities \Seat\, \Vehicle\, and \VehicleType\ within the \VehicleAggregates\ namespace. \Vehicle\ serves as the central aggregate root, linking to a \VehicleType\ and containing collections of \Seat\ and \Transportation\ entities. \Seat\ defines specific seating attributes such as row, column, VIP status, and availability, while \VehicleType\ categorizes vehicles. All navigation properties are marked as virtual to support ORM lazy loading.

AlibabaClone.Domain/Aggregates/VehicleAggregates · high confidence

Added domain enums for transport, transactions, and user roles

The domain layer now includes several new enumeration types to support core business concepts. These include VehicleTypeEnum (Bus, Train, Airplane, Ship, Metro), LocationTypeEnum (BusTerminal, TrainStation, Airport, Seaport, MetroStation), TicketStatusEnum (Reserved, Paid, CancelledByUser, CancelledBySystem, Used, Expired), TransactionTypeEnum (Deposit, Withdraw), GenderEnum (Female, Male), and RoleEnum (User). These enums provide structured values for modeling transport modes, locations, ticket lifecycle states, financial transactions, user demographics, and system roles within the AlibabaClone domain.

AlibabaClone.Domain/Enums · high confidence

Added password hashing and verification utility

A new PasswordHasher utility class has been added to the application's Utils folder, providing static methods to hash and verify passwords. The implementation uses PBKDF2 with SHA-256, a 16-byte random salt, and 100,000 iterations to securely hash passwords, allowing users to have their credentials protected with a standard, robust algorithm.

AlibabaClone.Application/Utils · high confidence

Define Entity Framework Core configurations for transportation domain aggregates

This change introduces the Entity Framework Core mapping configurations for the core transportation domain entities within the Infrastructure layer. It adds configuration classes for Company, Transportation, Ticket, TicketOrder, and TicketStatus, establishing the database schema structure. Key details include defining primary keys, required properties, unique indexes (such as on SerialNumber and Title), and foreign key relationships with restrictive delete behaviors. Specifically, the Transportation configuration marks EndDateTime as optional and ignores the RemainingCapacity property, indicating it is a calculated field rather than a stored column.

AlibabaClone.Infrastructure/Configurations/TransportationAggregates · high confidence

Implement vehicle aggregate repositories

Added concrete repository implementations for the Vehicle aggregate, including SeatRepository, VehicleRepository, and VehicleTypeRepository. The SeatRepository introduces a new GetSeatsByVehicleId method that retrieves seats along with their associated vehicle and ticket traveler details, while the other repositories provide standard data access for Vehicle and VehicleType entities.

AlibabaClone.Infrastructure/Services/VehicleAggregates · high confidence

Initial API startup configuration and service registration

The AlibabaClone.WebAPI entry point (Program.cs) has been established to configure the application lifecycle. This includes registering a comprehensive set of domain repositories and application services via dependency injection, configuring SQL Server database context with environment-based connection strings, and setting up JWT authentication with strict lifetime validation. The API also enables Swagger/OpenAPI documentation for development, applies database migrations and seeds initial data at startup, and configures CORS policies using environment variables.

AlibabaClone.WebAPI · high confidence

Initial Entity Framework Core configurations for Account Aggregates

This change introduces the Entity Framework Core mapping configurations for the Account Aggregates root entities and their related lookup types. It defines the schema for Account (including phone, password, email, and balance), Person (with identity details and gender/creator relationships), AccountRole (many-to-many join), BankAccountDetail (one-to-one with Account), and lookup tables for Gender and Role. These configurations establish the database structure for user accounts, personal profiles, and role assignments.

AlibabaClone.Infrastructure/Configurations/AccountAggregates · high confidence

Initial database seeding for reference data

The application now includes a DBInitializer that populates the database with essential reference data on startup. This ensures that required lookup values for Genders, LocationTypes, Roles, TicketStatuses, TransactionTypes, and VehicleTypes are available immediately, preventing errors when the application attempts to access these entities before they are manually created.

AlibabaClone.Infrastructure/Seeders · high confidence

Initial project scaffolding with Clean Architecture and Docker support

The repository is initialized with a .NET 8 backend structured around Clean Architecture, featuring distinct layers for Presentation (WebAPI), Application, Domain, and Infrastructure. A Dockerfile and .dockerignore are added to enable containerized builds and runtime using the .NET 8 SDK and ASP.NET Core images, exposing port 80. Developer tooling is configured via an .editorconfig enforcing C\# naming and style conventions, and .gitignore rules are established to exclude build artifacts, IDE settings, and sensitive configuration files like appsettings.json and .env.

(repo-wide) · high confidence

Introduce AutoMapper profiles for domain-to-DTO mapping

Added a new MappingProfile that configures AutoMapper to convert domain entities (Transportation, City, Account, TicketOrder, Ticket, Person, Transaction, Seat) into their corresponding DTOs (TransportationSearchResultDto, CityDto, AccountDto, ProfileDto, TicketOrderSummaryDto, TravelerTicketDto, PersonDto, TransactionDto, TransportationSeatDto). This enables consistent object mapping across the application layer, including handling nested properties, null checks, and specific field transformations like extracting vehicle titles or calculating reserved seat status.

AlibabaClone.Application/Mappers · high confidence

Introduce account, person, and role domain aggregates

This change introduces the core domain entities for user management within the AlibabaClone.Domain.Aggregates.AccountAggregates namespace. It adds the Account aggregate with support for balance management (deposit/withdraw), bank account details, and role assignments via AccountRole. It also defines the Person entity to store personal identification details, gender, and travel history, linked to the creating Account. Supporting entities such as Role, Gender, and BankAccountDetail are included to complete the user profile and authentication model.

AlibabaClone.Domain/Aggregates/AccountAggregates · high confidence

Introduce core API controllers for authentication, account management, and ticketing

This release adds the primary API endpoints for the AlibabaClone platform, introducing controllers for authentication (AuthController), user account management (AccountController), city lookup (CityController), coupon validation (CouponController), ticket ordering (TicketOrderController), and transportation search (TransportationController). Users can now register and log in to receive JWT tokens, manage their profile and payment details, search for transportation options, view available seats, create ticket orders, and download PDF tickets.

AlibabaClone.WebAPI/Controllers · high confidence

Introduce domain models for transactions, coupons, and transaction types

Added new domain entities to the TransactionAggregates area: Transaction, Coupon, and TransactionType. The Transaction entity now tracks account, ticket order, and coupon associations, along with transaction type, amounts, and serial numbers. The Coupon entity includes validation for expiration via an IsExpired method and tracks usage limits. The TransactionType entity provides a simple title-based classification for transactions.

AlibabaClone.Domain/Aggregates/TransactionAggregates · high confidence

Introduce transportation booking and search DTOs

Added a new set of Data Transfer Objects in the AlibabaClone.Application/DTOs/Transportation folder to support the transportation booking workflow. This includes CreateTicketOrderDto and CreateTravelerTicketDto for submitting new orders with traveler details, TransportationSearchRequestDto and TransportationSearchResultDto for querying available trips, and supporting DTOs like TransportationSeatDto, TravelerTicketDto, and TicketOrderSummaryDto to represent seat availability, issued tickets, and order summaries.

AlibabaClone.Application/DTOs/Transportation · high confidence

Introduce transportation domain entities for ticketing

Added new domain entities to the Transportation aggregate: Ticket, TicketOrder, TicketStatus, and Transportation. The Transportation entity now tracks start and end dates, base and VIP pricing, and calculates remaining capacity based on active tickets. TicketOrder links a buyer to a transportation service and its associated tickets, while Ticket represents an individual seat assignment with status and serial number. TicketStatus provides a lookup for ticket states.

AlibabaClone.Domain/Aggregates/TransportationAggregates · high confidence

Introduces Domain Framework with generic repositories and unit of work

The AlibabaClone.Domain/Framework layer now provides a standardized data access foundation. It defines a generic IRepository interface with standard CRUD operations (GetByIdAsync, GetAllAsync, AddAsync, Update, Remove) and a generic Entity base class with a public Id setter. Additionally, it introduces an IUnitOfWork interface for transaction management and establishes specific repository interfaces for all domain aggregates (Account, Transportation, Ticket, etc.), enabling consistent data access patterns across the application.

AlibabaClone.Domain/Framework · high confidence

Introduction of CityDto for data transfer

A new CityDto class has been added to the application's DTO layer, defining the structure for city data with an integer Id and a required string Title. This class serves as the data transfer object for city-related information within the application.

AlibabaClone.Application/DTOs/City · high confidence

Introduction of application service interfaces and user context abstraction

This change introduces a comprehensive set of new application-layer interfaces in the AlibabaClone.Application project, defining the contract for core domain capabilities. These include IAccountService for user profile and financial operations (such as updating email/password, managing bank details, and viewing transactions), IAuthService for registration and login, and specialized services for ticketing (ITicketOrderService), transportation (ITransportationService, ITransportationLockService), coupons (ICouponService), cities (ICityService), and PDF generation (IPdfGenerator). Additionally, IUserContext is added to abstract user identity extraction, enabling services to access the current user ID securely.

AlibabaClone.Application/Interfaces · high confidence

New account and profile data transfer objects introduced

The application layer now exposes a set of new DTOs in the AlibabaClone.Application/DTOs/Account namespace to support account management and profile operations. These include AccountDto for core account details, PersonDto for personal identity information (including validation for national ID and phone number), ProfileDto for displaying user profile and balance data, and specific DTOs for editing email (EditEmailDto) and password (EditPasswordDto) with appropriate validation attributes. Additionally, TopUpDto and UpsertBankAccountDetailDto are provided to handle wallet top-ups and bank account updates respectively.

AlibabaClone.Application/DTOs/Account · high confidence

New application services for account management, authentication, and ticket ordering

This change introduces a comprehensive set of new application services in the AlibabaClone.Application layer to support core booking and user features. The new AuthService handles user registration and login, while AccountService manages profile updates, travel history, and bank account details. TicketOrderService orchestrates the ticket purchasing workflow, including seat assignment, coupon validation, and PDF generation. Supporting services such as TransportationService, CityService, CouponService, and PersonService provide the necessary business logic for searching transport, managing locations, validating discounts, and handling traveler data.

AlibabaClone.Application/Services · high confidence

New database context with Persian collation and lazy loading

The AlibabaClone.Infrastructure project now includes an ApplicationDBContext that defines DbSets for account, company, location, transaction, and transportation entities. This context is configured to use the Persian\_100\_CI\_AI collation for database operations and enables lazy loading proxies for entity navigation properties.

AlibabaClone.Infrastructure · high confidence

The system now includes concrete repository classes for Account, BankAccountDetail, Gender, Person, and Role aggregates within the AlibabaClone.Infrastructure.Services.AccountAggregates namespace. These implementations provide specific data retrieval capabilities, such as fetching accounts by email, phone number, or profile ID, retrieving bank account details by account ID, and listing persons by creator account ID, thereby enabling the application layer to persist and query these domain entities.

AlibabaClone.Infrastructure/Services/AccountAggregates · high confidence

Behavioural changes

Database schema updates for profile, transactions, and ticketing

The database schema has been updated to support new profile and financial features. The Accounts table now includes a CurrentBalance column, and the People table has a new PhoneNumber column. A new BankAccountDetail table was added to store user banking information, and the Transactions table now supports optional TicketIds, includes a Description field, and links to a new TransactionType lookup table. Additionally, the Tickets table was refactored to reference TicketOrders instead of Transportations directly, and a new Coupon table was introduced to support discount codes.

AlibabaClone.Infrastructure/Migrations · high confidence

Fixes

Fix namespace mismatches in location aggregate repositories

The repository implementations for City, Location, and LocationType within the AlibabaClone.Infrastructure/Services/LocationAggregates folder had incorrect namespace declarations (AccountAggregates instead of LocationAggregates). This change corrects the namespaces to match their folder structure and the corresponding domain aggregates, ensuring the code compiles and the dependency injection container can resolve these services correctly.

AlibabaClone.Infrastructure/Services/CompanyAggregates, AlibabaClone.Infrastructure/Services/LocationAggregates · high confidence

Dependencies

Initial project structure and dependency configuration

The application is initialized with a four-layer architecture (Domain, Application, Infrastructure, WebAPI) targeting .NET 8.0. Key dependencies include Entity Framework Core 9.0.6 with SQL Server support and proxies in Infrastructure, AutoMapper 14.0.0 and JWT handling in Application, and DotNetEnv 3.1.1, JWT Bearer authentication, Newtonsoft.Json, and Swashbuckle 9.0.1 in the WebAPI layer.

(dependencies) · high confidence

Written by watchdog.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 48 → 47 (-1.3)
  • Rubric changed (rubric-2026.08.18 → rubric-2026.09.15) — scores are not directly comparable.

Lenses

  • Code Health 83 → 80 (-3.0)
  • Architecture 87 → 87 (+0.0)
  • Maturity 63 → 63 (+0.0)
  • Readiness 26 → 26 (+0.0)
  • Security 65 → 55 (-9.4)
  • Domain Modelling 99 (new)

Resolved (14)

  • Duplicated block (12 lines × 2) (AlibabaClone.WebAPI/Controllers/AccountController.cs)
  • Duplicated block (12 lines × 4) (AlibabaClone.WebAPI/Controllers/AccountController.cs)
  • Duplicated block (9 lines × 2) (AlibabaClone.WebAPI/Controllers/AccountController.cs)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • No exposed public API
  • The tech stack table and a brief architecture note are present but the full four-layer breakdown (Domain, Application, Infrastructure, Presentation) and key features sections are not shown due to clipping. (README.md)
  • misleading comment (AlibabaClone.Application/Utils/PasswordHasher.cs)
  • misleading comment (AlibabaClone.WebAPI/Program.cs)
  • redundant comment (AlibabaClone.Application/Interfaces/IPersonService.cs)
  • single-maintainer — knowledge-concentration (bus factor) risk

New (47)

  • Documentation: no contributor guidance (README.md)
  • Documentation: no installation or build instructions (README.md)
  • Documentation: no usage examples (README.md)
  • Duplicated block (10 lines × 3) (AlibabaClone.WebAPI/Controllers/AccountController.cs)
  • Duplicated block (10–11 lines × 2) (AlibabaClone.WebAPI/Controllers/CouponController.cs)
  • Duplicated block (11 lines × 2) (AlibabaClone.WebAPI/Controllers/AccountController.cs)
  • Duplicated block (12–13 lines × 8) (AlibabaClone.Infrastructure/Configurations/AccountAggregates/GenderConfiguration.cs)
  • Duplicated block (14 lines × 7) (AlibabaClone.WebAPI/Controllers/AccountController.cs)
  • Duplicated block (19 lines × 2) (AlibabaClone.Application/DTOs/Account/PersonDto.cs)
  • Duplicated block (8 lines × 2) (AlibabaClone.Application/Services/AccountService.cs)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • …and 27 more

API surface

  • Unchanged — 19 HTTP endpoints

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

MehrdadShirvani/AlibabaClone-Backend 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 20 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit 148ab5d0fc00742a87f734d3c471617a5e5d48bd — the exact code this score is about.
  • Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
  • Measured by watchdog.canine.dev using codehealth-analyzer preprod-28e75b8e3254.