<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Alexey Zimarev</title>
    <description>The latest articles on DEV Community by Alexey Zimarev (@alexeyzimarev).</description>
    <link>https://dev.to/alexeyzimarev</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2135%2F2821205.jpeg</url>
      <title>DEV Community: Alexey Zimarev</title>
      <link>https://dev.to/alexeyzimarev</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/alexeyzimarev"/>
    <language>en</language>
    <item>
      <title>Hacking the ASP.NET Core React SPA template for Vue.js</title>
      <dc:creator>Alexey Zimarev</dc:creator>
      <pubDate>Sat, 26 Jan 2019 22:04:56 +0000</pubDate>
      <link>https://dev.to/alexeyzimarev/hacking-the-aspnet-core-react-spa-template-for-vuejs-1plg</link>
      <guid>https://dev.to/alexeyzimarev/hacking-the-aspnet-core-react-spa-template-for-vuejs-1plg</guid>
      <description>

&lt;h1&gt;
  
  
  ASP.NET Core SPA templates and Vue.js
&lt;/h1&gt;

&lt;p&gt;Since version 2.1, ASP.NET Core has moved all SPA templates, previously available via the &lt;code&gt;Microsoft.AspNetCore.SpaTemplates&lt;/code&gt; package, to the core repository. When that was done, all .NET developers that love VueJs were negatively surprises, since the Vue template was simply removed from the new set of templates. So, when you create a new ASP.NET Core Web Application, you have a choice between Angular, React&lt;br&gt;
and React with Redux. The issue is described in details by Owen Caulfield in his &lt;a href="https://medium.com/swlh/asp-net-core-2-1-vue-js-a-marriage-made-in-heaven-6e6ab19b40f5"&gt;post on Medium&lt;/a&gt;. Owen refers to the &lt;a href="https://github.com/aspnet/Announcements/issues/289"&gt;GitHub issue&lt;/a&gt;.&lt;/p&gt;

&lt;h1&gt;
  
  
  How to deal with that
&lt;/h1&gt;

&lt;p&gt;Ideally, the .NET community needs to look at the issue and create a new template to address the issue. Below, I will go through the requirements for such a template and explain how to work around the problem before we get the template working.&lt;/p&gt;

&lt;h2&gt;
  
  
  The React template
&lt;/h2&gt;

&lt;p&gt;Let's have a quick look at how the React+Redux SPA template works.&lt;/p&gt;

&lt;p&gt;An application created with that template contains a folder in the web project that is called &lt;code&gt;ClientApp&lt;/code&gt;. This folder is a home for the React application, which uses WebPack.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--SaiQXUT5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/unifpo1gyh4gktsk310z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SaiQXUT5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/unifpo1gyh4gktsk310z.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To build the SPA, there are some additional items in the &lt;code&gt;csproj&lt;/code&gt; file. You can look at it youself since I will not include these items in the post for the sake of brevity. In short, there is one &lt;code&gt;ItemGroup&lt;/code&gt; there to include the &lt;code&gt;ClientApp&lt;/code&gt; folder as content to the output of the build, and two &lt;code&gt;Target&lt;/code&gt; tags to execute &lt;code&gt;npm&lt;/code&gt; at the build and publish stages.&lt;/p&gt;

&lt;p&gt;There are also some lines of code in the &lt;code&gt;Startup.cs&lt;/code&gt; file that are important to make the whole thing work.&lt;/p&gt;

&lt;p&gt;First, in the &lt;code&gt;ConfigureServices&lt;/code&gt; method we can find this line:&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="n"&gt;services&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;AddSpaStaticFiles&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;configuration&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; 
    &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;configuration&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;RootPath&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"ClientApp/build"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;and in the &lt;code&gt;Configure&lt;/code&gt; method we have a few more lines too:&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;UseStaticFiles&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;UseSpaStaticFiles&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="c1"&gt;// MVC configuration is skipped but still needed&lt;/span&gt;

&lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;UseSpa&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;spa&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;spa&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Options&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;SourcePath&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"ClientApp"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;IsDevelopment&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;spa&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;UseReactDevelopmentServer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;npmScript&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;"start"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h2&gt;
  
  
  Making it work with Vue
&lt;/h2&gt;

&lt;p&gt;So, as we can see, there are no massive changes to the whole application setup to make the SPA work, and hence the &lt;code&gt;UseReactDevelopmentServer&lt;/code&gt; accepts the &lt;code&gt;npm&lt;/code&gt; command, it might be easily replaced to run another command instead.&lt;/p&gt;

&lt;h3&gt;
  
  
  Replace the client app
&lt;/h3&gt;

&lt;p&gt;So, let's start by replacing the React app with the Vue app. To do that, I created a Vue app in another directory, using the &lt;code&gt;vue create myapp&lt;/code&gt; command. I added some options like using TypeScript and PWA, but it doesn't really matter. The Vue CLI 3 only uses the WebPack configuration, so the whole build configuration of the ASP.NET Core application should work as before. To check if this is the case, I removed the content of the &lt;code&gt;ClientApp&lt;/code&gt; folder in my .NET project and replaced it with the content of my new Vue application directory:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--dq8RJXBu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/1v7stdhv2io2hwnup96l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--dq8RJXBu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/1v7stdhv2io2hwnup96l.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can see that my &lt;code&gt;ClientApp&lt;/code&gt; folder contains the Vue app instead of the React app. I can try building the whole solution now, and it builds as expected.&lt;/p&gt;

&lt;h3&gt;
  
  
  Middleware
&lt;/h3&gt;

&lt;p&gt;However, if I run the app, I get an exception in the &lt;code&gt;ReactDevelopmentServerMiddleware&lt;/code&gt;, because it tries to execute &lt;code&gt;npm run start&lt;/code&gt;, but the Vue development server is started by &lt;code&gt;npm run serve&lt;/code&gt;. It appears to be an easy fix, so I only needed to change the line in my &lt;code&gt;Startup.cs&lt;/code&gt;:&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;UseSpa&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;spa&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;spa&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Options&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;SourcePath&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"ClientApp"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;IsDevelopment&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;spa&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;UseReactDevelopmentServer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;npmScript&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;"serve"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;But now, when I start the application, it opens the browser window that continuously hangs trying to load the home page. At the console output, however, I can clearly see that the Vue development server has started successfully and there are no exceptions.&lt;/p&gt;

&lt;p&gt;The reason for the hang is this code in the &lt;code&gt;ReactDevelopmentServerMiddleware&lt;/code&gt; class:&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="n"&gt;Match&lt;/span&gt; &lt;span class="n"&gt;match&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;npmScriptRunner&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;StdOut&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;WaitForMatch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;Regex&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Starting the development server"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;RegexOptions&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;None&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ReactDevelopmentServerMiddleware&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;RegexMatchTimeout&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;As you can see, it starts the &lt;code&gt;npm&lt;/code&gt; with a given command, which we can replace, but it waits for Node to produce a certain console output, which is hardcoded to &lt;code&gt;Starting the development server&lt;/code&gt;. If you look close to the output of the &lt;code&gt;npm run serve&lt;/code&gt; for Vue, you can see that it says &lt;code&gt;Starting development server&lt;/code&gt;. So, the code above waits for the output until it times out and throws.&lt;/p&gt;

&lt;h3&gt;
  
  
  Change the output message
&lt;/h3&gt;

