Blog Post

Microsoft Developer Community Blog
5 MIN READ

Crafting Future-proof Apps with JavaScript & Azure Cosmos DB | Azure Developers JavaScript Day 2024

Glaucia_Lemos's avatar
Glaucia_Lemos
Icon for Microsoft rankMicrosoft
May 10, 2024

 

Continuing with a series of articles about the Azure Developers JavaScript Day 2024Sajeetharan Sinnathurai a Principal Product Manager on the Azure Cosmos DB Team at Microsoft, delivered an enlightening session titled "Crafting Future-proof Apps with JavaScript & Azure Cosmos DB". He delved into the Developer Experience with Cosmos DB, highlighting the latest updates to the JavaScript SDK and the new integration with Vercel for seamless application deployment.

 

But, before we proceed with the article, let's first understand what Azure Cosmos DB is.

 

What is Azure Cosmos DB?

 

 

Something that many people don't know (or maybe they do, but haven't looked into it) is that Azure Cosmos DB is a globally distributed multi-model database, developed for modern applications and to meet the demands of scability and availability. It offers native support for a variety of data models, including documents, graphs, key/value, column families, allowing developers to create applications with a variety of data needs!

 

The three main features of Azure Cosmos DB are:

 

  • Real-time Intelligent Apps

    • Build real-time apps: power responsive and intelligent apps with real-time data, ingested and processed at any scale.
    • Get built-in vector search: query vectors and relevant data efficiently in the same database with MongoDB vCore and distributed PostgreSQL.

 

  • Flexible Development

    • Handle any data, any amount: fuel your apps with high-performance, distributed computing over massive volumes of unstructured data.
    • Get flexible app development: explore free dev/test options, multiple SDKs, and support for Open-source PostgreSQL, MongoDB and Apache Cassandra.

 

  • Fast and Optimized

    • Drive fast user experiences: build responsive, high-performance customer-facing apps with <10ms latency reads and writes at any scale.
    • Support mission-critical apps: Get SLA-backed 99.999 percent availability for NoSQL data, continuous backup, and enterprise-grade security.
    • Optimize costs: pay for only what you use with serverless or autoscale options and enjoy unlimited elastic scale.

 

Not forgetting to mention that the Azure Cosmos DB API allows you to access different data models, such as:

 

 

 

And of course we can't forget that with Azure Cosmos DB you can use the service to create Generative AI Applications!

 

 

Now that we understand a little more about Azure Cosmos DB, let's understand what was covered during the session!

 

What was covered during the session?

 

Let's understand step by step what was covered during the session! If you wish, you can review the session in the video below:

 

 

 

Introduction

 

Sajeetharan began by introducing Azure Cosmos DB, emphasizing its appeal to developers due to its fully managed service, multi-model support, and global distribution capabilities.

 

He detailed the service level agreements, cost-effective scaling, and comprehensive security features, presenting Cosmos DB as an ideal backend for modern application needing high availability and low latency.

 

Enhancements in JavaScript SDK

 

The session then transitioned into a deep dive into the improvements in the JavaScript SDK, particularly the recent launch of version 4.0. Sajid highlighted several key features:

 

  • Client Request Diagnostics: Enhanced insights into database operations to improve troubleshooting.

  • Hierarchical Partition Keys: Improved data distribution and query performance, essential for SaaS and multi-tenant applications.

  • Change Feed Support: Allows applications to respond to data modifications in real time.

 

JavaScript SDK v4 for Azure Cosmos DB

 

A significant portion of the presentation was dedicated to a live demonstration of a sample application that leverages the JavaScript SDK.

And also, Sajeetharan showcased how developers could utilize the JavaScript SDK to create, retrieve, update, and delete database records, emphasizing the SDK's capabilities to handle complex queries and operations efficiently.

 

If you would like more information about the updates to the JavaScript SDK v4 for Azure Cosmos DB, Sajeetharan wrote an excellent article on the subject, which you can access at the link.

 

