In December 2023, Elastic Mint celebrated five years of partnership with Preqin, a leading financial services company providing data and insights in the global alternatives community. During this period, we were involved in a number of projects related to Preqin Pro, their alternative assets data platform.
One of the challenges of developing APIs for systems that contain many moving parts is that they often depend on multiple external services. This can lead to developers needing to configure lots of things on their local machine before they can debug. Very often, the knowledge relating to setting up a developer machine is in an out-of-date document somewhere. It may even be locked in the mind of whichever developers have been around the longest!
At Elastic Mint, we believe that a developer should be able to check out the latest code from source control and start working on it as quickly as possible.
During our partnership with Preqin we developed a pattern for developing ASP .Net Core APIs using Docker to enable the API to run against any external dependencies while debugging in Visual Studio. This involved creating a Dockerfile for the API and then creating a Docker Compose project which included any external dependencies. These dependencies could be a database like MongoDB or SQL Server, an AWS service or another API.
We were able to include the Docker images for specific versions of database that were used in the production environment. We used tools like LocalStack to emulate AWS and MockServer to mock other APIs. The default configuration meant the API would work against all these dependencies.
The end result was that a developer could get the code from source control, open the solution in Visual Studio, specify the startup project and then immediately start debugging. This will avoid hours of installing services and frustration because no one remembers how to set up a developer machine.
Having developed the patterns, we built a Visual Studio template to provide a starting point for new APIs. Over the course of a year, this template was used many times, saving countless hours not only during initial development but also for future developers who will maintain these APIs.
Technologies: ASP .Net Core, Elasticsearch, XUnit, Docker