&lt;p&gt;So, here comes a hack, since everything we did before was rather legit. Now, we need to replace the output message. It can be done by changing the &lt;code&gt;serve.js&lt;/code&gt; file in the &lt;code&gt;ClientApp/node_modules/@vue/cli-service/lib/commands&lt;/code&gt; directory. Here is my change:&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;  &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;serve&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;args&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;info&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Starting the development server...'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Now, if I run the application again, it starts the browser, but I get an exception that the middleware cannot proxy the request to the development server:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;HttpRequestException: Failed to proxy the request to &lt;a href="http://localhost:54252/"&gt;http://localhost:54252/&lt;/a&gt;, because the request to the proxy target failed. Check that the proxy target server is running and accepting requests to &lt;a href="http://localhost:54252/"&gt;http://localhost:54252/&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;(the port number can vary)&lt;/p&gt;

&lt;p&gt;At the same time, I can see that at the time the development server of Vue was still building and linting the app. When that is done, I refreshed the page, and everything worked as expected.&lt;/p&gt;

&lt;h3&gt;
  
  
  Note on Browser Sync
&lt;/h3&gt;

&lt;p&gt;It is possible to use the Browser Sync by installing the Vue CLI plugin by executing the &lt;code&gt;vue add browser-sync&lt;/code&gt; in the &lt;code&gt;ClientApp&lt;/code&gt; directory and using the &lt;code&gt;serve:bs&lt;/code&gt; as an argument for the middleware instead of &lt;code&gt;serve&lt;/code&gt;. But then the whole thing stops working again. That's because the plugin uses its own code to handle the &lt;code&gt;serve:bs&lt;/code&gt; command. But it can also be fixed by changing the text to &lt;code&gt;Starting the development server&lt;/code&gt; in the &lt;code&gt;ClientApp/node_modules/vue-cli-plugin-browser-sync/index.js&lt;/code&gt; file.&lt;/p&gt;

&lt;h3&gt;
  
  
  Publishing
&lt;/h3&gt;

&lt;p&gt;If you run the &lt;code&gt;dotnet publish&lt;/code&gt; command for the React app, you will see that the distribution version for the SPA is built to the &lt;code&gt;build&lt;/code&gt; directory in the &lt;code&gt;ClientApp&lt;/code&gt;. That also corresponds with this line in the &lt;code&gt;Startup.cs&lt;/code&gt; file:&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="n"&gt;services&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;AddSpaStaticFiles&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;configuration&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; 
    &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;configuration&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;RootPath&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"ClientApp/build"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;and this line in the &lt;code&gt;csproj&lt;/code&gt; file:&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight xml"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;DistFiles&lt;/span&gt; &lt;span class="na"&gt;Include=&lt;/span&gt;&lt;span class="s"&gt;"$(SpaRoot)build\**; $(SpaRoot)build-ssr\**"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;As you can see, it is very easy to fix by changing &lt;code&gt;build&lt;/code&gt; to &lt;code&gt;dist&lt;/code&gt; in both places. The &lt;code&gt;build-ssr&lt;/code&gt; part can be safely removed if you don't use the Server-Side Rendering. So, the code would be:&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="n"&gt;services&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;AddSpaStaticFiles&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;configuration&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; 
    &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;configuration&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;RootPath&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"ClientApp/dist"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;in the &lt;code&gt;Startup.cs&lt;/code&gt; and&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight xml"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;DistFiles&lt;/span&gt; &lt;span class="na"&gt;Include=&lt;/span&gt;&lt;span class="s"&gt;"$(SpaRoot)build\**"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;in the &lt;code&gt;csproj&lt;/code&gt; file.&lt;/p&gt;

&lt;p&gt;When those changes are done, you can start developing and publishing your Vue SPA app hosted in the .NET Core web application service.&lt;/p&gt;

&lt;h2&gt;
  
  
  Shortcut
&lt;/h2&gt;

