Pluralsight DDD Fundamentals Sample Code

repository·main·Indexed 21 days ago

https://github.com/ardalis/pluralsight-ddd-fundamentals

Sample code for the Pluralsight DDD Fundamentals course, demonstrating Domain-Driven Design principles through a set of related ASP.NET Core applications including Blazor frontends and APIs (FrontDesk, ClinicManagement, and VetClinicPublic). The project utilizes RabbitMQ for messaging and showcases a migration from data-centric to domain-centric architecture using the CleanArchitecture template and various Ardalis libraries.

Tokens
5.4K
Snippets
18
Records
22
Agent score
75%

What's inside pluralsight-ddd-fundamentals

  1. Architecture overview of the DDD sample

    main

    The sample consists of a set of related monolithic ASP.NET Core applications.

    • Blazor Applications: Built using a modified version of the CleanArchitecture solution template.
    • Design Pattern: The architecture is designed to demonstrate migrating from a data-centric to a domain-centric architecture.
    • Components: Includes APIs and Blazor frontends for FrontDesk, ClinicManagement, and VetClinicPublic, utilizing RabbitMQ for messaging between applications.
  2. Use Open Iconic Icon Fonts standalone

    main

    If you are not using Bootstrap or Foundation, use the default stylesheets.

    1. Link the stylesheet: /open-iconic/font/css/open-iconic.css
    2. Use the <span> pattern with the data-glyph attribute: <span class="oi" data-glyph="icon-name" ...></span>
    <link href="/open-iconic/font/css/open-iconic.css" rel="stylesheet">
    
    <span class="oi" data-glyph="icon-name" title="icon name" aria-hidden="true"></span>
  3. Use Open Iconic's SVG Sprite

    main

    The SVG sprite allows you to load all icons in a single request. To use an icon, reference the specific ID within the open-iconic.svg file using the <use> tag.

    Styling Tips:

    • Sizing: Set equal width and height on the <svg> tag.
    • Coloring: Use the CSS fill property on the <use> tag to change the icon color.
    <svg class="icon">
      <use xlink:href="open-iconic.svg#account-login" class="icon-account-login"></use>
    </svg>
    /* Sizing */
    .icon {
      width: 16px;
      height: 16px;
    }
    
    /* Coloring */
    .icon-account-login {
      fill: #f00;
    }
  4. Use Open Iconic SVG Sprites

    main

    The SVG sprite allows you to load all icons in a single request. To use an icon, reference the specific icon ID within the open-iconic.svg file using the <use> tag.

    Styling

    • Sizing: Set equal width and height on the <svg> tag.
    • Coloring: Use the CSS fill property on the <use> tag.

    Tip: Add a general class to the <svg> tag for shared styles and a unique class to the <use> tag for icon-specific styling (like color).

    <svg class="icon">
      <use xlink:href="open-iconic.svg#account-login" class="icon-account-login"></use>
    </svg>
    
    <style>
    .icon {
      width: 16px;
      height: 16px;
    }
    
    .icon-account-login {
      fill: #f00;
    }
    </style>
  5. Run the sample using Docker

    main

    The recommended way to run the sample is using Docker. This will start all applications (FrontDesk, ClinicManagement, VetClinicPublic) and supporting services (RabbitMQ, SQL Server, and Papercut) automatically.

    From the root folder of the repository, run:

    docker-compose build --parallel
    docker-compose up

    Note:

    • The build step may take some time. Running with --parallel is faster.
    • The up command might show initial errors as services attempt to connect before they are fully responsive (e.g., RabbitMQ or SQL Server). If you encounter SQL Server login errors, restart the process using Ctrl+C and run docker-compose up again.
    • Data changes are not persisted if you remove the SQL Server container; it will be recreated and re-seeded on the next run.
  6. Use Open Iconic Icon Fonts with Foundation

    main

    To use Open Iconic with Foundation, include the Foundation-specific stylesheet and use the fi- prefix for icon names.

    1. Link the stylesheet: /open-iconic/font/css/open-iconic-foundation.css
    2. Use the <span> pattern: <span class="fi-icon-name" ...></span>
    <link href="/open-iconic/font/css/open-iconic-foundation.css" rel="stylesheet">
    
    <span class="fi-icon-name" title="icon name" aria-hidden="true"></span>
  7. Use Open Iconic Icon Fonts with Bootstrap

    main

    To use Open Iconic with Bootstrap, include the Bootstrap-specific stylesheet and use the oi class followed by the icon name.

    1. Link the stylesheet: /open-iconic/font/css/open-iconic-bootstrap.css
    2. Use the <span> pattern: <span class="oi oi-icon-name" ...></span>
    <link href="/open-iconic/font/css/openstar-iconic-bootstrap.css" rel="stylesheet">
    
    <span class="oi oi-icon-name" title="icon name" aria-hidden="true"></span>
  8. Run the sample in Visual Studio or VS Code

    main

    Running the sample locally without Docker requires manual setup of dependencies and NuGet packages:

    1. Configure NuGet: You must configure a local NuGet server and include the following package: /FrontDesk/src/FrontDesk.Blazor/deps/Pluralsight.DDD.Deps/Pluralsight.DDD.Deps.1.0.0.nupkg

    2. Run RabbitMQ: Start RabbitMQ as a Docker container:

      docker run --rm -it --hostname ddd-sample-rabbit -p 15672:15672 -p 5672:5672 rabbitmq:3-management
       Access the management interface at `http://localhost:15672` (login: `guest`/`guest`).
    
    3. **Run Papercut (Test Mailserver):** To view sent confirmation emails, start Papercut:
       ```powershell
    docker run --name=papercut -p 25:25 -p 37408:37408 jijiechen/papercut:latest

    Access the management interface at http://localhost:37408.

    1. Run Solutions: You will need to run multiple solutions side-by-side. To see live synchronization between entities and appointments, you must run all three web applications: FrontDesk, ClinicManagement, and VetClinicPublic.
    docker run --rm -it --hostname ddd-sample-rabbit -p 15672:15672 -p 5672:5672 rabbitmq:3-management
    
    docker run --name=papercut -p 25:25 -p 37408:37408 jijiechen/papercut:latest