I did a lot of search on this topic but still don't know a good solution for my problem. So I thought maybe someone can guide me into this.
About the project
We're basically planning to build a shop builder, each shop (website) has the same theme, but its content, which is fetched from an API source, differs from one to another.
So we are going to have a single code base for our front-end application (Next.js app) which renders different pages based on the props we pass to its components. The only way we can tell our app to render different content is by using subdomains. Consider the following component:
const ProductList = () => {
const { data } = useSWR(
"http://example.api/products?subdomain=abc123",
fetcher
);
return (
<ul>
{data?.map((product) => (
<ProductCard product={product} />
))}
</ul>
);
};
Since Next.js is using node.js behind the scene:
My question is, how can I run multiple instances of Next.js processes on a single server, so that we can reduce the costs?
I really appreciate every little help from the community. Thank you for your time. I would be glad to explain it more if you need more details about the problem.