Skip to main content

Overview

Karma Ecommerce is a modern, scalable ecommerce application built with Angular 20.3.0 and clean architecture principles. The project demonstrates professional software engineering practices through Domain-Driven Design (DDD) and Command Query Responsibility Segregation (CQRS) patterns.
This project showcases how to build maintainable, testable, and scalable enterprise applications using Angular with clean architecture.

What Problems Does It Solve?

Karma Ecommerce addresses several key challenges in modern web application development:
  • Separation of Concerns: Clear boundaries between domain logic, application services, and infrastructure through layered architecture
  • Maintainability: Code organized by business domain (usuario/user module) rather than technical concerns
  • Testability: Dependency injection and repository pattern enable easy unit testing
  • Scalability: CQRS pattern separates read and write operations for better performance optimization
  • Type Safety: Full TypeScript with strict mode enabled for compile-time error detection

Key Features

User Authentication

Complete authentication system with login and registration functionality, backed by a REST API

Clean Architecture

Domain-Driven Design with clear separation between Domain, Application, and Infrastructure layers

CQRS Pattern

Commands for write operations and Queries for read operations with dedicated handlers

Repository Pattern

Abstract repositories in domain layer with concrete implementations in infrastructure

Standalone Components

Modern Angular standalone components without NgModules for better tree-shaking

Reactive Programming

RxJS observables throughout the application for reactive data flow

Technology Stack

Karma Ecommerce is built with modern web technologies:
  • Angular 20.3.0 - Latest Angular framework with standalone components
  • TypeScript 5.9.2 - Strict type checking and modern JavaScript features
  • RxJS 7.8.0 - Reactive Extensions for asynchronous programming
  • Angular CLI 20.3.10 - Command-line interface for Angular development
  • HttpClient - Native Angular HTTP client for REST API communication
  • Karma + Jasmine - Unit testing framework

Architecture Highlights

The project follows a three-layer architecture:
src/app/usuario/
├── domain/              # Business logic and entities
│   ├── models/         # Domain models (Usuario)
│   └── repositories/   # Repository interfaces
├── application/        # Use cases and business rules
│   ├── commands/       # Write operations (RegisterUserCommand)
│   ├── queries/        # Read operations (LoginUserQuery)
│   └── usecases/       # Command and Query handlers
└── infrastructure/     # External concerns
    ├── services/       # API services (AuthService)
    └── ui/            # Angular components and pages
Each layer has clear responsibilities and dependencies flow inward - the domain layer has no external dependencies, while infrastructure depends on domain abstractions.

Quick Example

Here’s how the CQRS pattern is implemented for user login:
// Query object (application/queries/login-user.query.ts)
export class LoginUserQuery {
    constructor(readonly usuario: string, readonly contrasena: string) {}
}

// Query handler (application/usecases/queryHandlers/login-user.handler.ts)
@Injectable()
export class LoginUserHandler {
    constructor(private usuarioRepository: UsuarioRepository){}

    handle(query: LoginUserQuery): Observable<Usuario> {
        return this.usuarioRepository.loginUsuario(query.usuario, query.contrasena);
    }
}

Next Steps

Quick Start

Get up and running in minutes with our installation guide

Architecture Overview

Deep dive into the clean architecture implementation

Authentication

Learn about the authentication system and user management

API Reference

Explore the complete API documentation

Project Goals

This project serves as:
  1. Educational Reference - Demonstrating clean architecture in Angular
  2. Production Template - Starting point for enterprise applications
  3. Best Practices Showcase - Modern Angular development patterns
  4. Scalable Foundation - Architecture that grows with your needs

Build docs developers (and LLMs) love