Onyx Shift Scheduler is a boilerplate ASP.NET Core project with clean architecture in mind. It uses Google OR Tools to solve the problem of scheduling shift between employees to support the business.
The goal of this project is to provide a sample starter kit solution structure that can be used to build Domain-Driven Design (DDD)-based or simply a SOLID applications using .NET Core. The sample business idea in the starter kit can be used to automatically solve scheduling problems with multiple constraints.
The project demonstrates a basic usage of the following:
And a sample usage of the application, using Google OrTools Constraint Solver to handle employee shift scheduling.
The solution does not include every possible framework, tool, or feature that an enterprise application might need. It uses common, accessible technology for most business software developers. It doesn't include extensive support for logging or analytics, though these can all be added easily. The nature of this architecture is to support modularity and encapsulation. Most so many current dependencies can easily be swapped out for your technology of choice.
The solution includes the following projects.
The Core project has very few external dependencies. It is the shared center of the solution. The Core project includes things like, entities, dtos, interfaces, etc.
Most of your application's dependencies on external resources are implemented in Infrastructure project. The Infrastucture holds implementations of interfaces defined in Core. The sample also includes data access and domain event implementations.
A consumable API with swagger implementation that can be used to deliver data to the frontend UI project.
A very simple and basic Angular project coupled with the API to retrieve a sample schedule. Please note that this is just a demo project. It has been loaded with a csproject into Visual Studio for convenience and fast development. Please note that it must not be included in build configuarion, since there's nothing to build there.
In a real application I will likely have separate test projects, organized based on the kind of test (unit, functional, integration, etc.) or by the project they are testing (Core, Infrastructure, Web). For this simple boilerplate, there is just one test project, with folders representing the projects being tested. The test project uses xunit, Moq and ASP.NET Core's TestHost.
Google Operations Research and Optimization Tools (a.k.a., OR-Tools) is an open-source, fast and portable software suite for solving combinatorial optimization problems. It's written in C++, and this project uses wrappers for C# to unleash its powers. The Qoollo.OptTools.Core has been used in this project for cross platform dotnetCore portability.
Instructions to build and run the project
You need the following to build the project:
Visual Studio 15.7.5 and above .NET Core SDK 2.1
@angular >= 6.1.0 @angular/cli >= 6.1.0
Latest Docker CEswitched to
API project from Visual Studio. The Swagger UI will be launched on port
44019 of the IIS Express.
npm install to install the missing packages.
Web project from the command line with
npm start for a dev server, or
npm run hmr for hot module replacement support. Navigate to
If by any change, you get an error from the sass module, it might be that you opened the Visual Studio and not fetching all node modules correctly. Run a
npm rebuild node-sass to fix the issue.
Onyx.ShiftScheduler.Docker.sln solution instead for Visual Studio docker support and start the container. The containerized solution uses
9087 as the service port.
npm run build or
ng build to build the Angular project. The artifacts will be saved in
dist\ folder, or run the project by using the PowerShell script
up.ps1 provided in
Remember to use
docker-compose build or run the
build.ps1 before running the script and starting a new container.
The Angular project uses port
9089 in production mode and will consume the API on port