Truong Van Luyn /
← Skill catalog

PM2

PM2 to run Node.js APIs in production, including cluster mode across all CPU cores with memory-based restarts.

In practice

An online grocery store with live payment updates

A grocery shop with a Next.js storefront and admin area and a NestJS API, using QR bank payments, live order and payment updates, and push notifications.

Problem
Customers pay by scanning a bank QR code, so the storefront has to learn when the payment arrives without the customer refreshing. Staff need to see new orders as they come in.
Contribution
Sole developer: storefront, admin area, API, database schema, payment and notification integrations, and the PM2 production setup.
Approach
A Next.js storefront and admin area built with Tailwind and Recharts. It talks to a NestJS API with modules for products, cart, orders, promotions, payments, notifications and site settings, using Prisma over PostgreSQL. Payments create VietQR/PayOS QR codes. When a payment is confirmed, a Socket.IO gateway pushes the status to that checkout session's room and alerts an admin feed room. Firebase Cloud Messaging sends push notifications. The API runs under PM2 in cluster mode.
Outcome
A working storefront and admin dashboard with QR checkout, live payment status, promotions and push notifications. The frontend is deployed on Vercel.

A multi-tenant point-of-sale platform

A point-of-sale product for small shops — a checkout app that keeps selling offline, an owner dashboard, a platform-admin console and subscription billing — built and deployed end to end.

Problem
Small shops need to ring up sales, track stock and close shifts on whatever device is at the counter, and they cannot stop selling when the connection drops. Each shop's data must stay isolated on one shared backend, and the platform has to bill shops for their plans.
Contribution
Sole developer. I designed and built the Angular checkout and admin apps, the NestJS API, the PostgreSQL schema, the realtime and offline sync, the billing and payment integrations, the CI pipeline and the EC2 deployment.
Approach
An Nx monorepo holds three apps: an Angular point-of-sale web app with a service worker and IndexedDB, an Angular platform-admin console, and a NestJS API on Fastify with Prisma over PostgreSQL. Tenancy is enforced in middleware that derives the shop from the access token, while the platform-admin plane uses a separate secret and never gets a shop context. Redis backs BullMQ jobs for work such as invoice renewal. Sales events reach open devices over WebSockets. Production runs on EC2 behind nginx with PM2, TLS from Let's Encrypt, and PostgreSQL on RDS.
Outcome
The product covers checkout, returns, inventory reservation, shelf-life lots, shifts, sales analytics, receipts, store settings, staff, VietQR and SePay payments, plan subscriptions with auto-renewal, and a platform-admin console. CI lints, tests and builds affected projects, enforces a bundle budget, scans for CVEs with Trivy and runs Playwright end-to-end tests.