Node.js Server

Deploying a Fastify application involves generally the same steps in deploying any Node.js application to production — copy code to server, npm install dependencies and run (node server.js).

A few things to keep in mind:

  • Try and follow Fastify's deployment recommendations.

  • Your Vite application must be bundled before it can be served in production. After the build, your application bundle will be available in ./dist (default).

  • Be mindful about Vite's settings, such as build.outDir (./dist) and build.assetsDir (assets).

  • If you accidentally set dev to true in your fastify-vite plugin settings, you'll be using Vite's development server instead of the live rendering handler provided by your chosen framework (via the renderer adapter). Vite's development server is automatically turned off in case the NODE_ENV environment variable is set to production when the application boots.

Anything beyond that is likely related to the particular server platform you're deploying to.

You'll need Node v14+.