&lt;p&gt;It is not nice to hack the code that run &lt;code&gt;npm&lt;/code&gt; commands for the Vue CLI, so you might want to use the complete code for the Vue development server middleware that I've composed from the React development server middleware. Unfortunately, many helper classes for the middleware are internal, so I had to include those classes as well. All that code has the Apache 2.0 licence so it is not a problem to use the modified version of it as soon as the origin of the code is stated clearly. &lt;a href="https://gist.github.com/alexeyzimarev/f0262426aa38e2c1ed2913252ceb5e7a"&gt;Here is my gist&lt;/a&gt;. If you copy this file to your project, you can just use it:&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;UseSpa&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;spa&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;spa&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Options&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;SourcePath&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"ClientApp"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;IsDevelopment&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;spa&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;UseVueDevelopmentServer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;npmScript&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;"serve"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// use serve:bs for Browser Sync&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;




</description>
      <category>aspnet</category>
      <category>vue</category>
    </item>
    <item>
      <title>Deploy GitLab CE on a new Azure Kubernetes cluster</title>
      <dc:creator>Alexey Zimarev</dc:creator>
      <pubDate>Sat, 02 Jun 2018 17:11:15 +0000</pubDate>
      <link>https://dev.to/alexeyzimarev/hands-on-domain-driven-design-with-c-book-g7j</link>
      <guid>https://dev.to/alexeyzimarev/hands-on-domain-driven-design-with-c-book-g7j</guid>
      <description>&lt;p&gt;I would like to share my experience to create a small Kubernetes cluster on&lt;br&gt;
Azure Container Service (AKS Preview) and deploy GitLab CE on it using the Helm chart.&lt;/p&gt;

&lt;p&gt;Originally published on &lt;a href="https://medium.com/@zimareff/deploy-gitlab-ce-on-a-new-azure-kubernetes-cluster-9251100df5d7" rel="noopener noreferrer"&gt;Medium&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fofo69dn5po9vee2tugcl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fofo69dn5po9vee2tugcl.png" width="800" height="371"&gt;&lt;/a&gt;&lt;/p&gt;



&lt;p&gt;Creating a cluster in AKS should be an easy task but sometimes things don’t go at they suppose to. There are at least two main issues that I found:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;When using the Azure Portal, there is a big chance something will go wrong and
the cluster will be always in “creating” state and you can only remove it by
using the Azure CLI.&lt;/li&gt;
&lt;li&gt;There is no way from Azure CLI to understand, which VM sizes are available in
which region. Definitely, not all VM sizes can be used in AKS and in different
regions the set of available VM sizes is different. It is OK when someone else
pays for your Azure subscription, but using your own freemium subscription or
paying out of own pocket might end up not so well.&lt;/li&gt;
&lt;li&gt;You need a cluster with at least three nodes, since smaller VMs have limitations
on how many data volumes can be attached to them and GitLab uses quite a few
persistent volumes.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So, I managed to install the cluster with three nodes of the recent VMs, which are still quite cheap — the relatively new B-series machine size. These machines, according to Microsoft, are suited best for irregular CPU load, like web sites, development or test environments. This suits my purpose ideally.&lt;/p&gt;

&lt;p&gt;I used B2s machine size with 2 vCPUs, 8 Gb RAM and 8 Gb local SSD.&lt;/p&gt;

&lt;p&gt;You need Azure CLI if you want to repeat what I have done. If you don’t have it, the installation is described on &lt;a href="https://docs.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest" rel="noopener noreferrer"&gt;this page&lt;/a&gt;. You also need &lt;a href="https://kubernetes.io/docs/tasks/tools/install-kubectl/" rel="noopener noreferrer"&gt;kubectl&lt;/a&gt;, the management command like tool for Kubernetes.&lt;/p&gt;

&lt;p&gt;After logging in to the Azure account, I had to register a new resource group,&lt;br&gt;
because AKS requires a separate resource group. So do this, I executed this command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;az group create --name ubiquitous --location eastus
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Although I am not from the US, I chose this region because it has most VM sizes available. As you can imagine, &lt;code&gt;ubiquitous&lt;/code&gt; is my own resource group name and you should be using something else.&lt;/p&gt;

