Skip to main content
Version: 2.5.0 (terbaru)

Deployment Checklist

Set the Node.JS environment to production#

Set the NODE_ENV environment variable to production.

NODE_ENV=production npm run start

Use HTTPS#

You must use HTTPS to prevent man-in-the-middle attacks. Otherwise, your credentials and authentication tokens will appear in clear on the network.

If you use cookies, make sure to let them only be sent to the server when the request is made using SSL. You can do such thing with the cookie secure directive.

config/production.yml (example)

settings:  // If you use sessions  session:    cookie:      secure: true  // If you use JWT  jwt:    cookie:      secure: true

Generate Different Secrets#

Use different secrets for your production environment (JWT, etc). Specify them using environment variables or a .env file.

.env (example)

SETTINGS_JWT_SECRET=YZP0iv6gM+VBTxk61l8nKUno2QxsQHO9hm8XfeedZUw

You can generate 256-bit secrets encoded in base64 with the following command:

foal createsecret

Database Credentials & Migrations#

Use different credentials for your production database. Specify them using environment variables or a .env file.

If you use database migrations, run them on your production server with the following command:

npm run migrations

Files to Upload#

If you install dependencies and build the app on the remote host, then you should upload these files:

config/ormconfig.jspackage-lock.jsonpackage.jsonpublic/ # this may depend on how the platform manages static filessrc/tsconfig.app.json

Then you will need to run npm install and npm run build.

If you install dependencies and build the app on your local host directly, then you should upload these files:

build/config/node_modules/ormconfig.jspackage-lock.jsonpackage.jsonpublic/ # this may depend on how the platform manages static files