Loading...

Azure Cosmos DB for PostgreSQL w/ React Quickstart

Azure Cosmos DB for PostgreSQL w/ React Quickstart

Azure Cosmos DB for PostgreSQL and React

 

Introduction

I’m so excited to ‘introduce’ you to a new addition to Azure Cosmos DB service. At Ignite 2022, Microsoft made an announcement for PostgreSQL in Azure CosmosDB!

 

In this blog we will show you how to connect your Front end app to the Azure Cosmos DB for PostgreSQL service in Azure.

 

This is the beginning of a larger series so not all the features you see on the app are complete. We will walk this journey together as we add more production level of deployment into the repo. (Aka. Key-Vault for secrets, Managed Identity and Infrastructure As Code. :))

 

What is Azure Cosmos DB for PostgreSQL?

DanielKim_1-1667238178402.png

 

Azure Cosmos DB - is a fast, distributed NoSQL database. Scalable with 99.999% availability! (Get started)

 

PostgreSQL - Here are some reasons why you might want to use PostgreSQL –

  • Free and Open-Source
  • Runs on wide range of Operating Systems (But this could be a moot point Azure Cosmos DB for PostgreSQL will be hosted on the cloud)
  • Many data types (eg. Boolean, range)
  • More info here

 

Azure Cosmos DB for PostgreSQL has combined these two technologies and extended with Citus extension to bring distributed tables for PostgreSQL. Combining Azure Cosmos DB’s high scalability and Citus’s distributed tables allows for maximum performance with PostgreSQL. 

 

DanielKim_0-1667229087720.png

 

Let’s Get Started!

 

Azure

Let's go to the Azure Portal and click ‘+ Create a resource’. Then search for ‘Azure Cosmos DB’

 

Once you select Azure Cosmos DB you will see these options:

DanielKim_1-1667229087739.png

 

Select ‘Azure Cosmos DB for PostgreSQL’

DanielKim_2-1667229087744.png

 

Choose your ‘Cluster name’ and ‘Password’. (You will use these values in the next step.)

 

Code

Go and clone/fork this repo: GitHub - i-am-dan/CosmosDb-PostgreSQL-Quickstart - Repo contains both the front-end and the back-end.

 

Once you clone the repo, go to ‘Server/db/citus.js’

DanielKim_3-1667229087746.png

 

Please replace ‘<cluster>’ and ‘<password>’ with the values you put in from the previous step.

 

Go to your favorite cli tool then go to the React folder and run:

 

 

 

 

 

npm start

 

 

 

 

 

 

You will see:

DanielKim_4-1667229087748.png

 

 

Now go to the Server folder and run:

 

 

 

 

 

node ./index.js

 

 

 

 

 


Reset will create the table of Pharmacy in the Citus Database with seed data.

 

Load’ will load the dataset into the view.

 

Delete All’ will drop the table.

 

(I haven’t worked on the ‘Add Pharmacy’ and ‘Delete Selected’, YET, so they are disabled… lol)

 

It’s easy as that! You’ve created your first React app with Azure Cosmos DB for PostgreSQL.

 

I hope this set a good foundation for anyone to go start making something awesome!

 

 

Side note:  

Please be advised that Azure Cosmos DB’s cost could go up fast if you want to really leverage the full power of it’s scalability and multi-region support. (We always recommend using the Azure Pricing Calculator to get a transparent estimate)

 

Published on:

Learn more
Azure Developer Community Blog articles
Azure Developer Community Blog articles

Azure Developer Community Blog articles

Share post:

Related posts

Azure Developer CLI (azd) – May 2025

This post announces the May release of the Azure Developer CLI (`azd`). The post Azure Developer CLI (azd) – May 2025 appeared first on ...

8 hours ago

Azure Cosmos DB with DiskANN Part 4: Stable Vector Search Recall with Streaming Data

Vector Search with Azure Cosmos DB  In Part 1 and Part 2 of this series, we explored vector search with Azure Cosmos DB and best practices for...

12 hours ago

General Availability for Data API in vCore-based Azure Cosmos DB for MongoDB

Title: General Availability for Data API in vCore-based Azure Cosmos DB for MongoDB We’re excited to announce the general availability of the ...

12 hours ago

Efficiently and Elegantly Modeling Embeddings in Azure SQL and SQL Server

Storing and querying text embeddings in a database it might seem challenging, but with the right schema design, it’s not only possible, ...

1 day ago

Power Platform Data Export: Track Power Apps Usage with Azure Data Lake and Power BI

With the Power Platform admin center, you can export Power Platform inventory and usage data directly into Azure Data Lake Storage for advance...

2 days ago

Top 30 D365 CRM Developer Interview Questions to Master JavaScript Plugins and Azure Integration

As a Microsoft Dynamics 365 CRM Developer with over three years of experience, you’re expected to have a strong grasp of core CRM functi...

4 days ago

Introducing Azure DevOps ID Token Refresh and Terraform Task Version 5

We are excited to share some recent updates that improve the experience of using Workload identity federation (OpenID Connect) with Azure DevO...

5 days ago

Webinar: Translate Dynamics 365 Data in Real-Time using Azure AI Translator with our New App!

Is your business operating across multiple regions? Managing multilingual CRM data in Microsoft Dynamics 365 can lead to communication gaps, d...

6 days ago
Stay up to date with latest Microsoft Dynamics 365 and Power Platform news!
* Yes, I agree to the privacy policy