&lt;p&gt;Next, the cluster creation. Doing it using Azure CLI is rather simple.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;az aks create --resource-group ubiquitous --name ubiquitous --node-count 3 --generate-ssh-keys --node-vm-size Standard_B2s
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The cluster name can be anything and I chose to use my company name, which matches with the resource group name. As you can see I specified three nodes for my cluster and B2s VM size.&lt;/p&gt;

&lt;p&gt;The process is quite lengthy so leave it to run for at least 20 minutes or more. At the end, it will produce a JSON output, which you might record but I have not used it.&lt;/p&gt;

&lt;p&gt;In order to be able to use kubectl with your new cluster, you need to add the cluster context to your &lt;code&gt;.kube/config&lt;/code&gt; file. It can be easily done using Azure CLI.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;az aks get-credentials -g ubiquitous -n ubiquitous
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, &lt;code&gt;-g&lt;/code&gt; is the shortcut for &lt;code&gt;--group&lt;/code&gt; and &lt;code&gt;-n&lt;/code&gt; — for &lt;code&gt;--name&lt;/code&gt; , where you&lt;br&gt;
specify the name of your cluster.&lt;/p&gt;



&lt;p&gt;The next thing is to install GitLab CE. The best way of installing it on Kubernetes is to use the Omnibus Helm chart. If you don’t know about Helm, learn more &lt;a href="https://helm.sh/" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note: it will be replaced by a new “cloud ready” chart, which is in alpha stage&lt;br&gt;
now.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;First things first, and if you don’t have Helm, you need to install it first. Installation is different per platform, so the best way to do it is to refer to the &lt;a href="https://github.com/kubernetes/helm/blob/master/docs/install.md" rel="noopener noreferrer"&gt;installation instructions&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;After Helm is installed, we need to install Tiller, the Helm agent in Kubernetes. It is very easy to do by running this command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;helm init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Since you are already have your current Kubernetes context switched to the new cluster, it will just go there and install Tiller in the default namespace.&lt;/p&gt;

&lt;p&gt;Then, we need to add GitLab Helm repository:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;helm repo add gitlab 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Before installing, remember that GitLab will use kube-lego to create SSL for your Ingress using Let’s Encrypt. But you need to have a domain, which you will use for your GitLab instance. You also need to control DNS for this domain. This is because it is necessary to add a wildcard DNS entry and point it to Ingress, which will be configured by GitLab.&lt;/p&gt;

&lt;p&gt;Here, you can either get an external IP address for your cluster in advance, create a DNS entry and specify this address in the Helm deployment command. Or, as I did, rely on Azure to assign the IP address but in this case you will have just a few minutes to create the DNS entry, since you need to do it as soon as Ingress gets the address but before GitLab deployment is finished. This is the way I used.&lt;/p&gt;

&lt;p&gt;So, the installation is executed by this command (remember to use your own domain name):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;helm install --name gitlab --set provider=acs gitlab/gitlab-omnibus
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As you can see, I chose to use the &lt;code&gt;app.ubiquitous.no&lt;/code&gt; subdomain, so I needed to add a DNS entry for it.&lt;/p&gt;

&lt;p&gt;In order to see whether the IP address is already available, I used this command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl get svc -w --namespace nginx-ingress nginx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At first, it produces output, where the &lt;code&gt;EXTERNAL_IP&lt;/code&gt; will be shown as &lt;code&gt;&amp;lt;pending&amp;gt;&lt;/code&gt; but let it run for a few minutes until a new line will appear and show the newly assigned external IP address.&lt;/p&gt;

&lt;p&gt;Now, quickly add an &lt;code&gt;A&lt;/code&gt; DNS entry for your (sub)domain and use this new address. In my case, the DNS entry was:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;A   *.app.ubiquitous.no   23.96.2.189
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;I intentionally expose the real details here since it is a test cluster with non-production data. In addition, it is quite secure.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;At this moment, the GitLab instance is still being deployed. Azure is not very fast on completing persistent volume claims and before this is done, GitLab pods will not be operational. It took about 20 minutes in my case for everything to be set up.&lt;/p&gt;




