Setting Up Node Js With Typescript

node js with typescript (image credit: Gemini)

We are going to create folders and install packages in this step. I don’t have much to say for this tutorial. I have tried to explain necessary stuff through comments. In my opinion code is self-explanatory. So, let’s execute these commands in a sequence.

# create a directory
mkdir backend

# change directory
cd backend

# create the `src` directory inside the `backend`.
mkdir src

# create file
touch src/index.ts 

# initialize node js project. 
# Please stay inside the `backend` directory. 
npm init -y 

# install these packages
npm install express cors

# install the dev dependencies
# these packages won't be shipped to your production bundle
npm install -D typescript tsx @types/node @types/express @types/cors

# generate tsconfig.json file
npx tsc --init

Folder structure should look like this.

[Read More]

Lazy Loading and N+1 Query Problem in Entity framework Core

n+1 query problem in entit framework core

💻Source code

Lazy loading

You load related entities on demand rather loading at once. This approach is usually useful when you want to load related entities on a certain condition (otherwise always use eager loading).

To enable lazy loading, you need to install this package: Microsoft.EntityFrameworkCore.Proxies

And do following changes in Program.cs

builder.Services.AddDbContext<AppDbContext>(o=>o.UseLazyLoadingProxies()
.UseSqlite("Data Source = mydb.db"));

Look at the example below:

app.MapGet("/", async (AppDbContext context) => {
    foreach (var genre in await context.Genres.ToListAsync()) 
    {
        foreach (var book in genre.Books)
        {
            Console.WriteLine($"===> genre: {genre.Name}, Book: {book.Title}, Price : {book.Author}");
        }
    }
    return Results.Ok("Ok");
});

We are not loading books with genres at once. Rather we are loading books for each genres. Let’s take a look at logs of console.

[Read More]

Content Negotiation in Dotnet Core Webapi

content negotiation in dotnet web apis

As defined in rfc2616 - “Content nagotiation is the process of selecting the best representation for a given response when there are multiple representations available.”

Clients passes the header Accept with values like application/json,application/xml etc and tells this format is acceptable. Then server gives the response according to that.

In simpler terms, if your API supports xml, json and csv media type, then let clients decide which kind of media type they need as a response.

[Read More]

Containerizing Dotnet App With PostgreSql Using Docker Compose

Containerizing A .NET App With Postgres Using Docker Compose

In this tutorial, we are going to containerize the .NET Web API application with docker and postgres. I am assuming you are familiar with docker. At least, you should have some understandings of how docker works. However, I have covered all the steps needed to create a docker container for your application, but I am not going to cover the theoretical concepts of docker.

[Read More]

Containerizing Dotnet App With Sql Server Using Docker Compose

running dotnet core app in docker with postgres

In this tutorial, we are going to containerize the .NET Web API application with docker. I am assuming you are familiar with docker. At least, you should have some understandings of how docker works. However, I have covered all the steps needed to create a docker container for your application, but I am not going to cover the theoretical concepts of docker.

Last updated on:

  • 20-November-2025

🔨Tools needed

  • Visual Studio Code (Free)
  • .Net 10.0 SDK (Free)
  • Docker desktop (Free)

🧑‍💻Tech used

  • .Net 10.0 Web APIs (controller APIs)
  • Ms SQL Server 2025 (within a container)
  • Docker compose

🍵Note: I am using windows 11 operating system. However, I also have tested it in the Linux mint xia and it is working fine.

[Read More]

Fastapi CRUD With Postgres

fast api with postgres sqlalchemy and alembic

In this tutorial we learn to create REST Apis with fastapi. We are going to use:

  • FastApi for creating APIs
  • PostgreSQL as a database
  • SQLAlchemy as an ORM tool
  • Alembic as a migration tool

Tech and tools used

  • Linux os (you can use window or mac also. But with windows your commands might be a little different. I suggest you to use GitBash in windows)
  • I am using uv to create project, you can download it from here
  • Python 3.12
  • VS Code (code editor) with extension Python by microsoft
  • PostgreSQL (I am using it in a docker container, you can use installed version too)

The reason I am using uv, because it is pretty fast and I can easily manage dependencies with it.

[Read More]

Azure Key Vault With Dotnet

key vault

First of all, let’s see what are we going to achieve? Let’s say we have an dotnet 9 api application.

Its appsettings.json looks like:

 "Color": "Color from appsettings",
 "Person": {
   "Name": "Name from appsettings"
 }

Let’s try to retrieve these values:

app.MapGet("/", (IConfiguration config) =>
{
    string color = config.GetSection("Color").Value ?? "No color";
    string name = config.GetSection("Person:Name").Value ?? "No name";
    return Results.Ok(new
    {
        color,
        name,
        message = "Hello there..."
    });
});

If you visit this endpoint, you will see this output:

[Read More]

Azure App Configuration With Dotnet(C#)

Azure app configuration in c# dotnet

  • Azure App Configuration is a fully managed service, which provides you a way to store the configurations in a centralized store. You can store configurations of multiple apps in a single place.
  • It is really helpful for cloud native application (eg. Microservices), which runs on multiple virtual machines and use multiple external services.
  • It allows us to store Key-value pairs, manage feature flags, and organize configurations using labels and namespaces.
  • The main benefit is, it supports dynamic refreshing. Which means, you can change config values without restarting the app.
  • You can also add reference of azure key vault secret here.

Let’s see these things in action.

[Read More]

Azure Blob Storage : CRUD With AspNetCore Mvc & SQL Server

Azure blob storage crud operations with .net core mvc and sql server

Azure blob storage is a storage solution provided by microsoft. You can store data like images, audio, video, json files, zip files etc etc in the azure.

What are we going to learn?

  • How to create a web application that stores and manipulate the images in the cloud.
  • We will perform all the CRUD (create, read, update and delete) operations.

Tech used

  • .NET Core 9 (MVC app)
  • SQL server 2022
  • Azure storage account

High level overview

  • We will save image url in the database and images in the storage account(blob container)

Let’s create an storage account first

Step 1: create azure storage account 1

[Read More]

Cosmos DB For NoSQL - CRUD With Dotnet

Cosmos DB for NoSQL

Azure Cosmos DB for NoSQL is a fully managed and serverless NoSQL and vector database for modern app development, including AI applications and agents. With its SLA-backed speed and availability as well as instant dynamic scalability, it is ideal for real-time NoSQL applications that require high performance and distributed computing over massive volumes of NoSQL and vector data.

Soruce: learn.microsoft.com, you can learn more about it from here

[Read More]