title: "Deployment"
A Vendure application is essentially a Node.js application, and can be deployed to any environment that supports Node.js.
The bare minimum requirements are:
A typical pattern is to run the Vendure app on the server, e.g. at http://localhost:3000 an then use nginx as a reverse proxy to direct requests from the Internet to the Vendure application.
Here is a good guide to setting up a production-ready server for an app such as Vendure: https://www.digitalocean.com/community/tutorials/how-to-set-up-a-node-js-application-for-production-on-ubuntu-18-04
For a production Vendure server, there are a few security-related points to consider when deploying:
By default, Vendure uses auto-increment integer IDs as entity primary keys. While easier to work with in development, sequential primary keys can leak information such as the number of orders or customers in the system. For this reason you should consider using the UuidIdStrategy for production.
import { UuidIdStrategy, VendureConfig } from '@vendure/core';
export const config: VendureConfig = {
entityIdStrategy: new UuidIdStrategy(),
// ...
}
If you wish to deploy with Kubernetes or some similar system, you can make use of the health check endpoint. This is a regular REST route (note: not GraphQL), available at /health.
REQUEST: GET http://localhost:3000/health
{
"status": "ok",
"info": {
"database": {
"status": "up"
},
"worker": {
"status": "up"
}
},
"error": {},
"details": {
"database": {
"status": "up"
},
"worker": {
"status": "up"
}
}
}
Health checks are built on the Nestjs Terminus module. You can also add your own health checks by creating plugins that make use of the HealthCheckRegistryService.
If you have customized the Admin UI with extensions, it can make sense to compile your extensions ahead-of-time as part of the deployment process.