&lt;p&gt;Now, after all is done, I got a GitLab CE instance running on Kubernetes cluster in Azure. Helm deployment told Ingress to use a few host names: &lt;code&gt;gitlab&lt;/code&gt; , &lt;code&gt;mattermost&lt;/code&gt; and &lt;code&gt;registry&lt;/code&gt; . These host names are for the subdomain specified for the installation. So in my case, I am accessing GitLab by going to &lt;a href="https://gitlab.app.ubiquitous.no" rel="noopener noreferrer"&gt;https://gitlab.app.ubiquitous.no&lt;/a&gt;. When I went there the first time, I was able to specify the new password for the root user, so my advice is to log in the first time as fast as you can.&lt;/p&gt;

&lt;p&gt;What is included by default? Well, quite a lot:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;GitLab CE itself, which hosts your Git repositories and handles issues and wikis.&lt;/li&gt;
&lt;li&gt;GitLab Runner for Kubernetes, which is used to build and deploy your applications using the CI/CD pipeline.&lt;/li&gt;
&lt;li&gt;GitLab Docker Registry, allowing you to host Docker images in individual Docker repositories for each project.&lt;/li&gt;
&lt;li&gt;Mattermost chat system.&lt;/li&gt;
&lt;li&gt;Prometheus time-series database, which will collect metrics for GitLab itself and for pods that the CI pipeline will deploy.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Hence that Kubernetes integration is enabled and configured out of the box, so you can use their default Auto Deploy CI/CD configuration and start building and deploying your apps to Kubernetes if you have a Dockerfile in your repository or your app can be built using one of default Heroku buildpacks. Read more about Auto Deploy&lt;br&gt;
&lt;a href="https://docs.gitlab.com/ee/topics/autodevops/index.html#auto-deploy" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Prometheus is not exposed to the outside world, so if you want to reach it, you can use this command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl port-forward svc/gitlab-gitlab 9090:9090
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;to set up port forwarding to the GitLab service, then open &lt;a href="http://localhost:9090" rel="noopener noreferrer"&gt;http://localhost:9090&lt;/a&gt; to reach the Prometheus UI.&lt;/p&gt;

&lt;p&gt;Later, I will describe how to use Auto Deploy in GitLab to build and deploy ASP.NET Core applications.&lt;/p&gt;




&lt;p&gt;Finally, if some configuration for GitLan is required, you need to change the Ruby file that GitLab sues for configuration. Since configuration is stored on a persistent volume, it can safely be changed and the changes will remain after the pod or the whole cluster restarts.&lt;/p&gt;

&lt;p&gt;But since there are neither root login nor SSH certificate for the pod, the easiest way to configure GitLab is to use kubectl exec. In order to use it, you have to know the name of the pod where GitLab runs. To do this, you can list all pods:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ kubectl get pods
NAME                                        READY     STATUS    RESTARTS   AGE
gitlab-gitlab-764bd7665-w94t6               1/1       Running   1          22h
gitlab-gitlab-postgresql-5fff4f67bb-lp74p   1/1       Running   0          22h
gitlab-gitlab-redis-6c88945d56-gm5qc        1/1       Running   0          22h
gitlab-gitlab-runner-f7c85548-bl8c5         1/1       Running   7          22h
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can see some pods to run Postgresql, Redis, the GitLab Runner, but the first pos is the one we need. So, if we run this command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl exec -it gitlab-gitlab-764bd7665-w94t6 -- /bin/bash
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;we will get the pod bash prompt in sudo mode. From there everything is easy. To change the configuration, just edit the Ruby file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;vim /etc/gitlab/gitlab.rb
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can of course use something like nano if you aren’t familiar with vim.&lt;/p&gt;

&lt;p&gt;When all changes are done, save the file, quit the editor and run these commands:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;gitlab-ctl reconfigure
gitlab-ctl restart
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;Happy GitLabbing!&lt;/p&gt;

