Skip to content

A self-hosted UPI & COD payment gateway with zero per-transaction platform fees, universal JavaScript checkout integration, dynamic QR payments, WhatsApp OTP authentication, and automated payment verification.

JavaScript

feat(docker): add native multi-stage Node.js 24 Alpine containerisation and compose

ArunGupta1526b3253e2c8ce3
diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 0000000..9785ff6
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,23 @@
+node_modules
+npm-debug.log
+.git
+.gitignore
+.env
+.env.*
+!.env.example
+data/*.sqlite*
+data/*.db*
+data/browser-sessions
+data/backups
+logs
+*.log
+.tmp_apk_build
+.gradle
+build
+*.apk
+*.aar
+*.tsbuildinfo
+.DS_Store
+*.md
+docs
+arun-test-ci.md
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..55d2eb2
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,77 @@
+# =============================================================================
+# YOUPI PG V2 — Multi-Stage Production Dockerfile
+# Native NPM Workspaces on Node.js 24 Alpine
+# =============================================================================
+
+# ── Stage 0: Base ────────────────────────────────────────────────────────────
+FROM node:24-alpine AS base
+RUN apk update && apk upgrade --no-cache && apk add --no-cache libc6-compat
+WORKDIR /app
+
+# ── Stage 1: Dependencies ───────────────────────────────────────────────────
+FROM base AS deps
+WORKDIR /app
+
+# Copy root and all workspace package manifests for layer cache optimization
+COPY package.json package-lock.json ./
+COPY packages/common/package.json ./packages/common/
+COPY packages/db/package.json ./packages/db/
+COPY packages/core/package.json ./packages/core/
+COPY packages/merchant-sdk/package.json ./packages/merchant-sdk/
+COPY packages/observer-sdk/package.json ./packages/observer-sdk/
+COPY apps/payment-api/package.json ./apps/payment-api/
+COPY apps/checkout-portal/package.json ./apps/checkout-portal/
+COPY apps/merchant-admin/package.json ./apps/merchant-admin/
+COPY apps/sms-observer/package.json ./apps/sms-observer/
+COPY apps/gmail-observer/package.json ./apps/gmail-observer/
+COPY apps/control-center/package.json ./apps/control-center/
+COPY apps/coin-wallet-store/package.json ./apps/coin-wallet-store/
+COPY apps/payment-help/package.json ./apps/payment-help/
+
+# Clean installation of dependencies with script safety
+RUN npm ci --ignore-scripts
+
+# ── Stage 2: Builder ────────────────────────────────────────────────────────
+FROM deps AS builder
+WORKDIR /app
+COPY . .
+
+# Compile TypeScript packages
+RUN npm run build
+
+# ── Stage 3: Runner ─────────────────────────────────────────────────────────
+FROM base AS runner
+ENV NODE_ENV=production
+ENV YOUPI_MODE=production
+
+WORKDIR /app
+
+# Harden runtime image: strip unused package managers and CLI build tools to minimize attack surface and vulnerabilities
+RUN rm -rf /usr/local/lib/node_modules/npm \
+ /usr/local/lib/node_modules/corepack \
+ /usr/local/bin/npm \
+ /usr/local/bin/npx \
+ /usr/local/bin/corepack \
+ /opt/yarn*
+
+# Create unprivileged application user
+RUN addgroup -S -g 1001 youpi && \
+ adduser -S -u 1001 -G youpi youpi
+
+# Copy built application and workspace modules
+COPY --from=builder --chown=youpi:youpi /app ./
+
+# Setup data persistence directory for native SQLite
+RUN mkdir -p /app/data && chown -R youpi:youpi /app/data
+VOLUME ["/app/data"]
+
+# Expose all 7 services
+EXPOSE 5000 6001 6002 6003 6100 7000 8090
+
+USER youpi
+
+# Native healthcheck pinging core payment api
+HEALTHCHECK --interval=30s --timeout=10s --start-period=15s --retries=3 \
+ CMD wget -qO- http://localhost:6100/health || exit 1
+
+CMD ["node", "scripts/start.js"]
diff --git a/docker-compose.yml b/docker-compose.yml
new file mode 100644
index 0000000..0227ce1
--- /dev/null
+++ b/docker-compose.yml
@@ -0,0 +1,56 @@
+# =============================================================================
+# YOUPI PG V2 — Docker Compose Configuration
+#
+# Usage:
+# docker compose up -d # Start all services in background
+# docker compose logs -f # Follow combined service logs
+# docker compose down # Stop services
+# docker compose down -v # Stop and remove persistent SQLite volume
+# =============================================================================
+
+services:
+ gateway:
+ build:
+ context: .
+ dockerfile: Dockerfile
+ target: runner
+ image: youpi-pg:latest
+ container_name: youpi-pg
+ restart: unless-stopped
+ env_file:
+ - .env
+ environment:
+ NODE_ENV: ${NODE_ENV:-production}
+ YOUPI_MODE: ${YOUPI_MODE:-localhost}
+ BASE_PAYMENT_API_URL: http://localhost:6100
+ BASE_CHECKOUT_URL: http://localhost:7000
+ BASE_ADMIN_URL: http://localhost:6001
+ USE_SQLITE_FALLBACK: "true"
+ SQLITE_DB_PATH: /app/data/youpi_pg.sqlite
+ PAYMENT_API_PORT: 6100
+ CHECKOUT_PORTAL_PORT: 7000
+ MERCHANT_ADMIN_PORT: 6001
+ GMAIL_OBSERVER_PORT: 6003
+ SMS_OBSERVER_PORT: 6002
+ COIN_WALLET_STORE_PORT: 5000
+ CONTROL_CENTER_PORT: 8090
+ ports:
+ - "6100:6100" # Payment Core REST API
+ - "7000:7000" # Checkout Portal
+ - "6001:6001" # Merchant Admin Dashboard
+ - "6002:6002" # Android SMS Observer
+ - "6003:6003" # Gmail Observer
+ - "5000:5000" # Coin Wallet Demo Store
+ - "8090:8090" # Process Supervisor Daemon
+ volumes:
+ - youpi-data:/app/data
+ healthcheck:
+ test: ["CMD", "wget", "-qO-", "http://localhost:6100/health"]
+ interval: 30s
+ timeout: 10s
+ retries: 3
+ start_period: 20s
+
+volumes:
+ youpi-data:
+ driver: local