About the Sample Application: A RAG Application with Azure Cosmos DB and Next.js

 

 

 

This application, built with Next.js and React, uses Azure Cosmos DB to store session data from OpenAI ChatGPT interactions. Sajeetharan showcased the application's capabilities, including the seamless integration of Cosmos DB with Vercel for deployment.

 

 

Vercel Integration for Easier Deployment

 

Another highlight was the introduction of the Azure Cosmos DB integration with Vercel. This integration aims to simplify the deployment process for developers, allowing them to deploy their applications directly from Vercel with Cosmos DB as the backend, without incurring additional costs.

 

Sajeetharan demonstrated this by deploying a chat application, which utilizes the Rack pattern for storing session data, directly through Vercel.

 

 

 

Sajeetharan concluded the session by providing resources for further learning and exploration of Azure Cosmos DB and its capabilities. He encouraged attendees to experiment with the newly introduced features and to leverage the Vercel integration for streamlined deployment of their applications.

 

If you want to access the application's source code, you can access it on GitHub.

 

Key Takeaways

 

The session offered a comprehensive overview of how Azure Cosmos DB and the latest enhancements to the JavaScript SDK can help developers build robust, scalable, and future-proof applications.

 

With the integration of Vercel, Azure Cosmos DB continues to enhance its accessibility and utility for modern web development, ensuring that developers can focus more on their application's functionality and less on infrastructure management.

 

The detailed demonstration and the resources provided serve as a valuable toolkit for any developer looking to harness the power of Azure Cosmos DB in their JavaScript applications, making this session a cornerstone of the JavaScript Dev Day event.

 

Azure Developers JavaScript Day Cloud Skills Challenge

 

 

Do you want to test your knowledge and skills in a series of learn modules and learn more about Azure services and tools? Don't forget to participate in the Azure Developers JavaScript Day Cloud Skills Challenge. Even though the challenge is over, you can still access the content and learn more about the topics covered during the event.

 

Link to the challenge: JavaScript and Azure Cloud Skills Challenge

 

Additional Resources

 

If you want to learn more about Azure Cosmos DB and its integration with JavaScript, you can access the following resources:

 

 

Stay Tuned for More!

 

If you wish, you can follow what happened during the two days of the event via the playlist on YouTube. The event was full of interesting content and insights for JavaScript developers!

 

If you are a JavaScript/TypeScript developer, follow me on Twitter or LinkedIn Glaucia Lemos for more news about the development and technology world! Especially if you are interested in how to integrate JavaScript/TypeScript applications with the Azure Cloud, Artificial Intelligence, Web Development, and more!

 

Stay tuned for more articles about the Azure Developers JavaScript Day 2024, where we will continue to explore the latest updates and insights shared during the event.

 

And see you in the next article!

 

Published May 10, 2024
Version 1.0
  • ArchitectBond's avatar
    ArchitectBond
    Copper Contributor

    This is a joke right? JavaScript is a horrific language and the decision to use as a back end language is mind boggling. But don't take my word for it, go to the Data Explorer in the Azure portal, pick any entity with a number value, set it to 345896229870334651 and watch what happens. If you think it's a portal issue, it's not. Save an entity with that value via the SDK and the database stores the value just fine. So it is a portal issue! It's not. Now pass an entity with that value to a stored procedure and save it. BOOM, your data has just been corrupted. Why?

     

    BECAUSE JAVASCRIPT IS THE WORST LANGUAGE IN THE HISTORY OF THE UNIVERSE.

     

    Yep, if you store 64 bit values, you can't use Cosmos triggers or stored procedures because they're implemented in JavaScript. And if you do, you're sitting on a ticking time bomb.

     

    When is the Cosmos team going to wake up, abandon this horrific language, and offer developers a real language to develop code in?

  • Hi ArchitectBond Can you elaborate more? are you talking about Javascript language in general or specific to JS SDK for Azure Cosmos DB?