</description>
      <category>azure</category>
      <category>kubernetes</category>
      <category>gitlab</category>
    </item>
    <item>
      <title>Hands-on Domain-Driven Design with C# Book</title>
      <dc:creator>Alexey Zimarev</dc:creator>
      <pubDate>Mon, 16 Apr 2018 11:17:28 +0000</pubDate>
      <link>https://dev.to/alexeyzimarev/hands-on-domain-driven-design-with-c-book-98f</link>
      <guid>https://dev.to/alexeyzimarev/hands-on-domain-driven-design-with-c-book-98f</guid>
      <description>

&lt;p&gt;Ok, it is official that my book &lt;em&gt;Hands-on Domain-Driven Design with C#&lt;/em&gt;&lt;br&gt;
will be published by Packt in January 2019.&lt;/p&gt;

&lt;p&gt;Here is the &lt;a href="https://www.packtpub.com/application-development/hands-domain-driven-design-net"&gt;link&lt;/a&gt; to the book.&lt;/p&gt;

&lt;h2&gt;
  
  
  What You Will Learn
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Discover domain complexity together with business stakeholders&lt;/li&gt;
&lt;li&gt;Avoid common pitfalls when creating the domain model&lt;/li&gt;
&lt;li&gt;Understand the concept of bounded context and aggregate&lt;/li&gt;
&lt;li&gt;Design and build temporal models based on behavior and not only data&lt;/li&gt;
&lt;li&gt;Explore benefits and drawbacks of event-sourcing&lt;/li&gt;
&lt;li&gt;Figure out CQRS and to-the-point read models with projections&lt;/li&gt;
&lt;li&gt;Practice building one-way flow UI with Vue.js&lt;/li&gt;
&lt;li&gt;Learn how task-based UI matches with DDD principles&lt;/li&gt;
&lt;li&gt;Understand how to develop complex systems in ever changing world&lt;/li&gt;
&lt;/ul&gt;


</description>
      <category>ddd</category>
      <category>domaindrivendesign</category>
      <category>architecture</category>
    </item>
    <item>
      <title>DDD All-The-Things</title>
      <dc:creator>Alexey Zimarev</dc:creator>
      <pubDate>Thu, 03 Aug 2017 16:29:05 +0000</pubDate>
      <link>https://dev.to/alexeyzimarev/ddd-all-the-things</link>
      <guid>https://dev.to/alexeyzimarev/ddd-all-the-things</guid>
      <description>&lt;p&gt;&lt;em&gt;This article was originally &lt;a href="https://medium.com/@zimareff/ddd-all-the-things-b075be2107dc" rel="noopener noreferrer"&gt;published on Medium&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffcg4ri0bo2t2ivw7fmaq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffcg4ri0bo2t2ivw7fmaq.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For quite a few years, with growing popularity of Domain-Driven Design (DDD), I keep hearing that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;DDD is hard&lt;/li&gt;
&lt;li&gt;DDD is only for core domain&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This mantra has became very popular and often is (mis)used to advocate some crazy things people do to avoid crunching the domain knowledge.&lt;/p&gt;

&lt;p&gt;In this post, I would like to return back to the roots. In nearly every talk or lecture that somehow concerns DDD, Greg Young mentions that, in his opinion, the chapter order of the Blue Book is incorrect. The issue is that most of the strategic design is placed to the latest chapters of the book. Since the book itself is not the easiest of reads, most of the people rarely get over 50% of it, which means they manage to get through the basics of the Ubiquitous Language, learn a little bit about contexts, then spend most of their time reading about implementation patterns.&lt;/p&gt;

