This tutorial teaches the basics of using Dolittle to create a simple ToDo 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’ll have a simple ToDo application.
This example based off of our ToDo 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
ToDoApplication and change into that directory.
mkdir ToDoApplication cd ToDoApplication
To create a new application using the CLI tool, use the
dolittle create application command.
dolittle create application ToDoApplication
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 ToDoApplication directory and choose
MongoDB for your read models/event store and
TypeScript Aurelia for your web interaction layer:
dolittle create boundedcontext ToDo ? Choose the resource implementation for read models MongoDB ? Choose the resource implementation for event store MongoDB ? Choose web interaction layer TypeScript Aurelia Interaction Adornment
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 └── ToDo ├── ToDo.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 ToDo/Web npm install
Then build the front-end:
cd ToDo/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 ToDo/Core/ dotnet run
Last lines of the output should be something like this:
Hosting environment: Development Content root path: /home/joel/Dolittle/TutorialExample/ToDoApplication/ToDo/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