MFlix - A C# .NET 5 Project
Tags: showdev, csharp, api
Published: 2021-04-06 09:01:26

---
title: MFlix - A C# .NET 5 Project
published: true
description: A showcase of how to build API's (REST, gRPC, GraphQL) using C# .NET
tags: showdev,csharp,api
cover_image: https://user-images.githubusercontent.com/33935506/114293752-d9aec100-9aec-11eb-8b5b-e04477d9dda0.png
---

## Intro

I have created a project that demonstrates how to build 3 API's using 3 different API tehnologies, namely **GraphQL**, **gRPC**, and **REST (HTTP)**. I have also chosen to use _MongoDB_ as my database.

[You can find the project on github](https://github.com/drminnaar/mflix). The project has been built and tested on both _Linux_ and _Windows 10_ environments using _Visual Studio Code_ and _.NET 5_.

I provide more detail about the project in the [project README](https://github.com/drminnaar/mflix#readme).

The summary of the project thus far is as follows:

- [Purpose](https://github.com/drminnaar/mflix#1-purpose)
- [Description](https://github.com/drminnaar/mflix#2-description)
- [Infrastructure](https://github.com/drminnaar/mflix#3-infrastructure)
  - [Mongo Seed](https://github.com/drminnaar/mflix#31-mongo-seed)
  - [The Docker Compose File](https://github.com/drminnaar/mflix#32-the-docker-compose-file)
- [Getting Started](https://github.com/drminnaar/mflix#4-getting-started)
  - [Get The Code](https://github.com/drminnaar/mflix#41-get-the-code)
  - [Manage Infrastructure](https://github.com/drminnaar/mflix#42-manage-infrastructure)
  - [Start MFlix gRpc API](https://github.com/drminnaar/mflix#43-start-mflix-grpc-api)
  - [Start MFlix HTTP API](https://github.com/drminnaar/mflix#44-start-mflix-http-api)
  - [Start MFlix GraphQL API](https://github.com/drminnaar/mflix#45-start-mflix-graphql-api)
- [Test MFlix gRPC services](https://github.com/drminnaar/mflix#5-test-mflix-grpc-services)
  - [gRPCurl](https://github.com/drminnaar/mflix#51-grpcurl)
  - [gRPCUI](https://github.com/drminnaar/mflix#52-grpcui)
  - [BloomRPC](https://github.com/drminnaar/mflix#53-bloomrpc)
  - [Insomnia](https://github.com/drminnaar/mflix#54-insomnia)

The following diagram provides a high-level view of what I am building.

![mflix-hla-1](https://user-images.githubusercontent.com/33935506/111857444-58a15580-8996-11eb-8d3f-c3adea46a661.png)

Initially, I thought about creating this project as part of a series of blog posts. However, I decided to instead build the application first. MFlix is by no means complete, but now is a good time to start sharing the work being done due to a number of interesting aspects that I am working on. In the coming months, I will continue to build out MFlix. Also, if there is interest, I would like to provide a series of blog posts where I discuss some of the more interesting aspects of the project.

## About MFlix

I chose _MFlix_ as the name for this project because I am using one of the sample databases provided by MongoDB called MFlix. The MFlix database is composed of collections of movie related data. I provide more detail in the [MongoDB section](https://github.com/drminnaar/mflix#3-infrastructure) where I explain how to get a copy of the MFlix database. Therefore, because of the database name, and the fact that _MFlix_ is a short and catchy name, I decided to go with _MFlix_.

The primary purpose of _MFlix_ is to demonstrate how to build gRPC, REST (http), and GraphQL API's using C# and the .NET Framework. In order to do this, I have created a [contrived use-case](https://github.com/drminnaar/mflix#2-description) that will allow me to demonstrate how to build different API's for different needs. Each API demonstrates how to address the following requirements:

- Error handling
- Logging
- Caching
- Security
- Dependency Injection
- Configuration
- How to do paging, filtering, and sorting via the API

The secondary purpose of _MFlix_ is to demonstrate how to work with different technologies, frameworks, and libraries using the C# .NET Framework. The different topics that will be demonstrated are as follows:

- Developing with MongoDB and C#
- Preparing a local development environment using Docker and Docker-Compose
- Working with MongoDB database
- Working with SEQ as a log server

Lastly, I cover a useful set of tools that can be used to test the various API's. Some of the tools covered are as follows:

- HTTP API
  - [Postman](https://www.postman.com/)
  - [Insomnia](https://insomnia.rest/)
- gRPC API
  - [gRPCurl](https://github.com/fullstorydev/grpcurl)
  - [gRPCUI](https://github.com/fullstorydev/grpcui)
  - [BloomRPC](https://github.com/uw-labs/bloomrpc)
  - [Insomnia](https://insomnia.rest/)
- GraphQL API
  - [Banana Cake Pop](https://chillicream.com/docs/bananacakepop)
  - [Voyager](https://github.com/APIs-guru/graphql-voyager)
  - [Insomnia](https://insomnia.rest/)

## Outro

This was a quick introduction to [MFlix](https://github.com/drminnaar/mflix). I consider what I have done thus far as my _"MVP (Minimum Viable Product)"_. Depending on the feedback, I may follow up with a series of blog posts and maybe a few videos on topics relating to technology and frameworks used within the project. If you like what you see so far, please star the [MFlix](https://github.com/drminnaar/mflix) project.