&lt;p&gt;But, if you look at Twitter of Eric Evans, you will see this:&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvrk0167xolgs6k949oug.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvrk0167xolgs6k949oug.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“Domain Linguist” @ domainlanguage.com&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Something begins to clear up, doesn’t it? Eric is not an “king of aggregates” or “master of repositories”. He is a &lt;em&gt;domain linguist&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;One of the major take aways from the (highly recommended) Implementing Domain-Driven Design workshop by Vaughn Vernon for me was this:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Domain-Driven Design is developing Ubiquitous Language within Bounded Context.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F26fdql81ket67dr71ojr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F26fdql81ket67dr71ojr.png"&gt;&lt;/a&gt;&lt;br&gt;
How crazy is that? Not “finding the right aggregate boundaries” or “splitting layers”. Thisâ€Š–â€Šlanguage and context.&lt;/p&gt;

&lt;p&gt;What does it mean in real life and how does it correspond with the post title, you might ask? Well, here is my answer:&lt;br&gt;
Use domain-driven design everywhere. Start with knowledge crunching, get as much knowledge about the domain as you can. Talk to domain experts, use techniques like Event Storming, mind-mapping and observations to get knowledge. At the end of the day, we all agree that 90% of the developer’s job is finding out what to do and only 10% is coding. DDD will allow you to understand what to do, from the problem space perspective, from your user perspective.&lt;/p&gt;

&lt;p&gt;By writing this &lt;em&gt;I do not suggest&lt;/em&gt; using implementation patterns like aggregates, repositories and so on, everywhere. This is just plain wrong. But two things â€Š– â€Š&lt;strong&gt;language&lt;/strong&gt; and &lt;strong&gt;context&lt;/strong&gt; â€Š– â€Šare your main tools to create a strategic map of the future solution, will create this missing link between your users’ problems and your proposed solution.&lt;/p&gt;

&lt;p&gt;Each context might use any implementation technique suitable for that context That could be CRUD, Active Record, Event Sourcing or anything else find applicable and what is inline with the complexity of the context itself. However, the realisation of facts that you have different contexts, that your system almost never consists of one context only, that you need to understand your user’s language, will help you building a better system.&lt;/p&gt;

&lt;p&gt;I gave a talk at &lt;a href="https://www.meetup.com/dddnorway/" rel="noopener noreferrer"&gt;DDD Norway meetup&lt;/a&gt; in March 2017 about this and you can find slides on &lt;a href="https://www.slideshare.net/alexeyzimarev/ddd-what-why-how-74199460" rel="noopener noreferrer"&gt;SlideShare&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The same talk was squeezed to a ten minutes lightning talk at DDD Exchange 2017 in London, which you can watch on the &lt;a href="https://skillsmatter.com/skillscasts/10198-ddd-all-the-things" rel="noopener noreferrer"&gt;SkillsMatter web site&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Do you agree or disagree? Have you got your own thoughts about this? I am happy to discuss.&lt;/p&gt;

</description>
      <category>ddd</category>
      <category>domaindrivendesign</category>
      <category>architecture</category>
      <category>software</category>
    </item>
    <item>
      <title>Hi, I'm Alexey Zimarev</title>
      <dc:creator>Alexey Zimarev</dc:creator>
      <pubDate>Thu, 19 Jan 2017 10:16:14 +0000</pubDate>
      <link>https://dev.to/alexeyzimarev/hi-im-alexey-zimarev</link>
      <guid>https://dev.to/alexeyzimarev/hi-im-alexey-zimarev</guid>
      <description>&lt;p&gt;I have been coding for 20 years.&lt;/p&gt;

&lt;p&gt;You can find me on GitHub as &lt;a href="https://github.com/alexeyzimarev" rel="noopener noreferrer"&gt;alexeyzimarev&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I live in Larvik, Norway.&lt;/p&gt;

&lt;p&gt;I work for ABAX.&lt;/p&gt;

&lt;p&gt;I mostly program in these languages: C#, TypeScript, F#, Scala.&lt;/p&gt;

&lt;p&gt;I am currently learning more about functional programming.&lt;/p&gt;

&lt;p&gt;Nice to meet you.&lt;/p&gt;

</description>
      <category>introduction</category>
    </item>
  </channel>
</rss>
