Hi, @gunslingor-gmailcom! Welcome to the Vercel Community 
Thanks for your patience with this. Did you manage to figure out a solution?
It looks like you could make some improvements to your project structure. Perhaps something like:
[root][root]
βββ api
β βββ index.js (your Express app)
β βββ package.json (dependencies for your API)
βββ vercel.json
βββ package.json (root package.json for the monorepo)
Your vercel.json file should look something like:
{{
"version": 2,
"builds": [
{
"src": "api/index.js",
"use": "@vercel/node"
}
],
"routes": [
{
"src": "/(.*)",
"dest": "api/index.js"
}
]
}
This configuration tells Vercel to use the Node.js runtime for your API and routes all requests to your Express app.
Donβt forget to make sure your Express app in api/index.js is set up correctly. For example:
const express = require('express');const express = require('express');
const app = express();
app.get('/', (req, res) => {
res.send('Hello World!');
});
// Important: listen on `process.env.PORT` for Vercel
const port = process.env.PORT || 3000;
app.listen(port, () => {
console.log(`Server running on port ${port}`);
});
module.exports = app;
Other issues you ran into:
- Run
vercel dev from the root of your project, not from the api directory. Make sure you have the Vercel CLI installed globally (npm i -g vercel).
- If youβre not using Yarn, make sure your
package.json files (both in the root and in the api directory) have a "type": "commonjs" field. This ensures that Node.js treats your files as CommonJS modules.
- The updated
vercel.json configuration should resolve this issue. It properly routes requests to your Express app instead of serving static files.
To set up your monorepo for future expansion (GUI, native, shared modules), you can create additional directories at the root level:
[root][root]
βββ api
β βββ index.js
β βββ package.json
βββ gui
βββ native
βββ shared
βββ vercel.json
βββ package.json
You donβt necessarily need to use Turborepo for this setup, although it can be beneficial for larger monorepos. The current structure should work well with Vercel.
Let us know how you get on!