Skip to content

CodebreakerApp/Codebreaker.Backend

Repository files navigation

Codebreaker Backends

This is the GitHub repo for the backend services of the Codebreaker solution.

See these repositories for clients:

See this repository for the book covering the backend solution:

Pragmatic Microservices with C# and Azure

Version 3

This repository has been updated with the source code from the book, but is updated and enhanced continuously.

Games API

The new Games API service with access to SQL Server and Azure Cosmos DB. Currently, you need to run this locally. A hosted version will be available at a later date.

Analyzers Library

The analyzers library CNinnovation.Codebreaker.Analyzers is used in the backend to return results based on a game move. This library is used by the games API, and you need it creating your own custom games. Ths source code is available in this repository.

NuGet: https://www.nuget.org/packages/CNinnovation.Codebreaker.Analyzers

Backend Models

This backend models library CNinnnovation.Codebraker.BackendModels contains models for the Codebreaker app. Reference this library when creating a Codebreaker service, or use it from data access libraries.

NuGet: https://www.nuget.org/packages/CNinnovation.Codebreaker.BackendModels

Database Libraries

This database libraries CNinnnovation.Codebraker.Cosmos and CNinnnovation.Codebraker.SqlServer contain EF Core contexts for the Codebreaker app. Reference one or both of these libraries storing games to the database.

NuGet Cosmos: https://www.nuget.org/packages/CNinnovation.Codebreaker.Cosmos

NuGet SQL Server: https://www.nuget.org/packages/CNinnovation.Codebreaker.SqlServer

Client Library

The library CNinnovation.Codbreaker.Client is used by client applications to access the game APIs.

NuGet: https://www.nuget.org/packages/CNinnovation.Codebreaker.GamesClient

Codebreaker Package Feeds

CNinnovation Codebreaker packages on NuGet

Codebreaker Packages daily builds on Azure DevOps

Builds

Libraries

Preview versions

Branch Analyzers Backend models Cosmos SQL Server Client Library
main Analyzers Backend models Cosmos SQL Server Client Library

Released versions

Branch Analyzers Backend models Cosmos SQL Server Client Library
main Analyzers Backend models Cosmos SQL Server Client Library

Integration Tests

TODO: this test will move to this repo

Branch Game API
main Test Game API Integration

Guidelines

Guidelines

Codebreaker Services

  • Gateway - a YARP service acting as reverse proxy
  • Games API - the games API using Azure Cosmos DB and Redis for a game cache, and using Azure Event Hub for notification on completed games
  • Live service - using SignalR to monitor completed games, using the Event Hub to receive information on completed games, and offers SignalR to subscribe to this information
  • Ranking - using Event Hub to receive completed games, offering a REST API to see ranking information

Codebreaker Client apps

Register an account and play the games!

Azure Services in use

  • Azure Container Apps
  • Azure Cosmos DB
  • Azure Active Directory B2C
  • Azure SignalR Services
  • Azure App Configuration
  • Azure Event Hub
  • Azure App Services
  • Azure Storage message queue
  • Azure Key Vault

Configuration authentication with Azure AD B2C

With AADB2C, the API connectors need to be updated after publishing the backend, by:

  • setting the Endpoint URLs to https://<>/users/api-connectors/validate-before-user-creation and https://<>/users/api-connectors/enrich-token
  • setting the basic-authentication password in the gateway-keyvault with the key AADB2C-ApiConnector-Password
  • and setting that password in tha API connectors