DEV Community

Kasuhiko
Kasuhiko

Posted on

Help with a .net core api architecture

Hi Everyone,

I hope everyone is doing good, today I need some advice to optimize resources to create monolithic API architecture based on .net core and mssql, I got a freelance project from my friend's company and they need to migrate an old nodejs api to API .net core API, this API is going to be used by 40 or 50 users but they want to make it to support at least 100 connections.

basically, this API is going to serve information from 5 different mssql databases to 4 main applications:

1.- Power BI.
2.- Custom-made angular dashboard with reports, charts and stuff.
3.- Custom-made angular intranet.
4.- Excel sheets with dynamic information.

the server provided by my client specs are:

  • INTEL Xeon E5-2670 v2 @ 2.50GHz (2 processors)
  • Windows server 2012 R2
  • 5gb RAM
  • 1gb internet connection (probably optical fiber)

this same server is also used as web server with apache to run the angular app's and the databases are located on others differents servers.

thanks in advance, any advice is very appreciated!!.

Top comments (4)

Collapse
 
webjose profile image
José Pablo Ramírez Vargas

Hi. Unsure as to what aspect of the architecture you are seeking advice with. You seem to have already decided it will be monolithic and in ASP.net 6. The server is selected as well as its OS, and the databases are fixed.

Are you looking for software architecture advice? If so, I must say:

  1. Stay away from Entity Framework. See this article.
  2. Program in layers. The layers I recommend are: Presentation, Services, Validators and Repositories.
  3. Fully respect SOLID.
  4. Try to fully respect REST.

Presentation Layer

Is the controllers. Their only job must be to translate data from or to the HTTP protocol. Stay away from RAD tools or shortcuts like ModelState.IsValid. Controllers have no business in the data validation arena.

Validators

These are specialized services that do one thing, and one thing only as per SOLID: Validate data. Make sure your validators do not stop on the first encountered error. I HATE api's that say "x is bad", so I correct x and retry and they come back and say "y is bad too". Tell me all the errors at once!! :-)

Services

Serivces drive the business workflows as well as provide any other required functionality, like scheduling, providing time, caching service, etc.

Repositories

They store and retrieve data from the databases. They must be dumb. No business logic should appear in them. They should blindly obey when they are called. A repository with no if's is a good repository. :-) I mean for business logic. Sure they can have those to conditionally build queries or something, but not business logic.

Collapse
 
mykezero profile image
Mykezero

ASP NET Core API 6.0 is a good choice for something like this. As a web server, should be able to handle the connections.

How much data are we talking for the PowerBI reports? If there's a lot of data, you could generate the data asynchronously using the Hosted Services feature of ASP:

That should allow you to run a task every X time interval, where you could generate the data and either store it in a SQL table or save it to disk / another location on their network for PowerBI to consume.

I'm not sure what you meant by excel sheets with dynamic information, but Nuget has many packages for creating CSV or XLSX files from your data.

If possible, I would recommend sticking to CSV, since XLSX is a propriety format and would not have as much support as CSV files.

Angular is definitely supported, but I have no experience with the framework.

Definitely let us know if you have any more questions ^^

Collapse
 
mellen profile image
Matt Ellen

While it is cumbersome, .xslx documents are stored in an open format. The format definition is maintained by Microsoft, but it is not proprietary.

Office Open XML SpreadsheetML aka ISO 29500-1

.xsl documents on the otherhand are stored in a proprietary format.

Collapse
 
mykezero profile image
Mykezero

Awesome, learned something new! Thanks!