juandepalo / ChatRoomWithBot

Chat Room application with a bot

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ChatRoomWithBot

This is a Chat Room application with bot capabilities.

Features

  • Chat Room for talking with other users
  • .NET Identity Core for users authentication
  • Consume Chat Bots

Technical Details

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

Projects Structure

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

Requirements

Configuration

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

Settings Files

Setup Application

  • 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

Unit Tests

For testing, You can run from Visual Studio or by terminal:

> cd {test project folder}
> dotnet test

About

Chat Room application with a bot


Languages

Language:C# 58.0%Language:TypeScript 26.8%Language:HTML 10.5%Language:CSS 2.5%Language:JavaScript 1.2%Language:Dockerfile 1.0%