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

Authentication Configuration

The Codebreaker platform uses Microsoft External ID (formerly Azure AD B2C) for authentication across all components.

Documentation

Quick Setup

For the Gateway service with Azure AD B2C:

  1. Configure appsettings.json:
{
  "AzureAdB2C": {
    "Instance": "https://<tenant>.b2clogin.com",
    "Domain": "<tenant>.onmicrosoft.com",
    "ClientId": "<client-id>",
    "SignUpSignInPolicyId": "B2C_1_SUSI"
  }
}
  1. The API connectors need to be updated after publishing the backend:
    • Set Endpoint URLs to https://<gateway>/users/api-connectors/validate-before-user-creation and https://<gateway>/users/api-connectors/enrich-token
    • Store the basic-authentication password in gateway-keyvault with the key AADB2C-ApiConnector-Password
    • Set that password in the API connectors configuration

For detailed configuration instructions for all platforms, see the authentication documentation.

About

No description, website, or topics provided.

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Contributors 5