This is a Chat Room application with bot capabilities.
- Chat Room for talking with other users
- .NET Identity Core for users authentication
- Consume Chat Bots
The back end was built in .NET Core 3.1, which implements a microservices architecture using CQRS Pattern with MeadiatR.
For real time communications, SignalR was used between users, which is consumed over MeadiatR notifications and events, and RabbitMQ for handling bots requests and responses.
The front end was done in Angular 8
Project | Description |
---|---|
ChatRoomWithBot | Web Application with Angular |
ChatRoom.Appication | Application Core Class Library |
ChatRoom.ComService | Class Library for communication services: SignalR & RabbitMQ |
ChatRoom.Domain | Class Library for application related domain classes |
ChatRoom.Persistence | Data layer project |
ChatRoom.ChatBot.Domain | Class Library for Chatbots related domain classes |
ChatRoom.ChatBot | Console App for handling Bot events |
ChatRoom.XUnitTest | Test Project |
- RabbitMQ Server (Requires ERLang/OTP)
- .NET Core 3.1
- LocalDB Feature or SQL Server
- NodeJS 12
- Angular CLI
Database Server, Message Queue Server and Developer SDKs and Tools Requirements should be installed before the next setting up section. Alternatively, You can create Docker images to deploy as following:
- For SQL Server
$ docker pull mcr.microsoft.com/mssql/server
$ docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD={Your-Password}’ -p 1433:1433 -d --restart=always --name={Your-Server-Name} hostname={Your-Server-Name} mcr.microsoft.com/mssql/server:latest
- For Rabbit MQ
$ docker run -d --hostname {my-rabbit-name} --name {my-rabbit-name} -p 15672:15672 -p 5672:5672 -e RABBITMQ_DEFAULT_USER=guess -e RABBITMQ_DEFAULT_PASS=guess -e RABBITMQ_ERLANG_COOKIE='rabbitcookie' rabbitmq:3-management
- For the application
$ docker build -t aspnetapp .
$ docker run -d -p 8080:80 --name myapp aspnetapp
- ChatRoomWithBot/appsettings.json File with
ConnectionStrings
andRabbitMQ Server credentials
for receiving queue messages. LocalDB is set by default, but You can define another location - ChatBot/ChatRoom.ChatBot/appsettings.json File with
Stocks bot
settings andRabbitMQ Server credentials
for sending and receiving bot responses.
-
For Database deployment, you need to run migrations from data layer project directory to create the database:
- In Visual Studio, use the Package Manager Console to scaffold a new migration and apply it to the database:
PM> Add-Migration [migration name] PM> Update-Database
- Alternatively, you can scaffold a new migration and apply it from a command prompt at your project directory:
> cd {ChatRoom.Persistence folder} > dotnet ef migrations add [migration name] > dotnet ef database update
-
For dependencies downloads, restore dotnet nuget pakages and install npm packages in command promt:
> cd {Solution Source directory} > dotnet restore > cd {Angular ClientApp directory} > npm install
-
Multiple startup projects should be set:
- ChatRoom.ChatBot
- ChatRoomWithBot
- Or You can run from terminal:
> dotnet run
For testing, You can run from Visual Studio or by terminal:
> cd {test project folder}
> dotnet test