-
Bulk of the "magic" takes place at startup.cs and
IdentityServerBuilderExtensions.cs. A quick look at those classes should shed some light. -
MongoDB connectivity is based on nugets and on a simple Repository Design Pattern implementation. See interface/IRepository & /interface/MongoRepository classes - everything comes togheter with .NET Core Dependency Injection (see startup.cs & IdentityServerBuilderExtensions.cs)