Reference
Deployment
VPS with Node.js and PM2 (recommended)
You need a Linux server with Node.js 20.19 or newer (22 LTS recommended) and access to MongoDB.
Upload the inner chatcart folder (without node_modules and
.next), then:
cd /var/www/chatcart # the folder with package.json
node -v # v20.19.0 or newer
nano .env.local # MONGODB_URI, JWT_SECRET, APP_URL=https://shop.example.com, UPLOAD_DIR
npm ci
npm run build
npm run create-admin # once, for your owner account
npm install -g pm2
pm2 start "npm run start" --name chatcart
pm2 save
-
npm ciinstalls exactly the versions inpackage-lock.json, so your server runs what we tested. -
Set
UPLOAD_DIRto a folder outside the app, for example/var/chatcart/uploads, so uploaded images survive updates. - Sign-in needs HTTPS in production (see Sign-in does nothing on a server).
-
To update: upload the new files, then
npm ci,npm run buildandpm2 restart chatcart.
Nginx in front of ChatCart
server {
server_name shop.example.com;
client_max_body_size 6m;
location / {
proxy_pass http://127.0.0.1:3000;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
Then get a free HTTPS certificate with Certbot:
sudo certbot --nginx -d shop.example.com. With Caddy, HTTPS is automatic:
shop.example.com {
reverse_proxy 127.0.0.1:3000
}
Add each custom domain under Admin, Stores as well (see Stores and domains).
Vercel and other serverless hosts
Import the project, add the environment variables, and deploy. Storefront and admin pages are
dynamic, so no database is needed during the build. Run
npm run create-admin (or npm run seed) once from your own computer with
the production MONGODB_URI in .env.local.
Serverless file systems are temporary: images uploaded in the admin are lost between deployments.
On such hosts, use HTTPS image links (the CSV import accepts any HTTPS image URL), or deploy to a
VPS instead. In MongoDB Atlas you may need to allow 0.0.0.0/0, because these hosts have no fixed
IP address.