This tutorial teaches the basics of using Dolittle to create a simple banking web-application.
You learn how to:
Eventsinto a database
This tutorial expects you to have a basic understanding of .NET, C#, TypeScript, npm and the terminal.
At the end you have an app that can manage bank users and tgeir accounts.
This example based off of a Banking sample.
The Dolittle CLI tool makes developing Dolittle applications easier by providing boilerplate code to bootstrap your application.
Install the CLI tool
npm install -g @dolittle/cli
Test that the CLI tool works Run the CLI tool in your command window, it shows the available commands for you to use:
This part teaches you how to create a blank Dolittle web application with the Dolittle CLI tool.
Use the CLI tool to create a new [application]().
The first thing you need is a folder for your application. Create a new folder on your computer, name it
BankingApplication and change into that directory.
mkdir BankingApplication cd BankingApplication
To create a new application using the CLI tool, use the
dolittle create application command.
dolittle create application BankingApplication
If you get an error saying:
No application boilerplates found for language 'csharp'
You can fix it by running the command:
dolittle boilerplates installed
The basic application scaffolding has now been created. The folder structure should look like this:
├── application.json └── .dolittlerc
Each application needs to have one or more [Bounded Contexts](). Use the CLI tool to add a Bounded Context to our application.
Run this command inside the BankingApplication directory and choose
MongoDB for your read models/event store and
A bounded context is now added to the application, located inside the folder. This folder is based on the Bounded Context boilerplate and contains everything you need to run a Dolittle template application.
Your project structure should now look like this:
. ├── .dolittlerc ├── application.json └── Banking ├── Banking.sln ├── bounded-context.json ├── Concepts ├── Core ├── Domain ├── Domain.Specs ├── Events ├── Policies ├── Policies.Specs ├── Read ├── Read.Specs ├── Rules ├── Rules.Specs └── Web
Navigate to the
Web folder and install all the dependencies:
cd Banking/Web npm install
Then build the front-end:
cd Banking/Web npm run-script build
Start a local docker container that contains a blank MongoDB 4.0.12 server running on port 27017:
docker run -d -p 27017:27017 mongo:4.0.12
Now you have basic Dolittle application [structure](). To test it out, run the following commands from the
cd Banking/Core/ dotnet run
Last lines of the output should be something like this:
Hosting environment: Development Content root path: /home/joel/Dolittle/TutorialExample/BankingApplication/Banking/Core Now listening on: http://localhost:5000 Application started. Press Ctrl+C to shut down.
Navigate to http://localhost:5000 in your browser to see the running template application.
In the next part of the tutorial you learn how to create a