
A few weeks ago, I shared an A-Z guide on how to deploy a React(Vite) application in Choreo. Today, I'm going to show you how to deploy a Next.js application in Choreo by WSO2.
First, if I explain a bit about Choreo, it's an AI-Native internal developer platform (IDP). This system enables the simplification and acceleration of cloud-native application development, deployment, and management. It provides a unified platform for both platform engineers and software developers, offering a range of services through a single interface.
Now, let's get back to our main topic. This is one way to deploy Next.js applications on Choreo. So, as I explained in my previous article, on choreo, we can't directly import things from envs like in the example below.
❌ const apiUrl = process.env.NEXT_PUBLIC_API_URL
We should configure all these variables from the window configs. This window config is a custom global object that developers (or a framework/platform) inject into the browser at runtime to expose configuration values to client-side code. So when you build the project, make sure to access the service API URLs through the window configs. In this tutorial, I centralize all my axios calls using the base URL.
First, I create a runtimeconfig.jsx file in my utils folder and add window configs there.
import api from "@/utils/axios";
Thank you!