Problem
The project cannot run as a standalone Node.js service because api/index.js creates and exports the Express application but never starts an HTTP listener.
package.json defines the start command as:
However, api/index.js ends by exporting the app without calling app.listen(...). In a regular Node/Pterodactyl-style container, the process therefore exits after module initialization instead of staying alive to serve requests. The current export-only behavior is appropriate for serverless deployments such as Vercel, but it prevents self-hosted deployments from starting.
Expected behavior
Running npm start should keep the process running and accept HTTP requests on the port supplied through process.env.PORT.
Suggested change
Start the server only when the module is executed directly, while retaining the export for serverless use:
if (require.main === module) {
app.listen(PORT, "0.0.0.0", () => {
console.log(`API listening on port ${PORT}`);
});
}
module.exports = app;
Binding to 0.0.0.0 allows the service to be reachable through container networking. The require.main guard preserves compatibility with platforms that import api/index.js as a handler.
Acceptance criteria
npm start keeps the Node.js process alive.
- The service listens on
process.env.PORT (falling back to the existing default of 3000).
- The application binds to
0.0.0.0 for container hosting.
module.exports = app remains available for Vercel/serverless deployments.
Problem
The project cannot run as a standalone Node.js service because
api/index.jscreates and exports the Express application but never starts an HTTP listener.package.jsondefines the start command as:However,
api/index.jsends by exporting the app without callingapp.listen(...). In a regular Node/Pterodactyl-style container, the process therefore exits after module initialization instead of staying alive to serve requests. The current export-only behavior is appropriate for serverless deployments such as Vercel, but it prevents self-hosted deployments from starting.Expected behavior
Running
npm startshould keep the process running and accept HTTP requests on the port supplied throughprocess.env.PORT.Suggested change
Start the server only when the module is executed directly, while retaining the export for serverless use:
Binding to
0.0.0.0allows the service to be reachable through container networking. Therequire.mainguard preserves compatibility with platforms that importapi/index.jsas a handler.Acceptance criteria
npm startkeeps the Node.js process alive.process.env.PORT(falling back to the existing default of3000).0.0.0.0for container hosting.module.exports = appremains available for Vercel/serverless deployments.